@leavepulse/control-sdk 0.3.31

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 (46) hide show
  1. package/README.md +2 -0
  2. package/auth-types.ts +5296 -0
  3. package/client.ts +320 -0
  4. package/index.ts +110 -0
  5. package/models.ts +232 -0
  6. package/package.json +28 -0
  7. package/procedures.ts +451 -0
  8. package/resources/ControlAgentRelease.ts +40 -0
  9. package/resources/ControlAlert.ts +39 -0
  10. package/resources/ControlCfAccount.ts +82 -0
  11. package/resources/ControlDcimAcceptance.ts +126 -0
  12. package/resources/ControlDcimCable.ts +70 -0
  13. package/resources/ControlDcimComponent.ts +62 -0
  14. package/resources/ControlDcimDevice.ts +71 -0
  15. package/resources/ControlDcimFeed.ts +61 -0
  16. package/resources/ControlDcimLocation.ts +55 -0
  17. package/resources/ControlDcimOutlet.ts +61 -0
  18. package/resources/ControlDcimPdu.ts +58 -0
  19. package/resources/ControlDcimPort.ts +61 -0
  20. package/resources/ControlDcimPowerLink.ts +34 -0
  21. package/resources/ControlDcimRack.ts +61 -0
  22. package/resources/ControlEdge.ts +43 -0
  23. package/resources/ControlEnrollToken.ts +45 -0
  24. package/resources/ControlEnvGroup.ts +60 -0
  25. package/resources/ControlHost.ts +184 -0
  26. package/resources/ControlNode.ts +48 -0
  27. package/resources/ControlProject.ts +36 -0
  28. package/resources/ControlRule.ts +56 -0
  29. package/resources/ControlSchedule.ts +56 -0
  30. package/resources/ControlService.ts +101 -0
  31. package/runtime/cache-policy.ts +371 -0
  32. package/runtime/cache.ts +129 -0
  33. package/runtime/credentials.ts +139 -0
  34. package/runtime/device.ts +199 -0
  35. package/runtime/errors.ts +225 -0
  36. package/runtime/etag-store.ts +252 -0
  37. package/runtime/json.ts +25 -0
  38. package/runtime/oauth2.ts +150 -0
  39. package/runtime/page.ts +81 -0
  40. package/runtime/realtime-client.ts +339 -0
  41. package/runtime/realtime.ts +257 -0
  42. package/runtime/realtime_pb/leavepulse/realtime/v1/ws_pb.ts +464 -0
  43. package/runtime/resource.ts +84 -0
  44. package/runtime/snowflake.ts +7 -0
  45. package/runtime/transport.ts +404 -0
  46. package/types.ts +7279 -0
