@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,55 @@
1
+ import { type CallOptions, type Client, type Service } from "@origincloud/core";
2
+ /**
3
+ * Calls RoleService.
4
+ *
5
+ * The catalog of predefined roles. A role is a named set of permissions; a
6
+ * role binding grants one to a principal in an organization or in one of
7
+ * its projects. The same for every caller: any authenticated caller can
8
+ * read it, and no permission is needed.
9
+ */
10
+ export declare class RoleClient {
11
+ /**
12
+ * The endpoint the client sends its calls to, which also serves the
13
+ * operations its methods answer with.
14
+ */
15
+ readonly service: Service;
16
+ /** A client of RoleService that sends its calls through `client`. */
17
+ constructor(client: Client);
18
+ /** Returns a role. */
19
+ getRole(request: GetRoleRequest, options?: CallOptions): Promise<Role>;
20
+ /** Lists every predefined role, in catalog order. */
21
+ listRoles(request: ListRolesRequest, options?: CallOptions): Promise<ListRolesResponse>;
22
+ }
23
+ /** A predefined role: a named set of permissions that a role binding grants. */
24
+ export interface Role {
25
+ /**
26
+ * The role's resource name, such as `roles/owner`, `roles/viewer` or
27
+ * `roles/billing.administrator`. A role binding names its role by it.
28
+ */
29
+ name?: string;
30
+ /** The role's URN, the identifier access policies and the audit log use. */
31
+ urn?: string;
32
+ /** The name the console shows, such as `Owner`. */
33
+ displayName?: string;
34
+ /** What holding the role allows, in a sentence. */
35
+ description?: string;
36
+ /**
37
+ * The permissions the role grants, `permissions/{permission}`, in
38
+ * catalog order.
39
+ */
40
+ includedPermissions?: string[];
41
+ }
42
+ /** The request for GetRole. */
43
+ export interface GetRoleRequest {
44
+ /** The role to return, `roles/{role}`. */
45
+ name?: string;
46
+ }
47
+ /** The request for ListRoles. The catalog is small, so it comes in one page. */
48
+ export interface ListRolesRequest {
49
+ }
50
+ /** The response for ListRoles. */
51
+ export interface ListRolesResponse {
52
+ /** Every predefined role, in catalog order. */
53
+ roles?: Role[];
54
+ }
55
+ //# sourceMappingURL=role.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../src/v1beta1/role.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAoB,MAAM,mBAAmB,CAAC;AAElG;;;;;;;GAOG;AACH,qBAAa,UAAU;IACrB;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,qEAAqE;gBACzD,MAAM,EAAE,MAAM;IAI1B,sBAAsB;IAChB,OAAO,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAa5E,qDAAqD;IAC/C,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAW9F;AAED,gFAAgF;AAChF,MAAM,WAAW,IAAI;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC;AAED,+BAA+B;AAC/B,MAAM,WAAW,cAAc;IAC7B,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,gFAAgF;AAChF,MAAM,WAAW,gBAAgB;CAAG;AAEpC,kCAAkC;AAClC,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;CAChB"}
@@ -0,0 +1,42 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/iam/v1beta1/role.proto
3
+ import { pathValue, query } from "@origincloud/core";
4
+ /**
5
+ * Calls RoleService.
6
+ *
7
+ * The catalog of predefined roles. A role is a named set of permissions; a
8
+ * role binding grants one to a principal in an organization or in one of
9
+ * its projects. The same for every caller: any authenticated caller can
10
+ * read it, and no permission is needed.
11
+ */
12
+ export class RoleClient {
13
+ /**
14
+ * The endpoint the client sends its calls to, which also serves the
15
+ * operations its methods answer with.
16
+ */
17
+ service;
18
+ /** A client of RoleService that sends its calls through `client`. */
19
+ constructor(client) {
20
+ this.service = client.service("iam", false);
21
+ }
22
+ /** Returns a role. */
23
+ async getRole(request, options) {
24
+ const p0 = pathValue("name", request.name, "roles/*");
25
+ return this.service.call({
26
+ method: "GET",
27
+ path: `/v1beta1/${p0}`,
28
+ query: query(request, ["name"]),
29
+ idempotent: true,
30
+ }, options);
31
+ }
32
+ /** Lists every predefined role, in catalog order. */
33
+ async listRoles(request, options) {
34
+ return this.service.call({
35
+ method: "GET",
36
+ path: `/v1beta1/roles`,
37
+ query: query(request, []),
38
+ idempotent: true,
39
+ }, options);
40
+ }
41
+ }
42
+ //# sourceMappingURL=role.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.js","sourceRoot":"","sources":["../../src/v1beta1/role.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,6CAA6C;AAE7C,OAAO,EAA+C,SAAS,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAElG;;;;;;;GAOG;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,sBAAsB;IACtB,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;IAED,qDAAqD;IACrD,KAAK,CAAC,SAAS,CAAC,OAAyB,EAAE,OAAqB;QAC9D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,gBAAgB;YACtB,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YACzB,UAAU,EAAE,IAAI;SACjB,EACD,OAAO,CACR,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,172 @@
1
+ import { type CallOptions, type Client, type Empty, type Service } from "@origincloud/core";
2
+ /**
3
+ * Calls RoleBindingService.
4
+ *
5
+ * Role bindings: each grants one role to one member, in a whole
6
+ * organization or in one of its projects. A member's access is the union
7
+ * of its bindings. Each binding is managed on its own, so creating or
8
+ * deleting one never touches another, whoever made it.
9
+ *
10
+ * A member is written as one of:
11
+ * - `user:{email}`: a user, by the verified email address of their
12
+ * account. A binding holds on to the account, not the address: it
13
+ * follows a later change of address, and is always shown with the
14
+ * account's current one.
15
+ * - `serviceAccount:{service_account}`: a service account of the same
16
+ * organization, by its id.
17
+ *
18
+ * and shown, never accepted, as:
19
+ * - `userId:{user}`: a user by the id of their account, when no verified
20
+ * address can be shown: the account's current address isn't verified, or
21
+ * the caller may only see their own bindings.
22
+ * - `deleted:user:{user}`: a user whose account no longer exists.
23
+ */
24
+ export declare class RoleBindingClient {
25
+ /**
26
+ * The endpoint the client sends its calls to, which also serves the
27
+ * operations its methods answer with.
28
+ */
29
+ readonly service: Service;
30
+ /** A client of RoleBindingService that sends its calls through `client`. */
31
+ constructor(client: Client);
32
+ /** Returns a role binding. Needs `iam.member.list` on the organization. */
33
+ getRoleBinding(request: GetRoleBindingRequest, options?: CallOptions): Promise<RoleBinding>;
34
+ /**
35
+ * Lists an organization's role bindings, oldest first, optionally only a
36
+ * member's or a project's. Needs `iam.member.list` on the organization.
37
+ * With the parent `organizations/-` it lists the caller's own bindings in
38
+ * every organization and needs no permission; `member` must be empty
39
+ * there.
40
+ */
41
+ listRoleBindings(request: ListRoleBindingsRequest, options?: CallOptions): Promise<ListRoleBindingsResponse>;
42
+ /**
43
+ * Iterates over everything listRoleBindings lists from the request's page on,
44
+ * fetching the next page as the loop reaches it. A page that fails ends
45
+ * the iteration with its error.
46
+ */
47
+ allRoleBindings(request: ListRoleBindingsRequest, options?: CallOptions): AsyncGenerator<RoleBinding, void, undefined>;
48
+ /**
49
+ * Grants a role to a member. Needs `iam.role.assign` on the
50
+ * organization, for a project binding as well, and every permission of
51
+ * the role at the binding's scope: a permission held on the organization
52
+ * counts for any scope, one held on a project only for that project.
53
+ * Refused with `NOT_FOUND` when no account has `member`'s address as its
54
+ * verified email: nothing is held for an address until its account
55
+ * exists. Refused with `CONFLICT` when the member already holds the role
56
+ * at that scope, and with `BAD_REQUEST` when the member is a deleted
57
+ * service account.
58
+ */
59
+ createRoleBinding(request: CreateRoleBindingRequest, options?: CallOptions): Promise<RoleBinding>;
60
+ /**
61
+ * Removes a role binding. Needs `iam.role.revoke` on the organization
62
+ * and every permission of the role at the binding's scope, as
63
+ * CreateRoleBinding does. Refused with `CONFLICT`, removing nothing,
64
+ * when it is the organization's last organization-wide binding of
65
+ * `roles/owner`: bind another owner first.
66
+ */
67
+ deleteRoleBinding(request: DeleteRoleBindingRequest, options?: CallOptions): Promise<Empty>;
68
+ }
69
+ /**
70
+ * One role granted to one member, organization-wide or in one project. A
71
+ * binding can't be changed: delete it and create another.
72
+ */
73
+ export interface RoleBinding {
74
+ /** The binding's resource name. */
75
+ name?: string;
76
+ /**
77
+ * The binding's URN, the identifier access policies and the audit log
78
+ * use.
79
+ */
80
+ urn?: string;
81
+ /**
82
+ * Who holds the role: `user:{email}` or
83
+ * `serviceAccount:{service_account}`. A user is shown with their
84
+ * account's current verified address, as `userId:{user}` when it has
85
+ * none, or as `deleted:user:{user}` once the account is gone.
86
+ */
87
+ member?: string;
88
+ /** The role granted, `roles/{role}`. */
89
+ role?: string;
90
+ /**
91
+ * The project the binding is limited to, `projects/{project}`, one of
92
+ * the organization's. Empty for a binding on the whole organization,
93
+ * which covers every project in it.
94
+ */
95
+ project?: string;
96
+ /**
97
+ * Who created the binding, written as a member is, or `platform` for a
98
+ * binding the platform made itself. Always `userId:{user}` for a user in
99
+ * a list of the caller's own bindings (`organizations/-`).
100
+ */
101
+ creator?: string;
102
+ /** When the binding was created. */
103
+ createTime?: string;
104
+ }
105
+ /** The request for GetRoleBinding. */
106
+ export interface GetRoleBindingRequest {
107
+ /** The binding to return. */
108
+ name?: string;
109
+ }
110
+ /** The request for ListRoleBindings. */
111
+ export interface ListRoleBindingsRequest {
112
+ /**
113
+ * The organization whose bindings to list, `organizations/{organization}`,
114
+ * or `organizations/-` for the caller's own bindings in every
115
+ * organization.
116
+ */
117
+ parent?: string;
118
+ /**
119
+ * Only the bindings of this member, `user:{email}` or
120
+ * `serviceAccount:{service_account}`. Every member's when empty.
121
+ */
122
+ member?: string;
123
+ /**
124
+ * Only the bindings limited to this project, `projects/{project}`. Every
125
+ * binding, organization-wide or not, when empty.
126
+ */
127
+ project?: string;
128
+ /**
129
+ * The most bindings to return; the server clamps it, and 0 means its
130
+ * default.
131
+ */
132
+ pageSize?: number;
133
+ /** A previous response's `nextPageToken`, for the page after it. */
134
+ pageToken?: string;
135
+ }
136
+ /** The response for ListRoleBindings. */
137
+ export interface ListRoleBindingsResponse {
138
+ /** The bindings on this page. */
139
+ roleBindings?: RoleBinding[];
140
+ /** The token for the next page; empty on the last one. */
141
+ nextPageToken?: string;
142
+ }
143
+ /** The request for CreateRoleBinding. */
144
+ export interface CreateRoleBindingRequest {
145
+ /**
146
+ * The organization to create the binding in,
147
+ * `organizations/{organization}`.
148
+ */
149
+ parent?: string;
150
+ /**
151
+ * The binding to create: its member and role, and optionally its
152
+ * project.
153
+ */
154
+ roleBinding?: RoleBinding;
155
+ /**
156
+ * A UUID. A repeat of the request with the same `requestId` within a
157
+ * day returns the binding the first request created, as it is now,
158
+ * instead of being refused as a conflict.
159
+ */
160
+ requestId?: string;
161
+ }
162
+ /** The request for DeleteRoleBinding. */
163
+ export interface DeleteRoleBindingRequest {
164
+ /** The binding to delete. */
165
+ name?: string;
166
+ /**
167
+ * A UUID. A repeat of the request with the same `requestId` within a
168
+ * day succeeds as the first did, instead of answering `NOT_FOUND`.
169
+ */
170
+ requestId?: string;
171
+ }
172
+ //# sourceMappingURL=role_binding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role_binding.d.ts","sourceRoot":"","sources":["../../src/v1beta1/role_binding.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,OAAO,EAIb,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,iBAAiB;IAC5B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,4EAA4E;gBAChE,MAAM,EAAE,MAAM;IAI1B,2EAA2E;IACrE,cAAc,CAAC,OAAO,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAajG;;;;;;OAMG;IACG,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAalH;;;;OAIG;IACI,eAAe,CAAC,OAAO,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC,WAAW,EAAE,IAAI,EAAE,SAAS,CAAC;IAS7H;;;;;;;;;;OAUG;IACG,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,WAA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AC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACvC,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,118 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/iam/v1beta1/role_binding.proto
3
+ import { newRequestId, pathValue, query, } from "@origincloud/core";
4
+ /**
5
+ * Calls RoleBindingService.
6
+ *
7
+ * Role bindings: each grants one role to one member, in a whole
8
+ * organization or in one of its projects. A member's access is the union
9
+ * of its bindings. Each binding is managed on its own, so creating or
10
+ * deleting one never touches another, whoever made it.
11
+ *
12
+ * A member is written as one of:
13
+ * - `user:{email}`: a user, by the verified email address of their
14
+ * account. A binding holds on to the account, not the address: it
15
+ * follows a later change of address, and is always shown with the
16
+ * account's current one.
17
+ * - `serviceAccount:{service_account}`: a service account of the same
18
+ * organization, by its id.
19
+ *
20
+ * and shown, never accepted, as:
21
+ * - `userId:{user}`: a user by the id of their account, when no verified
22
+ * address can be shown: the account's current address isn't verified, or
23
+ * the caller may only see their own bindings.
24
+ * - `deleted:user:{user}`: a user whose account no longer exists.
25
+ */
26
+ export class RoleBindingClient {
27
+ /**
28
+ * The endpoint the client sends its calls to, which also serves the
29
+ * operations its methods answer with.
30
+ */
31
+ service;
32
+ /** A client of RoleBindingService that sends its calls through `client`. */
33
+ constructor(client) {
34
+ this.service = client.service("iam", false);
35
+ }
36
+ /** Returns a role binding. Needs `iam.member.list` on the organization. */
37
+ async getRoleBinding(request, options) {
38
+ const p0 = pathValue("name", request.name, "organizations/*/roleBindings/*");
39
+ return this.service.call({
40
+ method: "GET",
41
+ path: `/v1beta1/${p0}`,
42
+ query: query(request, ["name"]),
43
+ idempotent: true,
44
+ }, options);
45
+ }
46
+ /**
47
+ * Lists an organization's role bindings, oldest first, optionally only a
48
+ * member's or a project's. Needs `iam.member.list` on the organization.
49
+ * With the parent `organizations/-` it lists the caller's own bindings in
50
+ * every organization and needs no permission; `member` must be empty
51
+ * there.
52
+ */
53
+ async listRoleBindings(request, options) {
54
+ const p0 = pathValue("parent", request.parent, "organizations/*");
55
+ return this.service.call({
56
+ method: "GET",
57
+ path: `/v1beta1/${p0}/roleBindings`,
58
+ query: query(request, ["parent"]),
59
+ idempotent: true,
60
+ }, options);
61
+ }
62
+ /**
63
+ * Iterates over everything listRoleBindings lists from the request's page on,
64
+ * fetching the next page as the loop reaches it. A page that fails ends
65
+ * the iteration with its error.
66
+ */
67
+ async *allRoleBindings(request, options) {
68
+ for (let page = request;;) {
69
+ const response = await this.listRoleBindings(page, options);
70
+ yield* response.roleBindings ?? [];
71
+ if (!response.nextPageToken)
72
+ return;
73
+ page = { ...page, pageToken: response.nextPageToken };
74
+ }
75
+ }
76
+ /**
77
+ * Grants a role to a member. Needs `iam.role.assign` on the
78
+ * organization, for a project binding as well, and every permission of
79
+ * the role at the binding's scope: a permission held on the organization
80
+ * counts for any scope, one held on a project only for that project.
81
+ * Refused with `NOT_FOUND` when no account has `member`'s address as its
82
+ * verified email: nothing is held for an address until its account
83
+ * exists. Refused with `CONFLICT` when the member already holds the role
84
+ * at that scope, and with `BAD_REQUEST` when the member is a deleted
85
+ * service account.
86
+ */
87
+ async createRoleBinding(request, options) {
88
+ if (!request.requestId)
89
+ request = { ...request, requestId: newRequestId() };
90
+ const p0 = pathValue("parent", request.parent, "organizations/*");
91
+ return this.service.call({
92
+ method: "POST",
93
+ path: `/v1beta1/${p0}/roleBindings`,
94
+ body: request.roleBinding,
95
+ query: query(request, ["parent", "roleBinding"]),
96
+ idempotent: true,
97
+ }, options);
98
+ }
99
+ /**
100
+ * Removes a role binding. Needs `iam.role.revoke` on the organization
101
+ * and every permission of the role at the binding's scope, as
102
+ * CreateRoleBinding does. Refused with `CONFLICT`, removing nothing,
103
+ * when it is the organization's last organization-wide binding of
104
+ * `roles/owner`: bind another owner first.
105
+ */
106
+ async deleteRoleBinding(request, options) {
107
+ if (!request.requestId)
108
+ request = { ...request, requestId: newRequestId() };
109
+ const p0 = pathValue("name", request.name, "organizations/*/roleBindings/*");
110
+ return this.service.call({
111
+ method: "DELETE",
112
+ path: `/v1beta1/${p0}`,
113
+ query: query(request, ["name"]),
114
+ idempotent: true,
115
+ }, options);
116
+ }
117
+ }
118
+ //# sourceMappingURL=role_binding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role_binding.js","sourceRoot":"","sources":["../../src/v1beta1/role_binding.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,qDAAqD;AAErD,OAAO,EAKL,YAAY,EACZ,SAAS,EACT,KAAK,GACN,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,iBAAiB;IAC5B;;;OAGG;IACM,OAAO,CAAU;IAE1B,4EAA4E;IAC5E,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED,2EAA2E;IAC3E,KAAK,CAAC,cAAc,CAAC,OAA8B,EAAE,OAAqB;QACxE,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,gCAAgC,CAAC,CAAC;QAC7E,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;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gBAAgB,CAAC,OAAgC,EAAE,OAAqB;QAC5E,MAAM,EAAE,GAAG,SAAS,CAAC,QAAQ,EAAE,O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,IAAI;SACjB,EACD,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,iBAAiB,CAAC,OAAiC,EAAE,OAAqB;QAC9E,IAAI,CAAC,OAAO,CAAC,SAAS;YAAE,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,CAAC;QAC5E,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,gCAAgC,CAAC,CAAC;QAC7E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB;YACE,MAAM,EAAE,QAAQ;YAChB,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"}
@@ -0,0 +1,146 @@
1
+ import { type CallOptions, type Client, type Empty, type Service } from "@origincloud/core";
2
+ /**
3
+ * Calls ServiceAccountService.
4
+ *
5
+ * Service accounts: an organization's credentials for software, which
6
+ * authenticate with the OAuth 2.0 client credentials grant and never log
7
+ * in interactively. A new service account holds no role: grant it one with
8
+ * a role binding on its `member`.
9
+ */
10
+ export declare class ServiceAccountClient {
11
+ /**
12
+ * The endpoint the client sends its calls to, which also serves the
13
+ * operations its methods answer with.
14
+ */
15
+ readonly service: Service;
16
+ /** A client of ServiceAccountService that sends its calls through `client`. */
17
+ constructor(client: Client);
18
+ /**
19
+ * Returns a service account, deleted or not. Needs
20
+ * `iam.service_account.list` on the organization.
21
+ */
22
+ getServiceAccount(request: GetServiceAccountRequest, options?: CallOptions): Promise<ServiceAccount>;
23
+ /**
24
+ * Lists an organization's service accounts, oldest first. Deleted ones
25
+ * are listed only when `showDeleted` is set. Needs
26
+ * `iam.service_account.list` on the organization.
27
+ */
28
+ listServiceAccounts(request: ListServiceAccountsRequest, options?: CallOptions): Promise<ListServiceAccountsResponse>;
29
+ /**
30
+ * Iterates over everything listServiceAccounts lists from the request's page on,
31
+ * fetching the next page as the loop reaches it. A page that fails ends
32
+ * the iteration with its error.
33
+ */
34
+ allServiceAccounts(request: ListServiceAccountsRequest, options?: CallOptions): AsyncGenerator<ServiceAccount, void, undefined>;
35
+ /**
36
+ * Creates a service account and its client secret. The response is the
37
+ * only place the secret is ever shown: store it now. Needs
38
+ * `iam.service_account.create` on the organization.
39
+ */
40
+ createServiceAccount(request: CreateServiceAccountRequest, options?: CallOptions): Promise<ServiceAccount>;
41
+ /**
42
+ * Deletes a service account for good: its credential is refused from
43
+ * then on, an access token it already holds is refused on its next
44
+ * request, and every role binding it holds, in any organization, is
45
+ * removed. It stays readable as `DELETED`. Deleting a deleted service
46
+ * account succeeds. Needs `iam.service_account.revoke` on the
47
+ * organization.
48
+ */
49
+ deleteServiceAccount(request: DeleteServiceAccountRequest, options?: CallOptions): Promise<Empty>;
50
+ }
51
+ /** A credential of an organization for software. */
52
+ export interface ServiceAccount {
53
+ /** The service account's resource name. */
54
+ name?: string;
55
+ /** A name of your own, shown in the console; at most 100 characters. */
56
+ displayName?: string;
57
+ /**
58
+ * The member a role binding names it by,
59
+ * `serviceAccount:{service_account}`.
60
+ */
61
+ member?: string;
62
+ /** The OAuth 2.0 client id it authenticates with. */
63
+ clientId?: string;
64
+ /**
65
+ * The OAuth 2.0 client secret it authenticates with. Set only in the
66
+ * response that created the service account, and empty everywhere else:
67
+ * it can't be read again.
68
+ */
69
+ clientSecret?: string;
70
+ /** Where the service account is in its lifecycle. */
71
+ state?: ServiceAccount_State;
72
+ /**
73
+ * Who created the service account, written as a role binding's member
74
+ * is.
75
+ */
76
+ creator?: string;
77
+ /** When the service account was created. */
78
+ createTime?: string;
79
+ /** When the service account was deleted; unset while it is active. */
80
+ deleteTime?: string;
81
+ }
82
+ /** Where the service account is in its lifecycle. */
83
+ export declare const ServiceAccount_State: {
84
+ /** Not set. */
85
+ readonly STATE_UNSPECIFIED: "STATE_UNSPECIFIED";
86
+ /** Its credential is accepted. */
87
+ readonly ACTIVE: "ACTIVE";
88
+ /** Deleted: its credential is refused, and it holds no role binding. */
89
+ readonly DELETED: "DELETED";
90
+ };
91
+ /** Where the service account is in its lifecycle. */
92
+ export type ServiceAccount_State = (typeof ServiceAccount_State)[keyof typeof ServiceAccount_State];
93
+ /** The request for GetServiceAccount. */
94
+ export interface GetServiceAccountRequest {
95
+ /** The service account to return. */
96
+ name?: string;
97
+ }
98
+ /** The request for ListServiceAccounts. */
99
+ export interface ListServiceAccountsRequest {
100
+ /**
101
+ * The organization whose service accounts to list,
102
+ * `organizations/{organization}`.
103
+ */
104
+ parent?: string;
105
+ /**
106
+ * The most service accounts to return; the server clamps it, and 0 means
107
+ * its default.
108
+ */
109
+ pageSize?: number;
110
+ /** A previous response's `nextPageToken`, for the page after it. */
111
+ pageToken?: string;
112
+ /** Whether deleted service accounts are listed too. */
113
+ showDeleted?: boolean;
114
+ }
115
+ /** The response for ListServiceAccounts. */
116
+ export interface ListServiceAccountsResponse {
117
+ /** The service accounts on this page. */
118
+ serviceAccounts?: ServiceAccount[];
119
+ /** The token for the next page; empty on the last one. */
120
+ nextPageToken?: string;
121
+ }
122
+ /** The request for CreateServiceAccount. */
123
+ export interface CreateServiceAccountRequest {
124
+ /**
125
+ * The organization to create the service account in,
126
+ * `organizations/{organization}`.
127
+ */
128
+ parent?: string;
129
+ /** The service account to create: its `displayName`. */
130
+ serviceAccount?: ServiceAccount;
131
+ /**
132
+ * A UUID. A repeat of the request with the same `requestId` within a
133
+ * day creates nothing and is refused with `CONFLICT`: the secret went to
134
+ * the first request only. The error's `ErrorInfo` metadata names the
135
+ * service account under `serviceAccount`; delete it and create a new one
136
+ * to get a working secret. The same `requestId` with a different
137
+ * request is refused with `CONFLICT` without that metadata.
138
+ */
139
+ requestId?: string;
140
+ }
141
+ /** The request for DeleteServiceAccount. */
142
+ export interface DeleteServiceAccountRequest {
143
+ /** The service account to delete. */
144
+ name?: string;
145
+ }
146
+ //# sourceMappingURL=service_account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service_account.d.ts","sourceRoot":"","sources":["../../src/v1beta1/service_account.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,OAAO,EAIb,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;GAOG;AACH,qBAAa,oBAAoB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,+EAA+E;gBACnE,MAAM,EAAE,MAAM;IAI1B;;;OAGG;IACG,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;IAa1G;;;;OAIG;IACG,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAa3H;;;;OAIG;IACI,kBAAkB,CAAC,OAAO,EAAE,0BAA0B,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC;IAStI;;;;OAIG;IACG,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;IAehH;;;;;;;OAOG;IACG,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;CAWxG;AAED,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,M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1C,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,106 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/iam/v1beta1/service_account.proto
3
+ import { newRequestId, pathValue, query, } from "@origincloud/core";
4
+ /**
5
+ * Calls ServiceAccountService.
6
+ *
7
+ * Service accounts: an organization's credentials for software, which
8
+ * authenticate with the OAuth 2.0 client credentials grant and never log
9
+ * in interactively. A new service account holds no role: grant it one with
10
+ * a role binding on its `member`.
11
+ */
12
+ export class ServiceAccountClient {
13
+ /**
14
+ * The endpoint the client sends its calls to, which also serves the
15
+ * operations its methods answer with.
16
+ */
17
+ service;
18
+ /** A client of ServiceAccountService that sends its calls through `client`. */
19
+ constructor(client) {
20
+ this.service = client.service("iam", false);
21
+ }
22
+ /**
23
+ * Returns a service account, deleted or not. Needs
24
+ * `iam.service_account.list` on the organization.
25
+ */
26
+ async getServiceAccount(request, options) {
27
+ const p0 = pathValue("name", request.name, "organizations/*/serviceAccounts/*");
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
+ * Lists an organization's service accounts, oldest first. Deleted ones
37
+ * are listed only when `showDeleted` is set. Needs
38
+ * `iam.service_account.list` on the organization.
39
+ */
40
+ async listServiceAccounts(request, options) {
41
+ const p0 = pathValue("parent", request.parent, "organizations/*");
42
+ return this.service.call({
43
+ method: "GET",
44
+ path: `/v1beta1/${p0}/serviceAccounts`,
45
+ query: query(request, ["parent"]),
46
+ idempotent: true,
47
+ }, options);
48
+ }
49
+ /**
50
+ * Iterates over everything listServiceAccounts lists from the request's page on,
51
+ * fetching the next page as the loop reaches it. A page that fails ends
52
+ * the iteration with its error.
53
+ */
54
+ async *allServiceAccounts(request, options) {
55
+ for (let page = request;;) {
56
+ const response = await this.listServiceAccounts(page, options);
57
+ yield* response.serviceAccounts ?? [];
58
+ if (!response.nextPageToken)
59
+ return;
60
+ page = { ...page, pageToken: response.nextPageToken };
61
+ }
62
+ }
63
+ /**
64
+ * Creates a service account and its client secret. The response is the
65
+ * only place the secret is ever shown: store it now. Needs
66
+ * `iam.service_account.create` on the organization.
67
+ */
68
+ async createServiceAccount(request, options) {
69
+ if (!request.requestId)
70
+ request = { ...request, requestId: newRequestId() };
71
+ const p0 = pathValue("parent", request.parent, "organizations/*");
72
+ return this.service.call({
73
+ method: "POST",
74
+ path: `/v1beta1/${p0}/serviceAccounts`,
75
+ body: request.serviceAccount,
76
+ query: query(request, ["parent", "serviceAccount"]),
77
+ idempotent: true,
78
+ }, options);
79
+ }
80
+ /**
81
+ * Deletes a service account for good: its credential is refused from
82
+ * then on, an access token it already holds is refused on its next
83
+ * request, and every role binding it holds, in any organization, is
84
+ * removed. It stays readable as `DELETED`. Deleting a deleted service
85
+ * account succeeds. Needs `iam.service_account.revoke` on the
86
+ * organization.
87
+ */
88
+ async deleteServiceAccount(request, options) {
89
+ const p0 = pathValue("name", request.name, "organizations/*/serviceAccounts/*");
90
+ return this.service.call({
91
+ method: "DELETE",
92
+ path: `/v1beta1/${p0}`,
93
+ query: query(request, ["name"]),
94
+ }, options);
95
+ }
96
+ }
97
+ /** Where the service account is in its lifecycle. */
98
+ export const ServiceAccount_State = {
99
+ /** Not set. */
100
+ STATE_UNSPECIFIED: "STATE_UNSPECIFIED",
101
+ /** Its credential is accepted. */
102
+ ACTIVE: "ACTIVE",
103
+ /** Deleted: its credential is refused, and it holds no role binding. */
104
+ DELETED: "DELETED",
105
+ };
106
+ //# sourceMappingURL=service_account.js.map