@origincloud/resourcemanager 0.0.0-stage → 0.3.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.
@@ -0,0 +1,151 @@
1
+ import { type CallOptions, type Client, type Empty, type Service } from "@origincloud/core";
2
+ import type { ProjectQuota } from "./quota.js";
3
+ /**
4
+ * Calls ProjectService.
5
+ *
6
+ * Projects: the namespace every resource is created in. A project belongs to
7
+ * one organization, and every resource name of the other APIs starts with
8
+ * it, `projects/{project}/...`.
9
+ */
10
+ export declare class ProjectClient {
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 ProjectService that sends its calls through `client`. */
17
+ constructor(client: Client);
18
+ /** Returns a project. */
19
+ getProject(request: GetProjectRequest, options?: CallOptions): Promise<Project>;
20
+ /** Lists an organization's projects, oldest first. */
21
+ listProjects(request: ListProjectsRequest, options?: CallOptions): Promise<ListProjectsResponse>;
22
+ /**
23
+ * Iterates over everything listProjects lists from the request's page on,
24
+ * fetching the next page as the loop reaches it. A page that fails ends
25
+ * the iteration with its error.
26
+ */
27
+ allProjects(request: ListProjectsRequest, options?: CallOptions): AsyncGenerator<Project, void, undefined>;
28
+ /**
29
+ * Creates a project in an `ACTIVE` organization, under the id the caller
30
+ * chooses. The caller becomes the project's owner, and the project is
31
+ * billed to the organization's default billing account. An id in use, or
32
+ * used by a project that was deleted, is refused as a `CONFLICT`.
33
+ */
34
+ createProject(request: CreateProjectRequest, options?: CallOptions): Promise<Project>;
35
+ /** Renames a project. */
36
+ updateProject(request: UpdateProjectRequest, options?: CallOptions): Promise<Project>;
37
+ /**
38
+ * Deletes a project. Refused as a `CONFLICT` while the project
39
+ * still has a resource you can delete yourself: an instance that isn't terminated, an image, a key
40
+ * pair, a volume or snapshot that isn't deleted, a NAT gateway, a floating
41
+ * IP, a VPC, or a DNS policy other than its default one. The refusal names
42
+ * every kind left, in the order to delete them. Nothing you can delete
43
+ * yourself is deleted on your behalf. The project's default DNS policy,
44
+ * its quota and every role granted on it go with it; roles granted on the
45
+ * organization stay.
46
+ */
47
+ deleteProject(request: DeleteProjectRequest, options?: CallOptions): Promise<Empty>;
48
+ /**
49
+ * Returns a project's quota: the budget of each kind of resource the
50
+ * project may hold, if one is set, and how much of it the project uses.
51
+ */
52
+ getProjectQuota(request: GetProjectQuotaRequest, options?: CallOptions): Promise<ProjectQuota>;
53
+ /**
54
+ * Sets or removes a project's budgets. A budget named in `updateMask`
55
+ * is set to the value given, or removed when the value is left out.
56
+ */
57
+ updateProjectQuota(request: UpdateProjectQuotaRequest, options?: CallOptions): Promise<ProjectQuota>;
58
+ }
59
+ /** A project: the namespace an organization's resources are created in. */
60
+ export interface Project {
61
+ /**
62
+ * The project's resource name, `projects/{project}`. The id, chosen when
63
+ * the project is created, is unique across the platform and never used
64
+ * again, not even after the project is deleted.
65
+ */
66
+ name?: string;
67
+ /**
68
+ * The project's URN, the identifier access policies and the audit log
69
+ * use.
70
+ */
71
+ urn?: string;
72
+ /** The organization the project belongs to, `organizations/{organization}`. */
73
+ organization?: string;
74
+ /** The name the console shows. Not empty. */
75
+ displayName?: string;
76
+ /** When the project was created. */
77
+ createTime?: string;
78
+ /**
79
+ * The principal that created the project, such as `user:<id>` or
80
+ * `service_account:<id>`.
81
+ */
82
+ creator?: string;
83
+ }
84
+ /** The request for GetProject. */
85
+ export interface GetProjectRequest {
86
+ /** The project to return. */
87
+ name?: string;
88
+ }
89
+ /** The request for ListProjects. */
90
+ export interface ListProjectsRequest {
91
+ /** The organization whose projects to list, `organizations/{organization}`. */
92
+ organization?: string;
93
+ /**
94
+ * The most projects to return; the server clamps it, and 0 means its
95
+ * default.
96
+ */
97
+ pageSize?: number;
98
+ /** A previous response's `nextPageToken`, for the page after it. */
99
+ pageToken?: string;
100
+ }
101
+ /** The response for ListProjects. */
102
+ export interface ListProjectsResponse {
103
+ /** The projects on this page. */
104
+ projects?: Project[];
105
+ /** The token for the next page; empty on the last one. */
106
+ nextPageToken?: string;
107
+ }
108
+ /** The request for CreateProject. */
109
+ export interface CreateProjectRequest {
110
+ /** The project to create: its `organization` and `displayName`. */
111
+ project?: Project;
112
+ /**
113
+ * The project's id, the last segment of its name: 6 to 16 lowercase
114
+ * letters, digits and hyphens, starting with a letter and not ending with
115
+ * a hyphen, such as `acme-prod`.
116
+ */
117
+ projectId?: string;
118
+ /**
119
+ * A UUID; a repeat with the same id returns the project the first request
120
+ * created instead of creating a second one.
121
+ */
122
+ requestId?: string;
123
+ }
124
+ /** The request for UpdateProject. */
125
+ export interface UpdateProjectRequest {
126
+ /** The project, by its name, with the fields to change. */
127
+ project?: Project;
128
+ /** The fields to change: `displayName`. `*` is the same. */
129
+ updateMask?: string;
130
+ }
131
+ /** The request for DeleteProject. */
132
+ export interface DeleteProjectRequest {
133
+ /** The project to delete. */
134
+ name?: string;
135
+ }
136
+ /** The request for GetProjectQuota. */
137
+ export interface GetProjectQuotaRequest {
138
+ /** The quota to return, `projects/{project}/quota`. */
139
+ name?: string;
140
+ }
141
+ /** The request for UpdateProjectQuota. */
142
+ export interface UpdateProjectQuotaRequest {
143
+ /** The quota, by its name, with the budgets to set. */
144
+ projectQuota?: ProjectQuota;
145
+ /**
146
+ * The budgets to set or remove, such as `maxVcpu`. `*` is every budget:
147
+ * those given are set, the others removed.
148
+ */
149
+ updateMask?: string;
150
+ }
151
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/v1beta1/project.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,OAAO,EAIb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;GAMG;AACH,qBAAa,aAAa;IACxB;;;OAGG;IACH,QAAQ,CAAC,OAAO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AC,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,126 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/resourcemanager/v1beta1/project.proto
3
+ import { newRequestId, pathValue, query, } from "@origincloud/core";
4
+ /**
5
+ * Calls ProjectService.
6
+ *
7
+ * Projects: the namespace every resource is created in. A project belongs to
8
+ * one organization, and every resource name of the other APIs starts with
9
+ * it, `projects/{project}/...`.
10
+ */
11
+ export class ProjectClient {
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 ProjectService that sends its calls through `client`. */
18
+ constructor(client) {
19
+ this.service = client.service("resourcemanager", false);
20
+ }
21
+ /** Returns a project. */
22
+ async getProject(request, options) {
23
+ const p0 = pathValue("name", request.name, "projects/*");
24
+ return this.service.call({
25
+ method: "GET",
26
+ path: `/v1beta1/${p0}`,
27
+ query: query(request, ["name"]),
28
+ idempotent: true,
29
+ }, options);
30
+ }
31
+ /** Lists an organization's projects, oldest first. */
32
+ async listProjects(request, options) {
33
+ return this.service.call({
34
+ method: "GET",
35
+ path: `/v1beta1/projects`,
36
+ query: query(request, []),
37
+ idempotent: true,
38
+ }, options);
39
+ }
40
+ /**
41
+ * Iterates over everything listProjects lists from the request's page on,
42
+ * fetching the next page as the loop reaches it. A page that fails ends
43
+ * the iteration with its error.
44
+ */
45
+ async *allProjects(request, options) {
46
+ for (let page = request;;) {
47
+ const response = await this.listProjects(page, options);
48
+ yield* response.projects ?? [];
49
+ if (!response.nextPageToken)
50
+ return;
51
+ page = { ...page, pageToken: response.nextPageToken };
52
+ }
53
+ }
54
+ /**
55
+ * Creates a project in an `ACTIVE` organization, under the id the caller
56
+ * chooses. The caller becomes the project's owner, and the project is
57
+ * billed to the organization's default billing account. An id in use, or
58
+ * used by a project that was deleted, is refused as a `CONFLICT`.
59
+ */
60
+ async createProject(request, options) {
61
+ if (!request.requestId)
62
+ request = { ...request, requestId: newRequestId() };
63
+ return this.service.call({
64
+ method: "POST",
65
+ path: `/v1beta1/projects`,
66
+ body: request.project,
67
+ query: query(request, ["project"]),
68
+ idempotent: true,
69
+ }, options);
70
+ }
71
+ /** Renames a project. */
72
+ async updateProject(request, options) {
73
+ const p0 = pathValue("project.name", request.project?.name, "projects/*");
74
+ return this.service.call({
75
+ method: "PATCH",
76
+ path: `/v1beta1/${p0}`,
77
+ body: request.project,
78
+ query: query(request, ["project.name", "project"]),
79
+ }, options);
80
+ }
81
+ /**
82
+ * Deletes a project. Refused as a `CONFLICT` while the project
83
+ * still has a resource you can delete yourself: an instance that isn't terminated, an image, a key
84
+ * pair, a volume or snapshot that isn't deleted, a NAT gateway, a floating
85
+ * IP, a VPC, or a DNS policy other than its default one. The refusal names
86
+ * every kind left, in the order to delete them. Nothing you can delete
87
+ * yourself is deleted on your behalf. The project's default DNS policy,
88
+ * its quota and every role granted on it go with it; roles granted on the
89
+ * organization stay.
90
+ */
91
+ async deleteProject(request, options) {
92
+ const p0 = pathValue("name", request.name, "projects/*");
93
+ return this.service.call({
94
+ method: "DELETE",
95
+ path: `/v1beta1/${p0}`,
96
+ query: query(request, ["name"]),
97
+ }, options);
98
+ }
99
+ /**
100
+ * Returns a project's quota: the budget of each kind of resource the
101
+ * project may hold, if one is set, and how much of it the project uses.
102
+ */
103
+ async getProjectQuota(request, options) {
104
+ const p0 = pathValue("name", request.name, "projects/*/quota");
105
+ return this.service.call({
106
+ method: "GET",
107
+ path: `/v1beta1/${p0}`,
108
+ query: query(request, ["name"]),
109
+ idempotent: true,
110
+ }, options);
111
+ }
112
+ /**
113
+ * Sets or removes a project's budgets. A budget named in `updateMask`
114
+ * is set to the value given, or removed when the value is left out.
115
+ */
116
+ async updateProjectQuota(request, options) {
117
+ const p0 = pathValue("projectQuota.name", request.projectQuota?.name, "projects/*/quota");
118
+ return this.service.call({
119
+ method: "PATCH",
120
+ path: `/v1beta1/${p0}`,
121
+ body: request.projectQuota,
122
+ query: query(request, ["projectQuota.name", "projectQuota"]),
123
+ }, options);
124
+ }
125
+ }
126
+ //# sourceMappingURL=project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/v1beta1/project.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,4DAA4D;AAE5D,OAAO,EAKL,YAAY,EACZ,SAAS,EACT,KAAK,GACN,MAAM,mBAAmB,CAAC;AAG3B;;;;;;GAMG;AACH,MAAM,OAAO,aAAa;IACxB;;;OAGG;IACM,OAAO,CAAU;IAE1B,wEAAwE;IACxE,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC;IAED,yBAAyB;IACzB,KAAK,CAAC,UAAU,CAAC,OAA0B,EAAE,OAAqB;QAChE,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACzD,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,sDAAsD;IACtD,KAAK,CAAC,YAAY,CAAC,OAA4B,EAAE,OAAqB;QACpE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YACzB,UAAU,EAAE,IAAI;SACjB,EACD,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,CAAC,WAAW,CAAC,OAA4B,EAAE,OAAqB;QACpE,KAAK,IAAI,IAAI,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ind of resource its projects
3
+ * may hold together, and how much of it they use. Creating a resource past a
4
+ * limit is refused.
5
+ */
6
+ export interface OrganizationQuota {
7
+ /** The quota's resource name, `organizations/{organization}/quota`. */
8
+ name?: string;
9
+ /** The most instances that aren't terminated. */
10
+ maxInstances?: string;
11
+ /** The most vCPUs, summed over the instances that aren't terminated. */
12
+ maxVcpu?: string;
13
+ /** The most GiB of volumes that aren't deleted. */
14
+ maxVolumeGib?: string;
15
+ /** The most VPCs. */
16
+ maxVpcs?: string;
17
+ /** The most floating IPs. */
18
+ maxPublicIps?: string;
19
+ /** How much of each limit the organization's projects use together. */
20
+ usage?: QuotaUsage;
21
+ }
22
+ /**
23
+ * A project's quota: the budgets its owners set for it, and how much of each
24
+ * the project uses. A project without a budget for a kind of resource is
25
+ * bounded by its organization's quota alone; with one, by both. Budgets are
26
+ * not reservations: several projects' budgets may add up to more than the
27
+ * organization's limit.
28
+ */
29
+ export interface ProjectQuota {
30
+ /** The quota's resource name, `projects/{project}/quota`. */
31
+ name?: string;
32
+ /**
33
+ * The most instances that aren't terminated; unset means no budget. Each
34
+ * budget is zero or more, and no more than the organization's limit for
35
+ * the same kind.
36
+ */
37
+ maxInstances?: string;
38
+ /**
39
+ * The most vCPUs, summed over the instances that aren't terminated; unset
40
+ * means no budget.
41
+ */
42
+ maxVcpu?: string;
43
+ /** The most GiB of volumes that aren't deleted; unset means no budget. */
44
+ maxVolumeGib?: string;
45
+ /** The most VPCs; unset means no budget. */
46
+ maxVpcs?: string;
47
+ /** The most floating IPs; unset means no budget. */
48
+ maxPublicIps?: string;
49
+ /** How much of each budget the project uses. */
50
+ usage?: QuotaUsage;
51
+ }
52
+ /**
53
+ * How many of each kind of resource are held. Counted continuously, so a
54
+ * resource just created or deleted can take up to half a minute to show;
55
+ * a limit is enforced on the exact count.
56
+ */
57
+ export interface QuotaUsage {
58
+ /** Instances that aren't terminated. */
59
+ instances?: string;
60
+ /** vCPUs of the instances that aren't terminated. */
61
+ vcpu?: string;
62
+ /** GiB of volumes that aren't deleted. */
63
+ volumeGib?: string;
64
+ /** VPCs. */
65
+ vpcs?: string;
66
+ /** Floating IPs. */
67
+ publicIps?: string;
68
+ }
69
+ //# sourceMappingURL=quota.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota.d.ts","sourceRoot":"","sources":["../../src/v1beta1/quota.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6BAA6B;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,4 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/resourcemanager/v1beta1/quota.proto
3
+ export {};
4
+ //# sourceMappingURL=quota.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota.js","sourceRoot":"","sources":["../../src/v1beta1/quota.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,0DAA0D"}
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@origincloud/resourcemanager",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.0",
4
+ "description": "Origin Cloud's resourcemanager service: organizations, projects and their quotas.",
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/resourcemanager"
11
+ },
12
+ "bugs": "https://github.com/origincloudhq/sdk-typescript/issues",
13
+ "keywords": [
14
+ "origincloud",
15
+ "origin-cloud",
16
+ "sdk",
17
+ "resourcemanager"
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.3.0"
38
+ },
39
+ "devDependencies": {
40
+ "@origincloud/core": "^0.3.0"
41
+ }
42
+ }
@@ -0,0 +1,5 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+
3
+ export * from "./organization.js";
4
+ export * from "./project.js";
5
+ export * from "./quota.js";
@@ -0,0 +1,245 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/resourcemanager/v1beta1/organization.proto
3
+
4
+ import {
5
+ type CallOptions,
6
+ type Client,
7
+ type Empty,
8
+ type Service,
9
+ newRequestId,
10
+ pathValue,
11
+ query,
12
+ } from "@origincloud/core";
13
+ import type { OrganizationQuota } from "./quota.js";
14
+
15
+ /**
16
+ * Calls OrganizationService.
17
+ *
18
+ * Organizations: the account a company's projects, members and billing
19
+ * belong to. Every project is in exactly one organization, and access to an
20
+ * organization is granted with roles in the IAM API (`iam.origincloudapis.eu`).
21
+ */
22
+ export class OrganizationClient {
23
+ /**
24
+ * The endpoint the client sends its calls to, which also serves the
25
+ * operations its methods answer with.
26
+ */
27
+ readonly service: Service;
28
+
29
+ /** A client of OrganizationService that sends its calls through `client`. */
30
+ constructor(client: Client) {
31
+ this.service = client.service("resourcemanager", false);
32
+ }
33
+
34
+ /** Returns an organization. */
35
+ async getOrganization(request: GetOrganizationRequest, options?: CallOptions): Promise<Organization> {
36
+ const p0 = pathValue("name", request.name, "organizations/*");
37
+ return this.service.call<Organization>(
38
+ {
39
+ method: "GET",
40
+ path: `/v1beta1/${p0}`,
41
+ query: query(request, ["name"]),
42
+ idempotent: true,
43
+ },
44
+ options,
45
+ );
46
+ }
47
+
48
+ /** Lists the organizations the caller holds a role in, oldest first. */
49
+ async listOrganizations(request: ListOrganizationsRequest, options?: CallOptions): Promise<ListOrganizationsResponse> {
50
+ return this.service.call<ListOrganizationsResponse>(
51
+ {
52
+ method: "GET",
53
+ path: `/v1beta1/organizations`,
54
+ query: query(request, []),
55
+ idempotent: true,
56
+ },
57
+ options,
58
+ );
59
+ }
60
+
61
+ /**
62
+ * Iterates over everything listOrganizations lists from the request's page on,
63
+ * fetching the next page as the loop reaches it. A page that fails ends
64
+ * the iteration with its error.
65
+ */
66
+ async *allOrganizations(request: ListOrganizationsRequest, options?: CallOptions): AsyncGenerator<Organization, void, undefined> {
67
+ for (let page = request; ; ) {
68
+ const response = await this.listOrganizations(page, options);
69
+ yield* response.organizations ?? [];
70
+ if (!response.nextPageToken) return;
71
+ page = { ...page, pageToken: response.nextPageToken };
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Creates an organization. Any signed-in user can create one, and becomes
77
+ * its owner and the administrator of its default billing account, which
78
+ * is created with it without billing details: the organization can't be
79
+ * invoiced until they are set with the billing API
80
+ * (`billing.origincloudapis.eu`). A new organization is either `ACTIVE`
81
+ * at once or `PENDING_REVIEW`, depending on the platform's free capacity.
82
+ */
83
+ async createOrganization(request: CreateOrganizationRequest, options?: CallOptions): Promise<Organization> {
84
+ if (!request.requestId) request = { ...request, requestId: newRequestId() };
85
+ return this.service.call<Organization>(
86
+ {
87
+ method: "POST",
88
+ path: `/v1beta1/organizations`,
89
+ body: request.organization,
90
+ query: query(request, ["organization"]),
91
+ idempotent: true,
92
+ },
93
+ options,
94
+ );
95
+ }
96
+
97
+ /** Renames an organization. */
98
+ async updateOrganization(request: UpdateOrganizationRequest, options?: CallOptions): Promise<Organization> {
99
+ const p0 = pathValue("organization.name", request.organization?.name, "organizations/*");
100
+ return this.service.call<Organization>(
101
+ {
102
+ method: "PATCH",
103
+ path: `/v1beta1/${p0}`,
104
+ body: request.organization,
105
+ query: query(request, ["organization.name", "organization"]),
106
+ },
107
+ options,
108
+ );
109
+ }
110
+
111
+ /**
112
+ * Deletes an organization. Refused as a `CONFLICT` while it
113
+ * still has a project: delete its projects first. Its quota and every
114
+ * role granted in it go with it. Its billing accounts stay, with their
115
+ * spend limits, so the last period can still be invoiced.
116
+ */
117
+ async deleteOrganization(request: DeleteOrganizationRequest, options?: CallOptions): Promise<Empty> {
118
+ const p0 = pathValue("name", request.name, "organizations/*");
119
+ return this.service.call<Empty>(
120
+ {
121
+ method: "DELETE",
122
+ path: `/v1beta1/${p0}`,
123
+ query: query(request, ["name"]),
124
+ },
125
+ options,
126
+ );
127
+ }
128
+
129
+ /**
130
+ * Returns an organization's quota: the most of each kind of resource its
131
+ * projects may hold together, and how much of it they use. The limits are
132
+ * set by the platform; ask support to raise one.
133
+ */
134
+ async getOrganizationQuota(request: GetOrganizationQuotaRequest, options?: CallOptions): Promise<OrganizationQuota> {
135
+ const p0 = pathValue("name", request.name, "organizations/*/quota");
136
+ return this.service.call<OrganizationQuota>(
137
+ {
138
+ method: "GET",
139
+ path: `/v1beta1/${p0}`,
140
+ query: query(request, ["name"]),
141
+ idempotent: true,
142
+ },
143
+ options,
144
+ );
145
+ }
146
+ }
147
+
148
+ /** An organization: the account its projects, members and billing belong to. */
149
+ export interface Organization {
150
+ /** The organization's resource name, `organizations/{organization}`. */
151
+ name?: string;
152
+ /**
153
+ * The organization's URN, the identifier access policies and the audit
154
+ * log use.
155
+ */
156
+ urn?: string;
157
+ /** The name the console shows, typically the company's name. Not empty. */
158
+ displayName?: string;
159
+ /**
160
+ * Whether the organization may create resources. Decided by the
161
+ * platform, never by the organization's members.
162
+ */
163
+ state?: Organization_State;
164
+ /** When the organization was created. */
165
+ createTime?: string;
166
+ /**
167
+ * The principal that created the organization, such as `user:<id>` or
168
+ * `service_account:<id>`.
169
+ */
170
+ creator?: string;
171
+ }
172
+
173
+ /** Whether the organization may create resources. */
174
+ export const Organization_State = {
175
+ /** Not set. */
176
+ STATE_UNSPECIFIED: "STATE_UNSPECIFIED",
177
+ /**
178
+ * Under review by the platform: it can't create projects or resources
179
+ * until it is `ACTIVE`.
180
+ */
181
+ PENDING_REVIEW: "PENDING_REVIEW",
182
+ /** Admitted: it can create projects and resources. */
183
+ ACTIVE: "ACTIVE",
184
+ /** Not admitted. Final. */
185
+ REJECTED: "REJECTED",
186
+ } as const;
187
+
188
+ /** Whether the organization may create resources. */
189
+ export type Organization_State = (typeof Organization_State)[keyof typeof Organization_State];
190
+
191
+ /** The request for GetOrganization. */
192
+ export interface GetOrganizationRequest {
193
+ /** The organization to return. */
194
+ name?: string;
195
+ }
196
+
197
+ /** The request for ListOrganizations. */
198
+ export interface ListOrganizationsRequest {
199
+ /**
200
+ * The most organizations to return; the server clamps it, and 0 means its
201
+ * default.
202
+ */
203
+ pageSize?: number;
204
+ /** A previous response's `nextPageToken`, for the page after it. */
205
+ pageToken?: string;
206
+ }
207
+
208
+ /** The response for ListOrganizations. */
209
+ export interface ListOrganizationsResponse {
210
+ /** The organizations on this page. */
211
+ organizations?: Organization[];
212
+ /** The token for the next page; empty on the last one. */
213
+ nextPageToken?: string;
214
+ }
215
+
216
+ /** The request for CreateOrganization. */
217
+ export interface CreateOrganizationRequest {
218
+ /** The organization to create: its `displayName`. */
219
+ organization?: Organization;
220
+ /**
221
+ * A UUID; a repeat with the same id returns the organization the first
222
+ * request created instead of creating a second one.
223
+ */
224
+ requestId?: string;
225
+ }
226
+
227
+ /** The request for UpdateOrganization. */
228
+ export interface UpdateOrganizationRequest {
229
+ /** The organization, by its name, with the fields to change. */
230
+ organization?: Organization;
231
+ /** The fields to change: `displayName`. `*` is the same. */
232
+ updateMask?: string;
233
+ }
234
+
235
+ /** The request for DeleteOrganization. */
236
+ export interface DeleteOrganizationRequest {
237
+ /** The organization to delete. */
238
+ name?: string;
239
+ }
240
+
241
+ /** The request for GetOrganizationQuota. */
242
+ export interface GetOrganizationQuotaRequest {
243
+ /** The quota to return, `organizations/{organization}/quota`. */
244
+ name?: string;
245
+ }