@@ -0,0 +1,61 @@
1
+ // Generated from the LeavePulse contract. Do not edit.
2
+ import { Resource } from "../runtime/resource";
3
+ import { fetchCachedOrThrow } from "../runtime/etag-store";
4
+ import type * as models from "../models";
5
+ import type { ClientContext } from "../client";
6
+
7
+ type Data = { id: string | number } & Record<string, unknown>;
8
+
9
+ export class ControlDcimRack extends Resource<Data> {
10
+ constructor(
11
+ data: Data,
12
+ private readonly ctx: ClientContext,
13
+ ) {
14
+ super(data);
15
+ }
16
+
17
+ /** control.dcim.racks.list */
18
+ async controlDcimRacksList(params?: {
19
+ location?: string;
20
+ }): Promise<models.RackListResponse> {
21
+ return fetchCachedOrThrow<models.RackListResponse>(
22
+ this.ctx.transport,
23
+ this.ctx.etagStore,
24
+ {
25
+ method: "GET",
26
+ path: `/v1/control/dcim/racks`,
27
+ query: { location: params?.location },
28
+ },
29
+ );
30
+ }
31
+
32
+ /** control.dcim.racks.create */
33
+ async dcimRacksCreate(
34
+ body: models.CreateRackRequest,
35
+ ): Promise<models.RackDTO> {
36
+ return this.ctx.transport.request<models.RackDTO>({
37
+ method: "POST",
38
+ path: `/v1/control/dcim/racks`,
39
+ body,
40
+ });
41
+ }
42
+
43
+ /** control.dcim.racks.delete */
44
+ async dcimRacksDelete(): Promise<models.DeleteResultDTO> {
45
+ return this.ctx.transport.request<models.DeleteResultDTO>({
46
+ method: "DELETE",
47
+ path: `/v1/control/dcim/racks/${this.id}`,
48
+ });
49
+ }
50
+
51
+ /** control.dcim.racks.update */
52
+ async dcimRacksUpdate(
53
+ body: models.UpdateRackRequest,
54
+ ): Promise<models.RackDTO> {
55
+ return this.ctx.transport.request<models.RackDTO>({
56
+ method: "PATCH",
57
+ path: `/v1/control/dcim/racks/${this.id}`,
58
+ body,
59
+ });
60
+ }
61
+ }
@@ -0,0 +1,43 @@
1
+ // Generated from the LeavePulse contract. Do not edit.
2
+ import { Resource } from "../runtime/resource";
3
+ import type * as models from "../models";
4
+ import type { ClientContext } from "../client";
5
+
6
+ type Data = { id: string | number } & Record<string, unknown>;
7
+
8
+ export class ControlEdge extends Resource<Data> {
9
+ constructor(
10
+ data: Data,
11
+ private readonly ctx: ClientContext,
12
+ ) {
13
+ super(data);
14
+ }
15
+
16
+ /** control.graph.edges.upsert */
17
+ async graphEdgesUpsert(
18
+ body: models.UpsertEdgeRequest,
19
+ ): Promise<models.EdgeDTO> {
20
+ return this.ctx.transport.request<models.EdgeDTO>({
21
+ method: "POST",
22
+ path: `/v1/control/graph/edges`,
23
+ body,
24
+ });
25
+ }
26
+
27
+ /** control.graph.edges.delete */
28
+ async graphEdgesDelete(): Promise<this> {
29
+ await this.ctx.transport.request({
30
+ method: "DELETE",
31
+ path: `/v1/control/graph/edges/${this.id}`,
32
+ });
33
+ return this;
34
+ }
35
+
36
+ /** control.graph.edges.verify_egress */
37
+ async graphEdgesVerifyEgress(): Promise<models.TunnelEgressVerifyDTO> {
38
+ return this.ctx.transport.request<models.TunnelEgressVerifyDTO>({
39
+ method: "POST",
40
+ path: `/v1/control/graph/edges/${this.id}/verify-egress`,
41
+ });
42
+ }
43
+ }
@@ -0,0 +1,45 @@
1
+ // Generated from the LeavePulse contract. Do not edit.
2
+ import { Resource } from "../runtime/resource";
3
+ import { fetchCachedOrThrow } from "../runtime/etag-store";
4
+ import type * as models from "../models";
5
+ import type { ClientContext } from "../client";
6
+
7
+ type Data = { id: string | number } & Record<string, unknown>;
8
+
9
+ export class ControlEnrollToken extends Resource<Data> {
10
+ constructor(
11
+ data: Data,
12
+ private readonly ctx: ClientContext,
13
+ ) {
14
+ super(data);
15
+ }
16
+
17
+ /** control.enroll_tokens.list */
18
+ async controlEnrollTokensList(): Promise<models.EnrollTokenListResponse> {
19
+ return fetchCachedOrThrow<models.EnrollTokenListResponse>(
20
+ this.ctx.transport,
21
+ this.ctx.etagStore,
22
+ { method: "GET", path: `/v1/control/enroll-tokens` },
23
+ );
24
+ }
25
+
26
+ /** control.enroll_tokens.create */
27
+ async enrollTokensCreate(
28
+ body: models.CreateEnrollTokenRequest,
29
+ ): Promise<models.CreateEnrollTokenResponse> {
30
+ return this.ctx.transport.request<models.CreateEnrollTokenResponse>({
31
+ method: "POST",
32
+ path: `/v1/control/enroll-tokens`,
33
+ body,
34
+ });
35
+ }
36
+
37
+ /** control.enroll_tokens.revoke */
38
+ async enrollTokensRevoke(): Promise<this> {
39
+ await this.ctx.transport.request({
40
+ method: "DELETE",
41
+ path: `/v1/control/enroll-tokens/${this.id}`,
42
+ });
43
+ return this;
44
+ }
45
+ }
@@ -0,0 +1,60 @@
1
+ // Generated from the LeavePulse contract. Do not edit.
2
+ import { Resource } from "../runtime/resource";
3
+ import { fetchCachedOrThrow } from "../runtime/etag-store";
4
+ import type * as models from "../models";
5
+ import type { ClientContext } from "../client";
6
+
7
+ type Data = { id: string | number } & Record<string, unknown>;
8
+
9
+ export class ControlEnvGroup extends Resource<Data> {
10
+ constructor(
11
+ data: Data,
12
+ private readonly ctx: ClientContext,
13
+ ) {
14
+ super(data);
15
+ }
16
+
17
+ /** control.env_groups.list */
18
+ async controlEnvGroupsList(): Promise<models.EnvGroupListResponse> {
19
+ return fetchCachedOrThrow<models.EnvGroupListResponse>(
20
+ this.ctx.transport,
21
+ this.ctx.etagStore,
22
+ { method: "GET", path: `/v1/control/env-groups` },
23
+ );
24
+ }
25
+
26
+ /** control.env_groups.get */
27
+ async controlEnvGroupsGet(params?: {
28
+ reveal?: boolean;
29
+ }): Promise<models.EnvGroupDTO> {
30
+ return fetchCachedOrThrow<models.EnvGroupDTO>(
31
+ this.ctx.transport,
32
+ this.ctx.etagStore,
33
+ {
34
+ method: "GET",
35
+ path: `/v1/control/env-groups/${this.id}`,
36
+ query: { reveal: params?.reveal },
37
+ },
38
+ );
39
+ }
40
+
41
+ /** control.env_groups.delete */
42
+ async envGroupsDelete(): Promise<this> {
43
+ await this.ctx.transport.request({
44
+ method: "DELETE",
45
+ path: `/v1/control/env-groups/${this.id}`,
46
+ });
47
+ return this;
48
+ }
49
+
50
+ /** control.env_groups.upsert */
51
+ async envGroupsUpsert(
52
+ body: models.UpsertEnvGroupRequest,
53
+ ): Promise<models.EnvGroupDTO> {
54
+ return this.ctx.transport.request<models.EnvGroupDTO>({
55
+ method: "PUT",
56
+ path: `/v1/control/env-groups/${this.id}`,
57
+ body,
58
+ });
59
+ }
60
+ }
@@ -0,0 +1,184 @@
1
+ // Generated from the LeavePulse contract. Do not edit.
2
+ import { Resource } from "../runtime/resource";
3
+ import { TopicSubscription } from "../runtime/realtime";
4
+ import { fetchCachedOrThrow } from "../runtime/etag-store";
5
+ import type * as models from "../models";
6
+ import type { ClientContext } from "../client";
7
+
8
+ type Data = { id: string | number } & Record<string, unknown> & {
9
+ container?: string | number;
10
+ };
11
+
12
+ export class ControlHost extends Resource<Data> {
13
+ constructor(
14
+ data: Data,
15
+ private readonly ctx: ClientContext,
16
+ ) {
17
+ super(data);
18
+ }
19
+
20
+ /** control.hosts.list */
21
+ async controlHostsList(params?: {
22
+ tag?: string;
23
+ }): Promise<models.HostListResponse> {
24
+ return fetchCachedOrThrow<models.HostListResponse>(
25
+ this.ctx.transport,
26
+ this.ctx.etagStore,
27
+ { method: "GET", path: `/v1/control/hosts`, query: { tag: params?.tag } },
28
+ );
29
+ }
30
+
31
+ /** control.hosts.get */
32
+ async controlHostsGet(): Promise<models.HostDTO> {
33
+ return fetchCachedOrThrow<models.HostDTO>(
34
+ this.ctx.transport,
35
+ this.ctx.etagStore,
36
+ { method: "GET", path: `/v1/control/hosts/${this.id}` },
37
+ );
38
+ }
39
+
40
+ /** control.hosts.container_inspect */
41
+ async controlHostsContainerInspect(
42
+ container: string,
43
+ ): Promise<models.InspectResponse> {
44
+ return fetchCachedOrThrow<models.InspectResponse>(
45
+ this.ctx.transport,
46
+ this.ctx.etagStore,
47
+ {
48
+ method: "GET",
49
+ path: `/v1/control/hosts/${this.id}/containers/${container}/inspect`,
50
+ },
51
+ );
52
+ }
53
+
54
+ /** control.hosts.container_logs */
55
+ async controlHostsContainerLogs(
56
+ container: string,
57
+ params?: { lines?: number; before?: number },
58
+ ): Promise<models.TailLogsResponse> {
59
+ return fetchCachedOrThrow<models.TailLogsResponse>(
60
+ this.ctx.transport,
61
+ this.ctx.etagStore,
62
+ {
63
+ method: "GET",
64
+ path: `/v1/control/hosts/${this.id}/containers/${container}/logs`,
65
+ query: { lines: params?.lines, before: params?.before },
66
+ },
67
+ );
68
+ }
69
+
70
+ /** control.hosts.docker_df */
71
+ async controlHostsDockerDf(): Promise<models.DockerDfResponse> {
72
+ return fetchCachedOrThrow<models.DockerDfResponse>(
73
+ this.ctx.transport,
74
+ this.ctx.etagStore,
75
+ { method: "GET", path: `/v1/control/hosts/${this.id}/docker/df` },
76
+ );
77
+ }
78
+
79
+ /** control.hosts.firewall_rules */
80
+ async controlHostsFirewallRules(): Promise<models.FirewallRulesResponse> {
81
+ return fetchCachedOrThrow<models.FirewallRulesResponse>(
82
+ this.ctx.transport,
83
+ this.ctx.etagStore,
84
+ { method: "GET", path: `/v1/control/hosts/${this.id}/firewall/rules` },
85
+ );
86
+ }
87
+
88
+ /** control.hosts.rename */
89
+ async hostsRename(body: models.RenameHostRequest): Promise<models.HostDTO> {
90
+ return this.ctx.transport.request<models.HostDTO>({
91
+ method: "PATCH",
92
+ path: `/v1/control/hosts/${this.id}`,
93
+ body,
94
+ });
95
+ }
96
+
97
+ /** control.hosts.container_action */
98
+ async hostsContainerAction(
99
+ container: string,
100
+ body: models.ContainerActionRequest,
101
+ ): Promise<models.ContainerActionResponse> {
102
+ return this.ctx.transport.request<models.ContainerActionResponse>({
103
+ method: "POST",
104
+ path: `/v1/control/hosts/${this.id}/containers/${container}/action`,
105
+ body,
106
+ });
107
+ }
108
+
109
+ /** control.hosts.decommission */
110
+ async hostsDecommission(
111
+ body: models.DecommissionRequest,
112
+ ): Promise<models.DecommissionResponse> {
113
+ return this.ctx.transport.request<models.DecommissionResponse>({
114
+ method: "POST",
115
+ path: `/v1/control/hosts/${this.id}/decommission`,
116
+ body,
117
+ });
118
+ }
119
+
120
+ /** control.hosts.docker_prune */
121
+ async hostsDockerPrune(
122
+ body: models.DockerPruneRequest,
123
+ ): Promise<models.DockerPruneResponse> {
124
+ return this.ctx.transport.request<models.DockerPruneResponse>({
125
+ method: "POST",
126
+ path: `/v1/control/hosts/${this.id}/docker/prune`,
127
+ body,
128
+ });
129
+ }
130
+
131
+ /** control.hosts.install_exporter */
132
+ async hostsInstallExporter(
133
+ body: models.InstallExporterRequest,
134
+ ): Promise<models.InstallExporterResponse> {
135
+ return this.ctx.transport.request<models.InstallExporterResponse>({
136
+ method: "POST",
137
+ path: `/v1/control/hosts/${this.id}/exporters`,
138
+ body,
139
+ });
140
+ }
141
+
142
+ /** control.hosts.firewall_block */
143
+ async hostsFirewallBlock(
144
+ body: models.FirewallBlockRequest,
145
+ ): Promise<models.FirewallActionResponse> {
146
+ return this.ctx.transport.request<models.FirewallActionResponse>({
147
+ method: "POST",
148
+ path: `/v1/control/hosts/${this.id}/firewall/block`,
149
+ body,
150
+ });
151
+ }
152
+
153
+ /** control.hosts.firewall_unblock */
154
+ async hostsFirewallUnblock(
155
+ body: models.FirewallBlockRequest,
156
+ ): Promise<models.FirewallActionResponse> {
157
+ return this.ctx.transport.request<models.FirewallActionResponse>({
158
+ method: "POST",
159
+ path: `/v1/control/hosts/${this.id}/firewall/unblock`,
160
+ body,
161
+ });
162
+ }
163
+
164
+ /** Subscribe to `control.logs.{host_id}.{container}` (private realtime). */
165
+ onLogs(): TopicSubscription {
166
+ return new TopicSubscription(
167
+ this.ctx.realtime,
168
+ `control.logs.${this.id}.${this.id}`,
169
+ );
170
+ }
171
+
172
+ /** Subscribe to `control.metrics.{host_id}` (private realtime). */
173
+ onMetrics(): TopicSubscription {
174
+ return new TopicSubscription(
175
+ this.ctx.realtime,
176
+ `control.metrics.${this.id}`,
177
+ );
178
+ }
179
+
180
+ /** Subscribe to `control.hosts` (private realtime). */
181
+ onHosts(): TopicSubscription {
182
+ return new TopicSubscription(this.ctx.realtime, "control.hosts");
183
+ }
184
+ }
@@ -0,0 +1,48 @@
1
+ // Generated from the LeavePulse contract. Do not edit.
2
+ import { Resource } from "../runtime/resource";
3
+ import type * as models from "../models";
4
+ import type { ClientContext } from "../client";
5
+
6
+ type Data = { id: string | number } & Record<string, unknown>;
7
+
8
+ export class ControlNode extends Resource<Data> {
9
+ constructor(
10
+ data: Data,
11
+ private readonly ctx: ClientContext,
12
+ ) {
13
+ super(data);
14
+ }
15
+
16
+ /** control.graph.nodes.role */
17
+ async graphNodesRole(
18
+ hostId: string,
19
+ body: models.SetRoleRequest,
20
+ ): Promise<models.NodeDTO> {
21
+ return this.ctx.transport.request<models.NodeDTO>({
22
+ method: "POST",
23
+ path: `/v1/control/graph/hosts/${hostId}/role`,
24
+ body,
25
+ });
26
+ }
27
+
28
+ /** control.graph.nodes.upsert */
29
+ async graphNodesUpsert(
30
+ body: models.UpsertNodeRequest,
31
+ ): Promise<models.NodeDTO> {
32
+ return this.ctx.transport.request<models.NodeDTO>({
33
+ method: "POST",
34
+ path: `/v1/control/graph/nodes`,
35
+ body,
36
+ });
37
+ }
38
+
39
+ /** control.graph.nodes.position */
40
+ async graphNodesPosition(body: models.SetPositionRequest): Promise<this> {
41
+ await this.ctx.transport.request({
42
+ method: "POST",
43
+ path: `/v1/control/graph/nodes/${this.id}/position`,
44
+ body,
45
+ });
46
+ return this;
47
+ }
48
+ }
@@ -0,0 +1,36 @@
1
+ // Generated from the LeavePulse contract. Do not edit.
2
+ import { Resource } from "../runtime/resource";
3
+ import { fetchCachedOrThrow } from "../runtime/etag-store";
4
+ import type * as models from "../models";
5
+ import type { ClientContext } from "../client";
6
+
7
+ type Data = { id: string | number } & Record<string, unknown>;
8
+
9
+ export class ControlProject extends Resource<Data> {
10
+ constructor(
11
+ data: Data,
12
+ private readonly ctx: ClientContext,
13
+ ) {
14
+ super(data);
15
+ }
16
+
17
+ /** control.graph.projects.list */
18
+ async controlGraphProjectsList(): Promise<models.ProjectListResponse> {
19
+ return fetchCachedOrThrow<models.ProjectListResponse>(
20
+ this.ctx.transport,
21
+ this.ctx.etagStore,
22
+ { method: "GET", path: `/v1/control/graph/projects` },
23
+ );
24
+ }
25
+
26
+ /** control.graph.projects.upsert */
27
+ async graphProjectsUpsert(
28
+ body: models.UpsertProjectRequest,
29
+ ): Promise<models.ProjectDTO> {
30
+ return this.ctx.transport.request<models.ProjectDTO>({
31
+ method: "POST",
32
+ path: `/v1/control/graph/projects`,
33
+ body,
34
+ });
35
+ }
36
+ }
@@ -0,0 +1,56 @@
1
+ // Generated from the LeavePulse contract. Do not edit.
2
+ import { Resource } from "../runtime/resource";
3
+ import { fetchCachedOrThrow } from "../runtime/etag-store";
4
+ import type * as models from "../models";
5
+ import type { ClientContext } from "../client";
6
+
7
+ type Data = { id: string | number } & Record<string, unknown>;
8
+
9
+ export class ControlRule extends Resource<Data> {
10
+ constructor(
11
+ data: Data,
12
+ private readonly ctx: ClientContext,
13
+ ) {
14
+ super(data);
15
+ }
16
+
17
+ /** control.automation.list_rules */
18
+ async controlAutomationListRules(): Promise<models.RuleListResponse> {
19
+ return fetchCachedOrThrow<models.RuleListResponse>(
20
+ this.ctx.transport,
21
+ this.ctx.etagStore,
22
+ { method: "GET", path: `/v1/control/automation/rules` },
23
+ );
24
+ }
25
+
26
+ /** control.automation.create_rule */
27
+ async automationCreateRule(
28
+ body: models.CreateRuleRequest,
29
+ ): Promise<models.RuleDTO> {
30
+ return this.ctx.transport.request<models.RuleDTO>({
31
+ method: "POST",
32
+ path: `/v1/control/automation/rules`,
33
+ body,
34
+ });
35
+ }
36
+
37
+ /** control.automation.delete_rule */
38
+ async automationDeleteRule(): Promise<this> {
39
+ await this.ctx.transport.request({
40
+ method: "DELETE",
41
+ path: `/v1/control/automation/rules/${this.id}`,
42
+ });
43
+ return this;
44
+ }
45
+
46
+ /** control.automation.toggle_rule */
47
+ async automationToggleRule(
48
+ body: models.ToggleRequest,
49
+ ): Promise<models.RuleDTO> {
50
+ return this.ctx.transport.request<models.RuleDTO>({
51
+ method: "PATCH",
52
+ path: `/v1/control/automation/rules/${this.id}`,
53
+ body,
54
+ });
55
+ }
56
+ }
@@ -0,0 +1,56 @@
1
+ // Generated from the LeavePulse contract. Do not edit.
2
+ import { Resource } from "../runtime/resource";
3
+ import { fetchCachedOrThrow } from "../runtime/etag-store";
4
+ import type * as models from "../models";
5
+ import type { ClientContext } from "../client";
6
+
7
+ type Data = { id: string | number } & Record<string, unknown>;
8
+
9
+ export class ControlSchedule extends Resource<Data> {
10
+ constructor(
11
+ data: Data,
12
+ private readonly ctx: ClientContext,
13
+ ) {
14
+ super(data);
15
+ }
16
+
17
+ /** control.automation.list_schedules */
18
+ async controlAutomationListSchedules(): Promise<models.ScheduleListResponse> {
19
+ return fetchCachedOrThrow<models.ScheduleListResponse>(
20
+ this.ctx.transport,
21
+ this.ctx.etagStore,
22
+ { method: "GET", path: `/v1/control/automation/schedules` },
23
+ );
24
+ }
25
+
26
+ /** control.automation.create_schedule */
27
+ async automationCreateSchedule(
28
+ body: models.CreateScheduleRequest,
29
+ ): Promise<models.ScheduleDTO> {
30
+ return this.ctx.transport.request<models.ScheduleDTO>({
31
+ method: "POST",
32
+ path: `/v1/control/automation/schedules`,
33
+ body,
34
+ });
35
+ }
36
+
37
+ /** control.automation.delete_schedule */
38
+ async automationDeleteSchedule(): Promise<this> {
39
+ await this.ctx.transport.request({
40
+ method: "DELETE",
41
+ path: `/v1/control/automation/schedules/${this.id}`,
42
+ });
43
+ return this;
44
+ }
45
+
46
+ /** control.automation.toggle_schedule */
47
+ async automationToggleSchedule(
48
+ body: models.ToggleRequest,
49
+ ): Promise<models.ScheduleDTO> {
50
+ return this.ctx.transport.request<models.ScheduleDTO>({
51
+ method: "PATCH",
52
+ path: `/v1/control/automation/schedules/${this.id}`,
53
+ body,
54
+ });
55
+ }
56
+ }
@@ -0,0 +1,101 @@
1
+ // Generated from the LeavePulse contract. Do not edit.
2
+ import { Resource } from "../runtime/resource";
3
+ import { fetchCachedOrThrow } from "../runtime/etag-store";
4
+ import type * as models from "../models";
5
+ import type { ClientContext } from "../client";
6
+
7
+ type Data = { id: string | number } & Record<string, unknown>;
8
+
9
+ export class ControlService extends Resource<Data> {
10
+ constructor(
11
+ data: Data,
12
+ private readonly ctx: ClientContext,
13
+ ) {
14
+ super(data);
15
+ }
16
+
17
+ /** control.services.list */
18
+ async controlServicesList(): Promise<models.ServiceListResponse> {
19
+ return fetchCachedOrThrow<models.ServiceListResponse>(
20
+ this.ctx.transport,
21
+ this.ctx.etagStore,
22
+ { method: "GET", path: `/v1/control/services` },
23
+ );
24
+ }
25
+
26
+ /** control.services.get */
27
+ async controlServicesGet(params?: {
28
+ reveal?: boolean;
29
+ }): Promise<models.ServiceDefDTO> {
30
+ return fetchCachedOrThrow<models.ServiceDefDTO>(
31
+ this.ctx.transport,
32
+ this.ctx.etagStore,
33
+ {
34
+ method: "GET",
35
+ path: `/v1/control/services/${this.id}`,
36
+ query: { reveal: params?.reveal },
37
+ },
38
+ );
39
+ }
40
+
41
+ /** control.services.delete */
42
+ async servicesDelete(): Promise<this> {
43
+ await this.ctx.transport.request({
44
+ method: "DELETE",
45
+ path: `/v1/control/services/${this.id}`,
46
+ });
47
+ return this;
48
+ }
49
+
50
+ /** control.services.upsert */
51
+ async servicesUpsert(
52
+ body: models.UpsertServiceRequest,
53
+ ): Promise<models.ServiceDefDTO> {
54
+ return this.ctx.transport.request<models.ServiceDefDTO>({
55
+ method: "PUT",
56
+ path: `/v1/control/services/${this.id}`,
57
+ body,
58
+ });
59
+ }
60
+
61
+ /** control.services.check_ports */
62
+ async servicesCheckPorts(
63
+ body: models.PortCheckRequest,
64
+ ): Promise<models.PortCheckResponse> {
65
+ return this.ctx.transport.request<models.PortCheckResponse>({
66
+ method: "POST",
67
+ path: `/v1/control/services/${this.id}/check-ports`,
68
+ body,
69
+ });
70
+ }
71
+
72
+ /** control.services.deploy */
73
+ async servicesDeploy(
74
+ body: models.DeployRequest,
75
+ ): Promise<models.DeploymentDTO> {
76
+ return this.ctx.transport.request<models.DeploymentDTO>({
77
+ method: "POST",
78
+ path: `/v1/control/services/${this.id}/deploy`,
79
+ body,
80
+ });
81
+ }
82
+
83
+ /** control.services.deployments */
84
+ async servicesDeployments(): Promise<models.DeploymentListResponse> {
85
+ return this.ctx.transport.request<models.DeploymentListResponse>({
86
+ method: "GET",
87
+ path: `/v1/control/services/${this.id}/deployments`,
88
+ });
89
+ }
90
+
91
+ /** control.services.preview_compose */
92
+ async servicesPreviewCompose(
93
+ body: models.ServiceSpec,
94
+ ): Promise<models.ComposePreviewDTO> {
95
+ return this.ctx.transport.request<models.ComposePreviewDTO>({
96
+ method: "POST",
97
+ path: `/v1/control/services/${this.id}/preview-compose`,
98
+ body,
99
+ });
100
+ }
101
+ }