@distilled.cloud/namespacelabs 0.0.0 → 1.0.0-rc.20

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 (216) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +121 -4
  3. package/lib/.lazy.json +1 -0
  4. package/lib/_bundle/lazy.js +4 -0
  5. package/lib/_bundle/sdk.js +2 -0
  6. package/lib/_bundle/sdk.js.map +1 -0
  7. package/lib/credentials.d.ts +55 -0
  8. package/lib/credentials.d.ts.map +1 -0
  9. package/lib/credentials.js +1 -0
  10. package/lib/errors.d.ts +33 -0
  11. package/lib/errors.d.ts.map +1 -0
  12. package/lib/errors.js +1 -0
  13. package/lib/index.d.ts +42 -0
  14. package/lib/index.d.ts.map +1 -0
  15. package/lib/index.js +7 -0
  16. package/lib/index.lazy.js +7 -0
  17. package/lib/index.lazy.js.map +1 -0
  18. package/lib/pagination.d.ts +2 -0
  19. package/lib/pagination.d.ts.map +1 -0
  20. package/lib/pagination.js +1 -0
  21. package/lib/protocol.d.ts +15 -0
  22. package/lib/protocol.d.ts.map +1 -0
  23. package/lib/protocol.js +1 -0
  24. package/lib/retry.d.ts +12 -0
  25. package/lib/retry.d.ts.map +1 -0
  26. package/lib/retry.js +1 -0
  27. package/lib/services/artifacts.d.ts +260 -0
  28. package/lib/services/artifacts.d.ts.map +1 -0
  29. package/lib/services/artifacts.js +2 -0
  30. package/lib/services/artifacts.js.map +1 -0
  31. package/lib/services/audit.d.ts +149 -0
  32. package/lib/services/audit.d.ts.map +1 -0
  33. package/lib/services/audit.js +2 -0
  34. package/lib/services/audit.js.map +1 -0
  35. package/lib/services/bazel.d.ts +173 -0
  36. package/lib/services/bazel.d.ts.map +1 -0
  37. package/lib/services/bazel.js +2 -0
  38. package/lib/services/bazel.js.map +1 -0
  39. package/lib/services/bazel_cache.d.ts +118 -0
  40. package/lib/services/bazel_cache.d.ts.map +1 -0
  41. package/lib/services/bazel_cache.js +2 -0
  42. package/lib/services/bazel_cache.js.map +1 -0
  43. package/lib/services/builder.d.ts +234 -0
  44. package/lib/services/builder.d.ts.map +1 -0
  45. package/lib/services/builder.js +2 -0
  46. package/lib/services/builder.js.map +1 -0
  47. package/lib/services/buildkite_jobs.d.ts +121 -0
  48. package/lib/services/buildkite_jobs.d.ts.map +1 -0
  49. package/lib/services/buildkite_jobs.js +2 -0
  50. package/lib/services/buildkite_jobs.js.map +1 -0
  51. package/lib/services/buildkite_queue.d.ts +178 -0
  52. package/lib/services/buildkite_queue.d.ts.map +1 -0
  53. package/lib/services/buildkite_queue.js +2 -0
  54. package/lib/services/buildkite_queue.js.map +1 -0
  55. package/lib/services/compute.d.ts +1057 -0
  56. package/lib/services/compute.d.ts.map +1 -0
  57. package/lib/services/compute.js +43 -0
  58. package/lib/services/compute.js.map +1 -0
  59. package/lib/services/compute_command.d.ts +112 -0
  60. package/lib/services/compute_command.d.ts.map +1 -0
  61. package/lib/services/compute_command.js +2 -0
  62. package/lib/services/compute_command.js.map +1 -0
  63. package/lib/services/compute_observability.d.ts +157 -0
  64. package/lib/services/compute_observability.d.ts.map +1 -0
  65. package/lib/services/compute_observability.js +2 -0
  66. package/lib/services/compute_observability.js.map +1 -0
  67. package/lib/services/compute_storage.d.ts +371 -0
  68. package/lib/services/compute_storage.d.ts.map +1 -0
  69. package/lib/services/compute_storage.js +33 -0
  70. package/lib/services/compute_storage.js.map +1 -0
  71. package/lib/services/compute_usage.d.ts +275 -0
  72. package/lib/services/compute_usage.d.ts.map +1 -0
  73. package/lib/services/compute_usage.js +2 -0
  74. package/lib/services/compute_usage.js.map +1 -0
  75. package/lib/services/egress.d.ts +183 -0
  76. package/lib/services/egress.d.ts.map +1 -0
  77. package/lib/services/egress.js +2 -0
  78. package/lib/services/egress.js.map +1 -0
  79. package/lib/services/experimental_compute_reservation.d.ts +662 -0
  80. package/lib/services/experimental_compute_reservation.d.ts.map +1 -0
  81. package/lib/services/experimental_compute_reservation.js +23 -0
  82. package/lib/services/experimental_compute_reservation.js.map +1 -0
  83. package/lib/services/experimental_remote_results.d.ts +488 -0
  84. package/lib/services/experimental_remote_results.d.ts.map +1 -0
  85. package/lib/services/experimental_remote_results.js +2 -0
  86. package/lib/services/experimental_remote_results.js.map +1 -0
  87. package/lib/services/github_image.d.ts +154 -0
  88. package/lib/services/github_image.d.ts.map +1 -0
  89. package/lib/services/github_image.js +2 -0
  90. package/lib/services/github_image.js.map +1 -0
  91. package/lib/services/github_jobs.d.ts +175 -0
  92. package/lib/services/github_jobs.d.ts.map +1 -0
  93. package/lib/services/github_jobs.js +2 -0
  94. package/lib/services/github_jobs.js.map +1 -0
  95. package/lib/services/github_profile.d.ts +288 -0
  96. package/lib/services/github_profile.d.ts.map +1 -0
  97. package/lib/services/github_profile.js +2 -0
  98. package/lib/services/github_profile.js.map +1 -0
  99. package/lib/services/gradle_cache.d.ts +117 -0
  100. package/lib/services/gradle_cache.d.ts.map +1 -0
  101. package/lib/services/gradle_cache.js +2 -0
  102. package/lib/services/gradle_cache.js.map +1 -0
  103. package/lib/services/httpcache.d.ts +117 -0
  104. package/lib/services/httpcache.d.ts.map +1 -0
  105. package/lib/services/httpcache.js +2 -0
  106. package/lib/services/httpcache.js.map +1 -0
  107. package/lib/services/iam_tenant.d.ts +373 -0
  108. package/lib/services/iam_tenant.d.ts.map +1 -0
  109. package/lib/services/iam_tenant.js +39 -0
  110. package/lib/services/iam_tenant.js.map +1 -0
  111. package/lib/services/iam_tenant_membership.d.ts +106 -0
  112. package/lib/services/iam_tenant_membership.d.ts.map +1 -0
  113. package/lib/services/iam_tenant_membership.js +2 -0
  114. package/lib/services/iam_tenant_membership.js.map +1 -0
  115. package/lib/services/iam_token.d.ts +249 -0
  116. package/lib/services/iam_token.d.ts.map +1 -0
  117. package/lib/services/iam_token.js +2 -0
  118. package/lib/services/iam_token.js.map +1 -0
  119. package/lib/services/image.d.ts +214 -0
  120. package/lib/services/image.d.ts.map +1 -0
  121. package/lib/services/image.js +2 -0
  122. package/lib/services/image.js.map +1 -0
  123. package/lib/services/index.d.ts +30 -0
  124. package/lib/services/index.d.ts.map +1 -0
  125. package/lib/services/index.js +29 -0
  126. package/lib/services/private_devbox.d.ts +1156 -0
  127. package/lib/services/private_devbox.d.ts.map +1 -0
  128. package/lib/services/private_devbox.js +81 -0
  129. package/lib/services/private_devbox.js.map +1 -0
  130. package/lib/services/private_user_sessions.d.ts +137 -0
  131. package/lib/services/private_user_sessions.d.ts.map +1 -0
  132. package/lib/services/private_user_sessions.js +2 -0
  133. package/lib/services/private_user_sessions.js.map +1 -0
  134. package/lib/services/registry.d.ts +365 -0
  135. package/lib/services/registry.d.ts.map +1 -0
  136. package/lib/services/registry.js +34 -0
  137. package/lib/services/registry.js.map +1 -0
  138. package/lib/services/testing.d.ts +152 -0
  139. package/lib/services/testing.d.ts.map +1 -0
  140. package/lib/services/testing.js +2 -0
  141. package/lib/services/testing.js.map +1 -0
  142. package/lib/services/vault.d.ts +195 -0
  143. package/lib/services/vault.d.ts.map +1 -0
  144. package/lib/services/vault.js +2 -0
  145. package/lib/services/vault.js.map +1 -0
  146. package/lib/services.lazy/artifacts.js +1 -0
  147. package/lib/services.lazy/audit.js +1 -0
  148. package/lib/services.lazy/bazel.js +1 -0
  149. package/lib/services.lazy/bazel_cache.js +1 -0
  150. package/lib/services.lazy/builder.js +1 -0
  151. package/lib/services.lazy/buildkite_jobs.js +1 -0
  152. package/lib/services.lazy/buildkite_queue.js +1 -0
  153. package/lib/services.lazy/compute.js +4 -0
  154. package/lib/services.lazy/compute_command.js +1 -0
  155. package/lib/services.lazy/compute_observability.js +1 -0
  156. package/lib/services.lazy/compute_storage.js +4 -0
  157. package/lib/services.lazy/compute_usage.js +1 -0
  158. package/lib/services.lazy/egress.js +1 -0
  159. package/lib/services.lazy/experimental_compute_reservation.js +4 -0
  160. package/lib/services.lazy/experimental_remote_results.js +1 -0
  161. package/lib/services.lazy/github_image.js +1 -0
  162. package/lib/services.lazy/github_jobs.js +1 -0
  163. package/lib/services.lazy/github_profile.js +1 -0
  164. package/lib/services.lazy/gradle_cache.js +1 -0
  165. package/lib/services.lazy/httpcache.js +1 -0
  166. package/lib/services.lazy/iam_tenant.js +4 -0
  167. package/lib/services.lazy/iam_tenant_membership.js +1 -0
  168. package/lib/services.lazy/iam_token.js +1 -0
  169. package/lib/services.lazy/image.js +1 -0
  170. package/lib/services.lazy/index.js +3 -0
  171. package/lib/services.lazy/private_devbox.js +4 -0
  172. package/lib/services.lazy/private_user_sessions.js +1 -0
  173. package/lib/services.lazy/registry.js +4 -0
  174. package/lib/services.lazy/testing.js +1 -0
  175. package/lib/services.lazy/vault.js +1 -0
  176. package/lib/traits.d.ts +3 -0
  177. package/lib/traits.d.ts.map +1 -0
  178. package/lib/traits.js +1 -0
  179. package/package.json +82 -2
  180. package/src/credentials.ts +164 -0
  181. package/src/errors.ts +47 -0
  182. package/src/index.ts +48 -0
  183. package/src/pagination.ts +1 -0
  184. package/src/protocol.ts +82 -0
  185. package/src/retry.ts +28 -0
  186. package/src/services/artifacts.ts +761 -0
  187. package/src/services/audit.ts +315 -0
  188. package/src/services/bazel.ts +415 -0
  189. package/src/services/bazel_cache.ts +211 -0
  190. package/src/services/builder.ts +568 -0
  191. package/src/services/buildkite_jobs.ts +222 -0
  192. package/src/services/buildkite_queue.ts +445 -0
  193. package/src/services/compute.ts +2794 -0
  194. package/src/services/compute_command.ts +212 -0
  195. package/src/services/compute_observability.ts +428 -0
  196. package/src/services/compute_storage.ts +1159 -0
  197. package/src/services/compute_usage.ts +730 -0
  198. package/src/services/egress.ts +508 -0
  199. package/src/services/experimental_compute_reservation.ts +1488 -0
  200. package/src/services/experimental_remote_results.ts +1157 -0
  201. package/src/services/github_image.ts +293 -0
  202. package/src/services/github_jobs.ts +381 -0
  203. package/src/services/github_profile.ts +721 -0
  204. package/src/services/gradle_cache.ts +263 -0
  205. package/src/services/httpcache.ts +263 -0
  206. package/src/services/iam_tenant.ts +1355 -0
  207. package/src/services/iam_tenant_membership.ts +245 -0
  208. package/src/services/iam_token.ts +780 -0
  209. package/src/services/image.ts +594 -0
  210. package/src/services/index.ts +30 -0
  211. package/src/services/private_devbox.ts +4217 -0
  212. package/src/services/private_user_sessions.ts +402 -0
  213. package/src/services/registry.ts +1234 -0
  214. package/src/services/testing.ts +386 -0
  215. package/src/services/vault.ts +514 -0
  216. package/src/traits.ts +36 -0
