withruntime 1.0.0 → 1.1.1
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.
- package/CHANGELOG.md +76 -0
- package/README.md +145 -0
- package/dist/generated/agentSessions.d.ts +218 -0
- package/dist/generated/agentSessions.js +154 -0
- package/dist/generated/agents.d.ts +193 -0
- package/dist/generated/agents.js +166 -0
- package/dist/generated/apps.d.ts +87 -28
- package/dist/generated/apps.js +153 -41
- package/dist/generated/audit.d.ts +2 -2
- package/dist/generated/audit.js +3 -3
- package/dist/generated/browsers.d.ts +87 -28
- package/dist/generated/browsers.js +153 -41
- package/dist/generated/builds.d.ts +87 -28
- package/dist/generated/builds.js +153 -41
- package/dist/generated/ci.d.ts +87 -28
- package/dist/generated/ci.js +153 -41
- package/dist/generated/containers.d.ts +87 -28
- package/dist/generated/containers.js +153 -41
- package/dist/generated/desktops.d.ts +89 -30
- package/dist/generated/desktops.js +155 -43
- package/dist/generated/domains.d.ts +52 -15
- package/dist/generated/domains.js +74 -14
- package/dist/generated/egressIps.d.ts +6 -6
- package/dist/generated/egressIps.js +4 -4
- package/dist/generated/events.d.ts +4 -2
- package/dist/generated/events.js +3 -3
- package/dist/generated/feedback.d.ts +1 -1
- package/dist/generated/feedback.js +3 -3
- package/dist/generated/functions.d.ts +87 -28
- package/dist/generated/functions.js +153 -41
- package/dist/generated/identities.d.ts +2 -2
- package/dist/generated/identities.js +5 -5
- package/dist/generated/images.d.ts +68 -14
- package/dist/generated/images.js +96 -15
- package/dist/generated/index.d.ts +9 -0
- package/dist/generated/index.js +12 -0
- package/dist/generated/jobRuns.d.ts +11 -4
- package/dist/generated/jobRuns.js +6 -6
- package/dist/generated/jobs.d.ts +58 -9
- package/dist/generated/jobs.js +98 -14
- package/dist/generated/keys.d.ts +8 -6
- package/dist/generated/keys.js +6 -6
- package/dist/generated/me.d.ts +2 -2
- package/dist/generated/me.js +3 -3
- package/dist/generated/messages.d.ts +67 -0
- package/dist/generated/messages.js +17 -0
- package/dist/generated/networks.d.ts +4 -4
- package/dist/generated/networks.js +4 -4
- package/dist/generated/notebooks.d.ts +87 -28
- package/dist/generated/notebooks.js +153 -41
- package/dist/generated/otel.d.ts +2 -2
- package/dist/generated/otel.js +5 -5
- package/dist/generated/ports.d.ts +11 -11
- package/dist/generated/ports.js +8 -8
- package/dist/generated/previews.d.ts +50 -15
- package/dist/generated/previews.js +70 -18
- package/dist/generated/projects.d.ts +30 -6
- package/dist/generated/projects.js +13 -9
- package/dist/generated/roles.d.ts +11 -2
- package/dist/generated/roles.js +9 -5
- package/dist/generated/routes.js +1 -1
- package/dist/generated/runtime.d.ts +15 -3
- package/dist/generated/runtime.js +31 -18
- package/dist/generated/sandboxes.d.ts +213 -66
- package/dist/generated/sandboxes.js +171 -43
- package/dist/generated/secrets.d.ts +45 -6
- package/dist/generated/secrets.js +69 -9
- package/dist/generated/sessions.d.ts +1 -1
- package/dist/generated/sessions.js +4 -4
- package/dist/generated/signing.js +3 -1
- package/dist/generated/sites.d.ts +87 -28
- package/dist/generated/sites.js +153 -41
- package/dist/generated/snapshots.d.ts +70 -5
- package/dist/generated/snapshots.js +107 -7
- package/dist/generated/tunnels.d.ts +8 -8
- package/dist/generated/tunnels.js +4 -4
- package/dist/generated/usage.d.ts +57 -6
- package/dist/generated/usage.js +4 -4
- package/dist/generated/volumes.d.ts +72 -7
- package/dist/generated/volumes.js +114 -10
- package/dist/generated/webhooks.d.ts +2 -2
- package/dist/generated/webhooks.js +5 -5
- package/dist/generated/workspaces.d.ts +87 -28
- package/dist/generated/workspaces.js +153 -41
- package/dist/v2/bin.d.ts +2 -0
- package/dist/v2/bin.js +15 -0
- package/dist/v2/cli.d.ts +15 -2
- package/dist/v2/cli.js +158 -53
- package/dist/v2/json.d.ts +9 -0
- package/dist/v2/json.js +5 -0
- package/dist/v2/mcp.js +14 -1
- package/dist/v2/openapi.json +7695 -4382
- package/dist/v2/shims/fly.js +49 -13
- package/dist/v2/shims/morph.js +1 -1
- package/dist/v2/table.d.ts +7 -4
- package/dist/v2/table.js +97 -34
- package/package.json +7 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by spec-gen from engines/front/crates/spec. Do not edit:
|
|
2
2
|
// change the spec and run `cargo run -p runtime-front-spec-gen -- write`.
|
|
3
3
|
import { Paginated } from "./runtime.js";
|
|
4
|
-
/** One of previews: A port of a
|
|
4
|
+
/** One of previews: A port of a machine at a public HTTPS address: private with a signed token, or public. */
|
|
5
5
|
export class Preview {
|
|
6
6
|
#c;
|
|
7
7
|
/** What it was when last read. */
|
|
@@ -10,58 +10,110 @@ export class Preview {
|
|
|
10
10
|
this.#c = client;
|
|
11
11
|
this.info = info;
|
|
12
12
|
}
|
|
13
|
+
/** Its name. */
|
|
14
|
+
get name() {
|
|
15
|
+
return this.info.name;
|
|
16
|
+
}
|
|
13
17
|
/** Its id. */
|
|
14
18
|
get id() {
|
|
15
19
|
return this.info.id;
|
|
16
20
|
}
|
|
21
|
+
/** Always `preview`. */
|
|
22
|
+
get object() {
|
|
23
|
+
return this.info.object;
|
|
24
|
+
}
|
|
25
|
+
/** The machine whose port it shares. */
|
|
26
|
+
get sandboxId() {
|
|
27
|
+
return this.info.sandboxId;
|
|
28
|
+
}
|
|
29
|
+
/** The port inside the machine. */
|
|
30
|
+
get port() {
|
|
31
|
+
return this.info.port;
|
|
32
|
+
}
|
|
33
|
+
/** `private` or `public`. */
|
|
34
|
+
get visibility() {
|
|
35
|
+
return this.info.visibility;
|
|
36
|
+
}
|
|
37
|
+
/** Its address. A private one also needs the token. */
|
|
38
|
+
get url() {
|
|
39
|
+
return this.info.url;
|
|
40
|
+
}
|
|
41
|
+
/** Where it is: `ready` once every serving host routes it. */
|
|
42
|
+
get state() {
|
|
43
|
+
return this.info.state;
|
|
44
|
+
}
|
|
45
|
+
/** A token signed for this answer, for a private preview and a key that may create one: send it in the `x-runtime-preview-token` header, or open the url with `?runtime_preview_token=<token>` in a browser. */
|
|
46
|
+
get token() {
|
|
47
|
+
return this.info.token;
|
|
48
|
+
}
|
|
49
|
+
/** When this answer's token stops working. */
|
|
50
|
+
get tokenExpiresAt() {
|
|
51
|
+
return this.info.tokenExpiresAt;
|
|
52
|
+
}
|
|
53
|
+
/** The sites that may show it in an iframe; none for any site. */
|
|
54
|
+
get embedOrigins() {
|
|
55
|
+
return this.info.embedOrigins;
|
|
56
|
+
}
|
|
57
|
+
/** When it was created. */
|
|
58
|
+
get createdAt() {
|
|
59
|
+
return this.info.createdAt;
|
|
60
|
+
}
|
|
61
|
+
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
62
|
+
get deletedAt() {
|
|
63
|
+
return this.info.deletedAt;
|
|
64
|
+
}
|
|
17
65
|
/** Returns a preview; `sign` returns one with a token. */
|
|
18
|
-
async refresh(options) {
|
|
19
|
-
this.info =
|
|
66
|
+
async refresh(query = {}, options) {
|
|
67
|
+
this.info = (await this.#c.get(this.name, query, options)).info;
|
|
20
68
|
return this;
|
|
21
69
|
}
|
|
22
70
|
/** Returns a private preview with a new token; tokens signed before keep their own expiry. */
|
|
23
71
|
async sign(query = {}, options) {
|
|
24
|
-
this.info = await this.#c.sign(this.
|
|
72
|
+
this.info = await this.#c.sign(this.name, query, options);
|
|
25
73
|
return this;
|
|
26
74
|
}
|
|
27
75
|
/** Refuses every token signed for a preview so far, and returns a new one. */
|
|
28
76
|
async rotate(options) {
|
|
29
|
-
this.info = await this.#c.rotate(this.
|
|
77
|
+
this.info = await this.#c.rotate(this.name, options);
|
|
30
78
|
return this;
|
|
31
79
|
}
|
|
32
80
|
/** Stops sharing a port. */
|
|
33
81
|
delete(options) {
|
|
34
|
-
return this.#c.delete(this.
|
|
82
|
+
return this.#c.delete(this.name, options);
|
|
83
|
+
}
|
|
84
|
+
/** Deletes it when the `await using` block that holds it ends. */
|
|
85
|
+
async [Symbol.asyncDispose]() {
|
|
86
|
+
await this.delete();
|
|
35
87
|
}
|
|
36
88
|
}
|
|
37
|
-
/** A port of a
|
|
89
|
+
/** A port of a machine at a public HTTPS address: private with a signed token, or public. */
|
|
38
90
|
export class Previews {
|
|
39
|
-
|
|
91
|
+
transport;
|
|
40
92
|
constructor(transport) {
|
|
41
|
-
this
|
|
93
|
+
this.transport = transport;
|
|
42
94
|
}
|
|
43
|
-
/** Shares a port of a
|
|
95
|
+
/** Shares a port of a machine at an HTTPS address and returns its url and, for a private one, a token; or changes its visibility and sites when it is shared. Asked again, the same preview. */
|
|
44
96
|
async create(id, input, options) {
|
|
45
|
-
return new Preview(this, await this
|
|
97
|
+
return new Preview(this, await this.transport.request("POST", `/v2/sandboxes/${encodeURIComponent(id)}/previews`, { body: input, options }));
|
|
46
98
|
}
|
|
47
|
-
/** Lists a
|
|
99
|
+
/** Lists a machine's previews, lowest port first. */
|
|
48
100
|
list(query, options) {
|
|
49
|
-
return new Paginated((cursor) => this
|
|
101
|
+
return new Paginated((cursor) => this.transport.request("GET", `/v2/previews`, { query: { ...query, cursor }, options, idempotent: true }));
|
|
50
102
|
}
|
|
51
103
|
/** Returns a preview; `sign` returns one with a token. */
|
|
52
|
-
async get(name, options) {
|
|
53
|
-
return new Preview(this, await this
|
|
104
|
+
async get(name, query = {}, options) {
|
|
105
|
+
return new Preview(this, await this.transport.request("GET", `/v2/previews/${encodeURIComponent(name)}`, { query: { ...query }, options, idempotent: true }));
|
|
54
106
|
}
|
|
55
107
|
/** Returns a private preview with a new token; tokens signed before keep their own expiry. */
|
|
56
108
|
sign(name, query = {}, options) {
|
|
57
|
-
return this
|
|
109
|
+
return this.transport.request("POST", `/v2/previews/${encodeURIComponent(name)}:sign`, { query: { ...query }, options });
|
|
58
110
|
}
|
|
59
111
|
/** Refuses every token signed for a preview so far, and returns a new one. */
|
|
60
112
|
rotate(name, options) {
|
|
61
|
-
return this
|
|
113
|
+
return this.transport.request("POST", `/v2/previews/${encodeURIComponent(name)}:rotate`, { options });
|
|
62
114
|
}
|
|
63
115
|
/** Stops sharing a port. */
|
|
64
116
|
delete(name, options) {
|
|
65
|
-
return this
|
|
117
|
+
return this.transport.request("DELETE", `/v2/previews/${encodeURIComponent(name)}`, { options });
|
|
66
118
|
}
|
|
67
119
|
}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import type { RequestOptions, Transport } from "./runtime.js";
|
|
2
2
|
import { Paginated } from "./runtime.js";
|
|
3
|
-
/** A project:
|
|
3
|
+
/** A project's own limits: each of its organization's plan limits set lower for it alone, never higher, by the price card's names and in its units. A start in it is held to both. One not set is its organization's. */
|
|
4
|
+
export interface ProjectLimits {
|
|
5
|
+
/** The most vCPUs its machines run at once. At least 0. */
|
|
6
|
+
runningVcpu?: number;
|
|
7
|
+
/** The most memory its machines hold at once, in GiB. At least 0. */
|
|
8
|
+
runningMemoryGib?: number;
|
|
9
|
+
/** The most vCPUs one of its machines has. At least 0. */
|
|
10
|
+
machineVcpu?: number;
|
|
11
|
+
/** The most memory one of its machines has, in GiB. At least 0. */
|
|
12
|
+
machineMemoryGib?: number;
|
|
13
|
+
/** The most machines it starts a second. At least 0. */
|
|
14
|
+
newMachinesPerSecond?: number;
|
|
15
|
+
}
|
|
16
|
+
/** A project: where machines, storage, addresses and keys sit. */
|
|
4
17
|
export interface Project {
|
|
5
18
|
/** Its ID. */
|
|
6
19
|
id: string;
|
|
@@ -16,11 +29,20 @@ export interface Project {
|
|
|
16
29
|
state: "active" | "deleted" | (string & {});
|
|
17
30
|
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
18
31
|
deletedAt?: string;
|
|
32
|
+
/** Its own limits: those of its organization's plan limits set lower for it. One not set is its organization's. */
|
|
33
|
+
limits: ProjectLimits;
|
|
19
34
|
}
|
|
20
35
|
/** A new project. */
|
|
21
36
|
export interface ProjectCreate {
|
|
22
37
|
/** Its name, unique in the organization. At least 1 character. At most 64 characters. */
|
|
23
38
|
name: string;
|
|
39
|
+
/** Its own limits ([`ProjectLimits`]); none, its organization's. */
|
|
40
|
+
limits?: ProjectLimits;
|
|
41
|
+
}
|
|
42
|
+
/** A project's own limits, set. */
|
|
43
|
+
export interface ProjectLimitsSet {
|
|
44
|
+
/** Its limits, the whole set: each one given is set, each one left out is its organization's again. */
|
|
45
|
+
limits: ProjectLimits;
|
|
24
46
|
}
|
|
25
47
|
/** A new name; everything else stays as it is. */
|
|
26
48
|
export interface Rename {
|
|
@@ -32,16 +54,18 @@ export type ProjectListQuery = {
|
|
|
32
54
|
/** The most items the page holds. At least 1. At most 200. Default: 50. */
|
|
33
55
|
limit?: number;
|
|
34
56
|
};
|
|
35
|
-
/** A project: where
|
|
57
|
+
/** A project: where machines, storage, addresses and keys sit, each in one. Every organization has a default project, where a call that names none acts. */
|
|
36
58
|
export declare class Projects {
|
|
37
|
-
|
|
59
|
+
readonly transport: Transport;
|
|
38
60
|
constructor(transport: Transport);
|
|
39
61
|
/** Lists the organization's projects, the default first, then by name. */
|
|
40
|
-
list(query?: ProjectListQuery, options?: RequestOptions): Paginated<Project>;
|
|
41
|
-
/** Creates a project. A name another project has returns 409
|
|
62
|
+
list(query?: ProjectListQuery & RequestOptions, options?: RequestOptions): Paginated<Project>;
|
|
63
|
+
/** Creates a project, with its own limits when given. A name another project has returns 409; a limit above its organization's returns 400 `limit_above_org`. Asked again with the same Idempotency-Key, it returns the same one. */
|
|
42
64
|
create(input: ProjectCreate, options?: RequestOptions): Promise<Project>;
|
|
65
|
+
/** Sets a project's own limits: each of its organization's plan limits set lower for it alone, by the price card's names. The whole set: a limit left out is its organization's again. One above its organization's returns 400 `limit_above_org`, naming the limit and both figures. Each start in the project is held to its limits and its organization's. */
|
|
66
|
+
limits(id: string, input: ProjectLimitsSet, options?: RequestOptions): Promise<Project>;
|
|
43
67
|
/** Renames a project; what is in it stays as it is. A name another project has returns 409. */
|
|
44
68
|
update(id: string, input: Rename, options?: RequestOptions): Promise<Project>;
|
|
45
|
-
/** Deletes a project and frees its name, with the grants, keys and invitations held to it. The caller needs `grants:delete` as well, as the grants go with it. The default project, or one that still holds a
|
|
69
|
+
/** Deletes a project and frees its name, with the grants, keys and invitations held to it. The caller needs `grants:delete` as well, as the grants go with it. The default project, or one that still holds a machine, storage or an address, returns 409. Deleted again, it returns 404. */
|
|
46
70
|
delete(id: string, options?: RequestOptions): Promise<Project>;
|
|
47
71
|
}
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
// Generated by spec-gen from engines/front/crates/spec. Do not edit:
|
|
2
2
|
// change the spec and run `cargo run -p runtime-front-spec-gen -- write`.
|
|
3
3
|
import { Paginated } from "./runtime.js";
|
|
4
|
-
/** A project: where
|
|
4
|
+
/** A project: where machines, storage, addresses and keys sit, each in one. Every organization has a default project, where a call that names none acts. */
|
|
5
5
|
export class Projects {
|
|
6
|
-
|
|
6
|
+
transport;
|
|
7
7
|
constructor(transport) {
|
|
8
|
-
this
|
|
8
|
+
this.transport = transport;
|
|
9
9
|
}
|
|
10
10
|
/** Lists the organization's projects, the default first, then by name. */
|
|
11
11
|
list(query = {}, options) {
|
|
12
|
-
return new Paginated((cursor) => this
|
|
12
|
+
return new Paginated((cursor) => this.transport.request("GET", `/v2/projects`, { query: { ...query, cursor }, options, idempotent: true }));
|
|
13
13
|
}
|
|
14
|
-
/** Creates a project. A name another project has returns 409
|
|
14
|
+
/** Creates a project, with its own limits when given. A name another project has returns 409; a limit above its organization's returns 400 `limit_above_org`. Asked again with the same Idempotency-Key, it returns the same one. */
|
|
15
15
|
create(input, options) {
|
|
16
|
-
return this
|
|
16
|
+
return this.transport.request("POST", `/v2/projects`, { body: input, options, idempotent: true });
|
|
17
|
+
}
|
|
18
|
+
/** Sets a project's own limits: each of its organization's plan limits set lower for it alone, by the price card's names. The whole set: a limit left out is its organization's again. One above its organization's returns 400 `limit_above_org`, naming the limit and both figures. Each start in the project is held to its limits and its organization's. */
|
|
19
|
+
limits(id, input, options) {
|
|
20
|
+
return this.transport.request("POST", `/v2/projects/${encodeURIComponent(id)}:limits`, { body: input, options, idempotent: true });
|
|
17
21
|
}
|
|
18
22
|
/** Renames a project; what is in it stays as it is. A name another project has returns 409. */
|
|
19
23
|
update(id, input, options) {
|
|
20
|
-
return this
|
|
24
|
+
return this.transport.request("POST", `/v2/projects/${encodeURIComponent(id)}:update`, { body: input, options, idempotent: true });
|
|
21
25
|
}
|
|
22
|
-
/** Deletes a project and frees its name, with the grants, keys and invitations held to it. The caller needs `grants:delete` as well, as the grants go with it. The default project, or one that still holds a
|
|
26
|
+
/** Deletes a project and frees its name, with the grants, keys and invitations held to it. The caller needs `grants:delete` as well, as the grants go with it. The default project, or one that still holds a machine, storage or an address, returns 409. Deleted again, it returns 404. */
|
|
23
27
|
delete(id, options) {
|
|
24
|
-
return this
|
|
28
|
+
return this.transport.request("DELETE", `/v2/projects/${encodeURIComponent(id)}`, { options, idempotent: true });
|
|
25
29
|
}
|
|
26
30
|
}
|
|
@@ -18,6 +18,13 @@ export interface Role {
|
|
|
18
18
|
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
19
19
|
deletedAt?: string;
|
|
20
20
|
}
|
|
21
|
+
/** A change to a role's actions: the actions to add and the actions to remove, in one step. Each is `product:action`, `product:*` or `*`. */
|
|
22
|
+
export interface RoleActionsChange {
|
|
23
|
+
/** The actions to add. One the role already holds as written is left as it is. At most 100 items. */
|
|
24
|
+
add?: string[];
|
|
25
|
+
/** The actions to remove, each as the role holds it. One the role does not hold is ignored. At most 100 items. */
|
|
26
|
+
remove?: string[];
|
|
27
|
+
}
|
|
21
28
|
/** What list takes in its query. */
|
|
22
29
|
export type RoleListQuery = {
|
|
23
30
|
/** The most items the page holds. At least 1. At most 200. Default: 50. */
|
|
@@ -25,10 +32,12 @@ export type RoleListQuery = {
|
|
|
25
32
|
};
|
|
26
33
|
/** One of the organization's own roles: the actions a grant of it allows. The built-in roles (owner, admin, developer, viewer, billing) are not listed here. */
|
|
27
34
|
export declare class Roles {
|
|
28
|
-
|
|
35
|
+
readonly transport: Transport;
|
|
29
36
|
constructor(transport: Transport);
|
|
30
37
|
/** Lists the organization's own roles, by name. */
|
|
31
|
-
list(query?: RoleListQuery, options?: RequestOptions): Paginated<Role>;
|
|
38
|
+
list(query?: RoleListQuery & RequestOptions, options?: RequestOptions): Paginated<Role>;
|
|
39
|
+
/** Adds actions to a role and removes actions from it, in place, and returns the role. Every key and grant that gives the role has the new actions from its next call; no key's secret changes. Only an owner or an admin may change a role's actions, and only to add actions the caller may perform itself across the whole organization: any other caller or action returns 403. An action no call has returns 400. A role Runtime manages (its name starts with `runtime.`) returns 409, as does a removal from a role that a deny grant gives (a deny is lifted only by deleting that grant; an addition is allowed), a removal that would leave the role with no actions, or one that removes an action the role still holds through a wildcard such as `images:*`. Adding an action the role already holds, or removing one it does not hold, changes nothing, so the call is safe to retry. Each change is one audit log entry, `roles:actions`, whose reason lists the actions added and removed. */
|
|
40
|
+
actions(id: string, input?: RoleActionsChange, options?: RequestOptions): Promise<Role>;
|
|
32
41
|
/** Renames a role; its actions and its grants stay as they are. A built-in role's name, or another role's, returns 409. */
|
|
33
42
|
update(id: string, input: Rename, options?: RequestOptions): Promise<Role>;
|
|
34
43
|
/** Deletes a role and frees its name, with the grants and invitations that give it. The caller needs `grants:delete` as well, as the grants go with it. A role that a deny grant gives returns 409: a deny is lifted only by deleting that grant. Deleted again, it returns 404. */
|
package/dist/generated/roles.js
CHANGED
|
@@ -3,20 +3,24 @@
|
|
|
3
3
|
import { Paginated } from "./runtime.js";
|
|
4
4
|
/** One of the organization's own roles: the actions a grant of it allows. The built-in roles (owner, admin, developer, viewer, billing) are not listed here. */
|
|
5
5
|
export class Roles {
|
|
6
|
-
|
|
6
|
+
transport;
|
|
7
7
|
constructor(transport) {
|
|
8
|
-
this
|
|
8
|
+
this.transport = transport;
|
|
9
9
|
}
|
|
10
10
|
/** Lists the organization's own roles, by name. */
|
|
11
11
|
list(query = {}, options) {
|
|
12
|
-
return new Paginated((cursor) => this
|
|
12
|
+
return new Paginated((cursor) => this.transport.request("GET", `/v2/roles`, { query: { ...query, cursor }, options, idempotent: true }));
|
|
13
|
+
}
|
|
14
|
+
/** Adds actions to a role and removes actions from it, in place, and returns the role. Every key and grant that gives the role has the new actions from its next call; no key's secret changes. Only an owner or an admin may change a role's actions, and only to add actions the caller may perform itself across the whole organization: any other caller or action returns 403. An action no call has returns 400. A role Runtime manages (its name starts with `runtime.`) returns 409, as does a removal from a role that a deny grant gives (a deny is lifted only by deleting that grant; an addition is allowed), a removal that would leave the role with no actions, or one that removes an action the role still holds through a wildcard such as `images:*`. Adding an action the role already holds, or removing one it does not hold, changes nothing, so the call is safe to retry. Each change is one audit log entry, `roles:actions`, whose reason lists the actions added and removed. */
|
|
15
|
+
actions(id, input = {}, options) {
|
|
16
|
+
return this.transport.request("POST", `/v2/roles/${encodeURIComponent(id)}:actions`, { body: input, options, idempotent: true });
|
|
13
17
|
}
|
|
14
18
|
/** Renames a role; its actions and its grants stay as they are. A built-in role's name, or another role's, returns 409. */
|
|
15
19
|
update(id, input, options) {
|
|
16
|
-
return this
|
|
20
|
+
return this.transport.request("POST", `/v2/roles/${encodeURIComponent(id)}:update`, { body: input, options, idempotent: true });
|
|
17
21
|
}
|
|
18
22
|
/** Deletes a role and frees its name, with the grants and invitations that give it. The caller needs `grants:delete` as well, as the grants go with it. A role that a deny grant gives returns 409: a deny is lifted only by deleting that grant. Deleted again, it returns 404. */
|
|
19
23
|
delete(id, options) {
|
|
20
|
-
return this
|
|
24
|
+
return this.transport.request("DELETE", `/v2/roles/${encodeURIComponent(id)}`, { options, idempotent: true });
|
|
21
25
|
}
|
|
22
26
|
}
|