@@ -0,0 +1,212 @@
1
+ import * as API from "@distilled.cloud/core/api";
2
+ import * as C from "@distilled.cloud/core/category";
3
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (buf.build/namespace/cloud -> smithy). Do not edit.
4
+ import * as S from "@distilled.cloud/core/schema-lite";
5
+ import * as __L from "@distilled.cloud/core/schema-lite";
6
+ import { UnknownNamespaceLabsError } from "../errors.ts";
7
+ import {
8
+ NamespaceLabsProtocol,
9
+ type NamespaceLabsOpError,
10
+ type NamespaceLabsOpContext,
11
+ } from "../protocol.ts";
12
+ import * as Retry from "../retry.ts";
13
+ import * as T from "../traits.ts";
14
+ // Schema table, filled on first reach (see __S at the end).
15
+ const __s: any[] = [];
16
+
17
+ export type { NamespaceLabsOpError, NamespaceLabsOpContext };
18
+
19
+ /** Span facts shared by every operation (com.distilled.telemetry#service). */
20
+ const TELEMETRY = {
21
+ system: "namespacelabs-api",
22
+ responseHeaders: [
23
+ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
24
+ { header: "request-id", name: "http.response.header.request-id", transform: "list" },
25
+ ],
26
+ prefix: "Namespacelabs",
27
+ service: "CommandService",
28
+ propagate: "w3c",
29
+ } as const;
30
+
31
+ export class AlreadyExists
32
+ extends /*@__PURE__*/ T.applyErrorMatchers(
33
+ /*@__PURE__*/ S.TaggedError<AlreadyExists>()("AlreadyExists", {
34
+ message: S.String,
35
+ body: S.Unknown,
36
+ }).pipe(C.withConflictError),
37
+ [{ status: 409, body: { "/code": "already_exists" } }],
38
+ ) {}
39
+
40
+ export class FailedPrecondition
41
+ extends /*@__PURE__*/ T.applyErrorMatchers(
42
+ /*@__PURE__*/ S.TaggedError<FailedPrecondition>()("FailedPrecondition", {
43
+ message: S.String,
44
+ body: S.Unknown,
45
+ }).pipe(C.withBadRequestError),
46
+ [{ status: 400, body: { "/code": "failed_precondition" } }],
47
+ ) {}
48
+
49
+ export class InvalidArgument
50
+ extends /*@__PURE__*/ T.applyErrorMatchers(
51
+ /*@__PURE__*/ S.TaggedError<InvalidArgument>()("InvalidArgument", {
52
+ message: S.String,
53
+ body: S.Unknown,
54
+ }).pipe(C.withBadRequestError),
55
+ [{ status: 400, body: { "/code": "invalid_argument" } }],
56
+ ) {}
57
+
58
+ export class NotFound
59
+ extends /*@__PURE__*/ T.applyErrorMatchers(
60
+ /*@__PURE__*/ S.TaggedError<NotFound>()("NotFound", {
61
+ message: S.String,
62
+ body: S.Unknown,
63
+ }).pipe(C.withBadRequestError),
64
+ [{ status: 404 }],
65
+ ) {}
66
+
67
+ export class PermissionDenied
68
+ extends /*@__PURE__*/ T.applyErrorMatchers(
69
+ /*@__PURE__*/ S.TaggedError<PermissionDenied>()("PermissionDenied", {
70
+ message: S.String,
71
+ body: S.Unknown,
72
+ }).pipe(C.withAuthError),
73
+ [{ status: 403 }],
74
+ ) {}
75
+
76
+ export class ResourceExhausted
77
+ extends /*@__PURE__*/ T.applyErrorMatchers(
78
+ /*@__PURE__*/ S.TaggedError<ResourceExhausted>()("ResourceExhausted", {
79
+ message: S.String,
80
+ body: S.Unknown,
81
+ }).pipe(C.withThrottlingError),
82
+ [{ status: 429 }],
83
+ ) {}
84
+
85
+ export class Unauthenticated
86
+ extends /*@__PURE__*/ T.applyErrorMatchers(
87
+ /*@__PURE__*/ S.TaggedError<Unauthenticated>()("Unauthenticated", {
88
+ message: S.String,
89
+ body: S.Unknown,
90
+ }).pipe(C.withAuthError),
91
+ [{ status: 401 }],
92
+ ) {}
93
+
94
+ export type StringList = Array<string>;
95
+ export interface EnvironmentVariable {
96
+ /** Required: Name under which the environment variable will be available, e.g. "FOOBAR_VAR_NAME". */
97
+ name?: string | undefined;
98
+ /** Optional: If set, use this static value for the environment variable. */
99
+ value?: string | undefined;
100
+ /** Optional: If set, overrides value. Namespace will dynamically resolve the secret on instance creation. By default, no secrets are resolved unless requested explicitly. */
101
+ fromSecretId?: string | undefined;
102
+ }
103
+ export type EnvironmentVariableList = Array<EnvironmentVariable>;
104
+ export interface Command {
105
+ /** The command to execute, e.g. ["ls", "-la"]. */
106
+ command?: StringList | undefined;
107
+ /** Optional environment variables to set for the command. */
108
+ envVars?: EnvironmentVariableList | undefined;
109
+ /** Optional working directory for the command. */
110
+ cwd?: string | undefined;
111
+ }
112
+ export interface RunCommandSyncRequest {
113
+ /** The ID of instance which this call targets. */
114
+ instanceId?: string | undefined;
115
+ /** The name of the container to run the command in. */
116
+ targetContainerName?: string | undefined;
117
+ /** The command to execute. */
118
+ command?: Command | undefined;
119
+ }
120
+ export interface RunCommandSyncResponse {
121
+ /** The combined stdout output. */
122
+ stdout: string;
123
+ /** The combined stderr output. */
124
+ stderr: string;
125
+ /** The exit code of the command. */
126
+ exitCode: number;
127
+ }
128
+ export type RunCommandSyncError =
129
+ | InvalidArgument
130
+ | FailedPrecondition
131
+ | Unauthenticated
132
+ | PermissionDenied
133
+ | NotFound
134
+ | AlreadyExists
135
+ | ResourceExhausted
136
+ | NamespaceLabsOpError;
137
+ /** Runs a command in a container within a running instance and waits for it to complete. Stdout and stderr are bundled into a single response, similar to CombinedOutput. ### Errors - If the instance does not exist, a `NotFound` status is returned. - If the target container does not exist, a `NotFound` status is returned. */
138
+ export const runCommandSync: API.OperationMethod<
139
+ RunCommandSyncRequest,
140
+ RunCommandSyncResponse,
141
+ RunCommandSyncError,
142
+ NamespaceLabsOpContext
143
+ > = /*@__PURE__*/ API.make(() => ({
144
+ input: __S(4, __c0, 4) as any as S.Schema<RunCommandSyncRequest>,
145
+ output: __S(5, __c0, 5) as any as S.Schema<RunCommandSyncResponse>,
146
+ errors: [
147
+ InvalidArgument,
148
+ FailedPrecondition,
149
+ Unauthenticated,
150
+ PermissionDenied,
151
+ NotFound,
152
+ AlreadyExists,
153
+ ResourceExhausted,
154
+ UnknownNamespaceLabsError,
155
+ ],
156
+ protocol: NamespaceLabsProtocol,
157
+ retry: Retry.Retry,
158
+ telemetry: TELEMETRY,
159
+ span: "RunCommandSync",
160
+ }));
161
+
162
+ // Schema builders: each runs one schema initializer, on that schema's first use.
163
+ function __c0(j: number): any {
164
+ switch (j) {
165
+ case 0:
166
+ return S.Array(S.String);
167
+ case 1:
168
+ return S.suspend(() =>
169
+ S.Struct({
170
+ name: S.optional(S.String),
171
+ value: S.optional(S.String),
172
+ fromSecretId: S.optional(S.String),
173
+ }),
174
+ ).annotate({ identifier: "EnvironmentVariable" });
175
+ case 2:
176
+ return S.Array(__S(1, __c0, 1));
177
+ case 3:
178
+ return S.suspend(() =>
179
+ S.Struct({
180
+ command: S.optional(__S(0, __c0, 0)),
181
+ envVars: S.optional(__S(2, __c0, 2)),
182
+ cwd: S.optional(S.String),
183
+ }),
184
+ ).annotate({ identifier: "Command" });
185
+ case 4:
186
+ return S.suspend(() =>
187
+ S.Struct({
188
+ instanceId: S.optional(S.String),
189
+ targetContainerName: S.optional(S.String),
190
+ command: S.optional(__S(3, __c0, 3)),
191
+ }).pipe(
192
+ T.Http({
193
+ method: "POST",
194
+ uri: "/namespace.cloud.compute.v1beta.CommandService/RunCommandSync",
195
+ code: 200,
196
+ }),
197
+ ),
198
+ ).annotate({ identifier: "RunCommandSyncRequest" });
199
+ case 5:
200
+ return S.suspend(() =>
201
+ S.Struct({
202
+ stdout: S.String,
203
+ stderr: S.String,
204
+ exitCode: S.Number,
205
+ }),
206
+ ).annotate({ identifier: "RunCommandSyncResponse" });
207
+ }
208
+ }
209
+ // Schema table: entry i is schema j of builder f, made on first reach.
210
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
211
+ return (__s[i] ??= __L.at(f, j));
212
+ }
@@ -0,0 +1,428 @@
1
+ import * as API from "@distilled.cloud/core/api";
2
+ import * as C from "@distilled.cloud/core/category";
3
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (buf.build/namespace/cloud -> smithy). Do not edit.
4
+ import * as S from "@distilled.cloud/core/schema-lite";
5
+ import * as __L from "@distilled.cloud/core/schema-lite";
6
+ import { UnknownNamespaceLabsError } from "../errors.ts";
7
+ import { paginateCursor } from "../pagination.ts";
8
+ import {
9
+ NamespaceLabsProtocol,
10
+ type NamespaceLabsOpError,
11
+ type NamespaceLabsOpContext,
12
+ } from "../protocol.ts";
13
+ import * as Retry from "../retry.ts";
14
+ import * as T from "../traits.ts";
15
+ // Schema table, filled on first reach (see __S at the end).
16
+ const __s: any[] = [];
17
+
18
+ export type { NamespaceLabsOpError, NamespaceLabsOpContext };
19
+
20
+ /** Span facts shared by every operation (com.distilled.telemetry#service). */
21
+ const TELEMETRY = {
22
+ system: "namespacelabs-api",
23
+ responseHeaders: [
24
+ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
25
+ { header: "request-id", name: "http.response.header.request-id", transform: "list" },
26
+ ],
27
+ prefix: "Namespacelabs",
28
+ service: "ObservabilityService",
29
+ propagate: "w3c",
30
+ } as const;
31
+
32
+ export class AlreadyExists
33
+ extends /*@__PURE__*/ T.applyErrorMatchers(
34
+ /*@__PURE__*/ S.TaggedError<AlreadyExists>()("AlreadyExists", {
35
+ message: S.String,
36
+ body: S.Unknown,
37
+ }).pipe(C.withConflictError),
38
+ [{ status: 409, body: { "/code": "already_exists" } }],
39
+ ) {}
40
+
41
+ export class FailedPrecondition
42
+ extends /*@__PURE__*/ T.applyErrorMatchers(
43
+ /*@__PURE__*/ S.TaggedError<FailedPrecondition>()("FailedPrecondition", {
44
+ message: S.String,
45
+ body: S.Unknown,
46
+ }).pipe(C.withBadRequestError),
47
+ [{ status: 400, body: { "/code": "failed_precondition" } }],
48
+ ) {}
49
+
50
+ export class InvalidArgument
51
+ extends /*@__PURE__*/ T.applyErrorMatchers(
52
+ /*@__PURE__*/ S.TaggedError<InvalidArgument>()("InvalidArgument", {
53
+ message: S.String,
54
+ body: S.Unknown,
55
+ }).pipe(C.withBadRequestError),
56
+ [{ status: 400, body: { "/code": "invalid_argument" } }],
57
+ ) {}
58
+
59
+ export class NotFound
60
+ extends /*@__PURE__*/ T.applyErrorMatchers(
61
+ /*@__PURE__*/ S.TaggedError<NotFound>()("NotFound", {
62
+ message: S.String,
63
+ body: S.Unknown,
64
+ }).pipe(C.withBadRequestError),
65
+ [{ status: 404 }],
66
+ ) {}
67
+
68
+ export class PermissionDenied
69
+ extends /*@__PURE__*/ T.applyErrorMatchers(
70
+ /*@__PURE__*/ S.TaggedError<PermissionDenied>()("PermissionDenied", {
71
+ message: S.String,
72
+ body: S.Unknown,
73
+ }).pipe(C.withAuthError),
74
+ [{ status: 403 }],
75
+ ) {}
76
+
77
+ export class ResourceExhausted
78
+ extends /*@__PURE__*/ T.applyErrorMatchers(
79
+ /*@__PURE__*/ S.TaggedError<ResourceExhausted>()("ResourceExhausted", {
80
+ message: S.String,
81
+ body: S.Unknown,
82
+ }).pipe(C.withThrottlingError),
83
+ [{ status: 429 }],
84
+ ) {}
85
+
86
+ export class Unauthenticated
87
+ extends /*@__PURE__*/ T.applyErrorMatchers(
88
+ /*@__PURE__*/ S.TaggedError<Unauthenticated>()("Unauthenticated", {
89
+ message: S.String,
90
+ body: S.Unknown,
91
+ }).pipe(C.withAuthError),
92
+ [{ status: 401 }],
93
+ ) {}
94
+
95
+ export interface FetchInstanceDiagnosticsRequest {
96
+ instanceId?: string | undefined;
97
+ }
98
+ export interface OOMEvent {
99
+ /** When the out-of-memory kill was detected. */
100
+ timestamp?: string | undefined;
101
+ /** Diagnostic information about the process that was killed. */
102
+ message: string;
103
+ }
104
+ export type OOMEventList = Array<OOMEvent>;
105
+ export interface FetchInstanceDiagnosticsResponse {
106
+ outOfMemoryEvents: OOMEventList;
107
+ }
108
+ export interface TimestampRange {
109
+ after?: string | undefined;
110
+ before?: string | undefined;
111
+ }
112
+ export interface FetchInstanceEgressRequest {
113
+ instanceId?: string | undefined;
114
+ /** Optional */
115
+ timestampRange?: TimestampRange | undefined;
116
+ /** default 20_000 */
117
+ limit?: number | undefined;
118
+ paginationCursor?: string | undefined;
119
+ }
120
+ export type EgressAction = "ACTION_UNKNOWN" | "ALLOW" | "DENY" | "ADVISORY_DENY";
121
+ export type StringList = Array<string>;
122
+ export interface EgressRecord {
123
+ timestamp?: string | undefined;
124
+ domain: string;
125
+ /** What rule matcher (if any) lead to the action */
126
+ ruleMatch: string;
127
+ action: EgressAction;
128
+ answerIps: StringList;
129
+ }
130
+ export type EgressRecordList = Array<EgressRecord>;
131
+ export interface FetchInstanceEgressResponse {
132
+ records: EgressRecordList;
133
+ paginationCursor: string;
134
+ }
135
+ export type StringMatcherOperator = "OPERATOR_UNKNOWN" | "IS_ANY_OF" | "IS_NOT";
136
+ export interface StringMatcher {
137
+ values?: StringList | undefined;
138
+ op?: StringMatcherOperator | (string & {}) | undefined;
139
+ }
140
+ export type FetchInstanceLogsRequestDirection =
141
+ | "DIRECTION_UNSPECIFIED"
142
+ | "DIRECTION_FORWARD"
143
+ | "DIRECTION_BACKWARD";
144
+ export interface FetchInstanceLogsRequest {
145
+ paginationCursor?: string | undefined;
146
+ linesPerPage?: number | undefined;
147
+ matchInstanceIds?: StringMatcher | undefined;
148
+ timestampRange?: TimestampRange | undefined;
149
+ matchContainerNames?: StringMatcher | undefined;
150
+ /** Orders log lines by timestamp. A pagination cursor preserves the direction of the first request. */
151
+ direction?: FetchInstanceLogsRequestDirection | (string & {}) | undefined;
152
+ }
153
+ export type StringMap = { [key: string]: string | undefined };
154
+ export interface LogLine {
155
+ timestamp?: string | undefined;
156
+ content: string;
157
+ /** E.g. stdout, stderr */
158
+ stream: string;
159
+ labels: StringMap;
160
+ /** E.g. containers, kubernetes, kmsg. */
161
+ source: string;
162
+ }
163
+ export type LogLineList = Array<LogLine>;
164
+ export interface FetchInstanceLogsResponse {
165
+ paginationCursor: string;
166
+ logLine: LogLineList;
167
+ retentionDays: number;
168
+ }
169
+ export type FetchInstanceDiagnosticsError =
170
+ | InvalidArgument
171
+ | FailedPrecondition
172
+ | Unauthenticated
173
+ | PermissionDenied
174
+ | NotFound
175
+ | AlreadyExists
176
+ | ResourceExhausted
177
+ | NamespaceLabsOpError;
178
+ /** Fetches diagnostic findings for a particular instance. Requires the {"instance/o11y/oom", "list"} permission for the instance. ### Errors - If no instance id is provided, an `InvalidArgument` status is returned. */
179
+ export const fetchInstanceDiagnostics: API.OperationMethod<
180
+ FetchInstanceDiagnosticsRequest,
181
+ FetchInstanceDiagnosticsResponse,
182
+ FetchInstanceDiagnosticsError,
183
+ NamespaceLabsOpContext
184
+ > = /*@__PURE__*/ API.make(() => ({
185
+ input: __S(0, __c0, 0) as any as S.Schema<FetchInstanceDiagnosticsRequest>,
186
+ output: __S(3, __c0, 3) as any as S.Schema<FetchInstanceDiagnosticsResponse>,
187
+ errors: [
188
+ InvalidArgument,
189
+ FailedPrecondition,
190
+ Unauthenticated,
191
+ PermissionDenied,
192
+ NotFound,
193
+ AlreadyExists,
194
+ ResourceExhausted,
195
+ UnknownNamespaceLabsError,
196
+ ],
197
+ protocol: NamespaceLabsProtocol,
198
+ retry: Retry.Retry,
199
+ telemetry: TELEMETRY,
200
+ span: "FetchInstanceDiagnostics",
201
+ }));
202
+
203
+ export type FetchInstanceEgressError =
204
+ | InvalidArgument
205
+ | FailedPrecondition
206
+ | Unauthenticated
207
+ | PermissionDenied
208
+ | NotFound
209
+ | AlreadyExists
210
+ | ResourceExhausted
211
+ | NamespaceLabsOpError;
212
+ /** Fetches egress filtering decisions for a particular instance. */
213
+ export const fetchInstanceEgress: API.PaginatedOperationMethod<
214
+ FetchInstanceEgressRequest,
215
+ FetchInstanceEgressResponse,
216
+ FetchInstanceEgressError,
217
+ NamespaceLabsOpContext,
218
+ EgressRecord
219
+ > = /*@__PURE__*/ API.makePaginated(
220
+ () => ({
221
+ input: __S(8, __c1, 0) as any as S.Schema<FetchInstanceEgressRequest>,
222
+ output: __S(11, __c1, 3) as any as S.Schema<FetchInstanceEgressResponse>,
223
+ errors: [
224
+ InvalidArgument,
225
+ FailedPrecondition,
226
+ Unauthenticated,
227
+ PermissionDenied,
228
+ NotFound,
229
+ AlreadyExists,
230
+ ResourceExhausted,
231
+ UnknownNamespaceLabsError,
232
+ ],
233
+ protocol: NamespaceLabsProtocol,
234
+ retry: Retry.Retry,
235
+ telemetry: TELEMETRY,
236
+ span: "FetchInstanceEgress",
237
+ pagination: {
238
+ mode: "cursor",
239
+ inputToken: "paginationCursor",
240
+ outputToken: "paginationCursor",
241
+ items: "records",
242
+ pageSize: "limit",
243
+ } as const,
244
+ }),
245
+ paginateCursor,
246
+ ) as any;
247
+
248
+ export type FetchInstanceLogsError =
249
+ | InvalidArgument
250
+ | FailedPrecondition
251
+ | Unauthenticated
252
+ | PermissionDenied
253
+ | NotFound
254
+ | AlreadyExists
255
+ | ResourceExhausted
256
+ | NamespaceLabsOpError;
257
+ /** Fetches logs of a particular instance (or instances). The instances can still be running. A time range is required to use this API. Either the lookups being done have naturally a range, e.g. last 30 minutes, or you should lookup the time that the instances ran and pass those to the API. If no time range is specified, the serving cost might be too high, and the API server may elect to reject the call. */
258
+ export const fetchInstanceLogs: API.PaginatedOperationMethod<
259
+ FetchInstanceLogsRequest,
260
+ FetchInstanceLogsResponse,
261
+ FetchInstanceLogsError,
262
+ NamespaceLabsOpContext,
263
+ LogLine
264
+ > = /*@__PURE__*/ API.makePaginated(
265
+ () => ({
266
+ input: __S(25, __c3, 1) as any as S.Schema<FetchInstanceLogsRequest>,
267
+ output: __S(29, __c3, 5) as any as S.Schema<FetchInstanceLogsResponse>,
268
+ errors: [
269
+ InvalidArgument,
270
+ FailedPrecondition,
271
+ Unauthenticated,
272
+ PermissionDenied,
273
+ NotFound,
274
+ AlreadyExists,
275
+ ResourceExhausted,
276
+ UnknownNamespaceLabsError,
277
+ ],
278
+ protocol: NamespaceLabsProtocol,
279
+ retry: Retry.Retry,
280
+ telemetry: TELEMETRY,
281
+ span: "FetchInstanceLogs",
282
+ pagination: {
283
+ mode: "cursor",
284
+ inputToken: "paginationCursor",
285
+ outputToken: "paginationCursor",
286
+ items: "logLine",
287
+ } as const,
288
+ }),
289
+ paginateCursor,
290
+ ) as any;
291
+
292
+ // Schema builders: each runs one schema initializer, on that schema's first use.
293
+ function __c0(j: number): any {
294
+ switch (j) {
295
+ case 0:
296
+ return S.suspend(() =>
297
+ S.Struct({
298
+ instanceId: S.optional(S.String),
299
+ }).pipe(
300
+ T.Http({
301
+ method: "POST",
302
+ uri: "/namespace.cloud.compute.v1beta.ObservabilityService/FetchInstanceDiagnostics",
303
+ code: 200,
304
+ }),
305
+ ),
306
+ ).annotate({ identifier: "FetchInstanceDiagnosticsRequest" });
307
+ case 1:
308
+ return S.suspend(() =>
309
+ S.Struct({
310
+ timestamp: S.optional(S.String),
311
+ message: S.String,
312
+ }),
313
+ ).annotate({ identifier: "OOMEvent" });
314
+ case 2:
315
+ return S.Array(__S(1, __c0, 1));
316
+ case 3:
317
+ return S.suspend(() =>
318
+ S.Struct({
319
+ outOfMemoryEvents: __S(2, __c0, 2),
320
+ }),
321
+ ).annotate({ identifier: "FetchInstanceDiagnosticsResponse" });
322
+ }
323
+ }
324
+ function __c1(j: number): any {
325
+ switch (j) {
326
+ case 0:
327
+ return S.suspend(() =>
328
+ S.Struct({
329
+ instanceId: S.optional(S.String),
330
+ timestampRange: S.optional(__S(16, __c2, 0)),
331
+ limit: S.optional(S.Number),
332
+ paginationCursor: S.optional(S.String),
333
+ }).pipe(
334
+ T.Http({
335
+ method: "POST",
336
+ uri: "/namespace.cloud.compute.v1beta.ObservabilityService/FetchInstanceEgress",
337
+ code: 200,
338
+ }),
339
+ ),
340
+ ).annotate({ identifier: "FetchInstanceEgressRequest" });
341
+ case 1:
342
+ return S.suspend(() =>
343
+ S.Struct({
344
+ timestamp: S.optional(S.String),
345
+ domain: S.String,
346
+ ruleMatch: S.String,
347
+ action: S.String,
348
+ answerIps: __S(17, __c2, 1),
349
+ }),
350
+ ).annotate({ identifier: "EgressRecord" });
351
+ case 2:
352
+ return S.Array(__S(9, __c1, 1));
353
+ case 3:
354
+ return S.suspend(() =>
355
+ S.Struct({
356
+ records: __S(10, __c1, 2),
357
+ paginationCursor: S.String,
358
+ }),
359
+ ).annotate({ identifier: "FetchInstanceEgressResponse" });
360
+ }
361
+ }
362
+ function __c2(j: number): any {
363
+ switch (j) {
364
+ case 0:
365
+ return S.suspend(() =>
366
+ S.Struct({
367
+ after: S.optional(S.String),
368
+ before: S.optional(S.String),
369
+ }),
370
+ ).annotate({ identifier: "TimestampRange" });
371
+ case 1:
372
+ return S.Array(S.String);
373
+ }
374
+ }
375
+ function __c3(j: number): any {
376
+ switch (j) {
377
+ case 0:
378
+ return S.suspend(() =>
379
+ S.Struct({
380
+ values: S.optional(__S(17, __c2, 1)),
381
+ op: S.optional(S.String),
382
+ }),
383
+ ).annotate({ identifier: "StringMatcher" });
384
+ case 1:
385
+ return S.suspend(() =>
386
+ S.Struct({
387
+ paginationCursor: S.optional(S.String),
388
+ linesPerPage: S.optional(S.Number),
389
+ matchInstanceIds: S.optional(__S(24, __c3, 0)),
390
+ timestampRange: S.optional(__S(16, __c2, 0)),
391
+ matchContainerNames: S.optional(__S(24, __c3, 0)),
392
+ direction: S.optional(S.String),
393
+ }).pipe(
394
+ T.Http({
395
+ method: "POST",
396
+ uri: "/namespace.cloud.compute.v1beta.ObservabilityService/FetchInstanceLogs",
397
+ code: 200,
398
+ }),
399
+ ),
400
+ ).annotate({ identifier: "FetchInstanceLogsRequest" });
401
+ case 2:
402
+ return S.Record(S.String, S.String);
403
+ case 3:
404
+ return S.suspend(() =>
405
+ S.Struct({
406
+ timestamp: S.optional(S.String),
407
+ content: S.String,
408
+ stream: S.String,
409
+ labels: __S(26, __c3, 2),
410
+ source: S.String,
411
+ }),
412
+ ).annotate({ identifier: "LogLine" });
413
+ case 4:
414
+ return S.Array(__S(27, __c3, 3));
415
+ case 5:
416
+ return S.suspend(() =>
417
+ S.Struct({
418
+ paginationCursor: S.String,
419
+ logLine: __S(28, __c3, 4),
420
+ retentionDays: S.Number,
421
+ }),
422
+ ).annotate({ identifier: "FetchInstanceLogsResponse" });
423
+ }
424
+ }
425
+ // Schema table: entry i is schema j of builder f, made on first reach.
426
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
427
+ return (__s[i] ??= __L.at(f, j));
428
+ }