@distilled.cloud/tinybird 0.0.0 → 1.0.0-rc.22

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 (113) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +128 -4
  3. package/lib/.lazy.json +1 -0
  4. package/lib/_bundle/sdk.js +2 -0
  5. package/lib/_bundle/sdk.js.map +1 -0
  6. package/lib/credentials.d.ts +29 -0
  7. package/lib/credentials.d.ts.map +1 -0
  8. package/lib/credentials.js +1 -0
  9. package/lib/errors.d.ts +52 -0
  10. package/lib/errors.d.ts.map +1 -0
  11. package/lib/errors.js +1 -0
  12. package/lib/index.d.ts +48 -0
  13. package/lib/index.d.ts.map +1 -0
  14. package/lib/index.js +5 -0
  15. package/lib/protocol.d.ts +19 -0
  16. package/lib/protocol.d.ts.map +1 -0
  17. package/lib/protocol.js +1 -0
  18. package/lib/retry.d.ts +50 -0
  19. package/lib/retry.d.ts.map +1 -0
  20. package/lib/retry.js +1 -0
  21. package/lib/services/analyze.d.ts +17 -0
  22. package/lib/services/analyze.d.ts.map +1 -0
  23. package/lib/services/analyze.js +2 -0
  24. package/lib/services/analyze.js.map +1 -0
  25. package/lib/services/api_endpoints.d.ts +26 -0
  26. package/lib/services/api_endpoints.d.ts.map +1 -0
  27. package/lib/services/api_endpoints.js +2 -0
  28. package/lib/services/api_endpoints.js.map +1 -0
  29. package/lib/services/copy_pipes.d.ts +102 -0
  30. package/lib/services/copy_pipes.d.ts.map +1 -0
  31. package/lib/services/copy_pipes.js +2 -0
  32. package/lib/services/copy_pipes.js.map +1 -0
  33. package/lib/services/datasource.d.ts +171 -0
  34. package/lib/services/datasource.d.ts.map +1 -0
  35. package/lib/services/datasource.js +2 -0
  36. package/lib/services/datasource.js.map +1 -0
  37. package/lib/services/environment_variables.d.ts +61 -0
  38. package/lib/services/environment_variables.d.ts.map +1 -0
  39. package/lib/services/environment_variables.js +2 -0
  40. package/lib/services/environment_variables.js.map +1 -0
  41. package/lib/services/events.d.ts +21 -0
  42. package/lib/services/events.d.ts.map +1 -0
  43. package/lib/services/events.js +2 -0
  44. package/lib/services/events.js.map +1 -0
  45. package/lib/services/index.d.ts +14 -0
  46. package/lib/services/index.d.ts.map +1 -0
  47. package/lib/services/index.js +13 -0
  48. package/lib/services/jobs.d.ts +45 -0
  49. package/lib/services/jobs.d.ts.map +1 -0
  50. package/lib/services/jobs.js +2 -0
  51. package/lib/services/jobs.js.map +1 -0
  52. package/lib/services/materialized_views.d.ts +64 -0
  53. package/lib/services/materialized_views.d.ts.map +1 -0
  54. package/lib/services/materialized_views.js +2 -0
  55. package/lib/services/materialized_views.js.map +1 -0
  56. package/lib/services/organizations.d.ts +214 -0
  57. package/lib/services/organizations.d.ts.map +1 -0
  58. package/lib/services/organizations.js +2 -0
  59. package/lib/services/organizations.js.map +1 -0
  60. package/lib/services/pipe.d.ts +243 -0
  61. package/lib/services/pipe.d.ts.map +1 -0
  62. package/lib/services/pipe.js +2 -0
  63. package/lib/services/pipe.js.map +1 -0
  64. package/lib/services/query.d.ts +50 -0
  65. package/lib/services/query.d.ts.map +1 -0
  66. package/lib/services/query.js +2 -0
  67. package/lib/services/query.js.map +1 -0
  68. package/lib/services/sink_pipes.d.ts +95 -0
  69. package/lib/services/sink_pipes.d.ts.map +1 -0
  70. package/lib/services/sink_pipes.js +2 -0
  71. package/lib/services/sink_pipes.js.map +1 -0
  72. package/lib/services/token.d.ts +107 -0
  73. package/lib/services/token.d.ts.map +1 -0
  74. package/lib/services/token.js +2 -0
  75. package/lib/services/token.js.map +1 -0
  76. package/lib/services.lazy/analyze.js +1 -0
  77. package/lib/services.lazy/api_endpoints.js +1 -0
  78. package/lib/services.lazy/copy_pipes.js +1 -0
  79. package/lib/services.lazy/datasource.js +1 -0
  80. package/lib/services.lazy/environment_variables.js +1 -0
  81. package/lib/services.lazy/events.js +1 -0
  82. package/lib/services.lazy/index.js +3 -0
  83. package/lib/services.lazy/jobs.js +1 -0
  84. package/lib/services.lazy/materialized_views.js +1 -0
  85. package/lib/services.lazy/organizations.js +1 -0
  86. package/lib/services.lazy/pipe.js +1 -0
  87. package/lib/services.lazy/query.js +1 -0
  88. package/lib/services.lazy/sink_pipes.js +1 -0
  89. package/lib/services.lazy/token.js +1 -0
  90. package/lib/traits.d.ts +10 -0
  91. package/lib/traits.d.ts.map +1 -0
  92. package/lib/traits.js +1 -0
  93. package/package.json +76 -2
  94. package/src/credentials.ts +76 -0
  95. package/src/errors.ts +83 -0
  96. package/src/index.ts +47 -0
  97. package/src/protocol.ts +48 -0
  98. package/src/retry.ts +69 -0
  99. package/src/services/analyze.ts +75 -0
  100. package/src/services/api_endpoints.ts +115 -0
  101. package/src/services/copy_pipes.ts +315 -0
  102. package/src/services/datasource.ts +438 -0
  103. package/src/services/environment_variables.ts +213 -0
  104. package/src/services/events.ts +86 -0
  105. package/src/services/index.ts +14 -0
  106. package/src/services/jobs.ts +156 -0
  107. package/src/services/materialized_views.ts +200 -0
  108. package/src/services/organizations.ts +552 -0
  109. package/src/services/pipe.ts +700 -0
  110. package/src/services/query.ts +150 -0
  111. package/src/services/sink_pipes.ts +295 -0
  112. package/src/services/token.ts +359 -0
  113. package/src/traits.ts +47 -0
@@ -0,0 +1,552 @@
1
+ import * as API from "@distilled.cloud/core/api";
2
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/spec-mirror-tinybird/specs/api-reference). Do not edit.
3
+ import * as S from "@distilled.cloud/core/schema-lite";
4
+ import * as __L from "@distilled.cloud/core/schema-lite";
5
+ import { TinybirdServiceErrors } from "../errors.ts";
6
+ import { TinybirdProtocol, type TinybirdOpError, type TinybirdOpContext } from "../protocol.ts";
7
+ import * as Retry from "../retry.ts";
8
+ import * as T from "../traits.ts";
9
+ // Schema table, filled on first reach (see __S at the end).
10
+ const __s: any[] = [];
11
+
12
+ export type { TinybirdOpError, TinybirdOpContext };
13
+
14
+ /** Span facts shared by every operation (com.distilled.telemetry#service). */
15
+ const TELEMETRY = {
16
+ system: "tinybird-api",
17
+ responseHeaders: [
18
+ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
19
+ { header: "request-id", name: "http.response.header.request-id", transform: "list" },
20
+ ],
21
+ prefix: "Tinybird",
22
+ service: "Organizations",
23
+ labels: "tinybird",
24
+ propagate: "w3c",
25
+ } as const;
26
+
27
+ /** Current and target weights for existing replicas. Must include `old_weights` and `new_weights`. */
28
+ export type AddOrganizationClusterReplicaRequestExistingReplicasMap = {
29
+ [key: string]: unknown | undefined;
30
+ };
31
+ /** Weights to assign to the new replica by role. */
32
+ export type AddOrganizationClusterReplicaRequestNewReplicaMap = {
33
+ [key: string]: unknown | undefined;
34
+ };
35
+ export interface AddOrganizationClusterReplicaRequest {
36
+ organization: string;
37
+ cluster: string;
38
+ /** Replica shape in `cpu-memory` format, for example `4-16`. */
39
+ replica_size?: string | undefined;
40
+ /** Current and target weights for existing replicas. Must include `old_weights` and `new_weights`. */
41
+ existing_replicas?: AddOrganizationClusterReplicaRequestExistingReplicasMap | undefined;
42
+ /** Weights to assign to the new replica by role. */
43
+ new_replica?: AddOrganizationClusterReplicaRequestNewReplicaMap | undefined;
44
+ }
45
+ export type AddOrganizationClusterReplicaResponseBodyMap = { [key: string]: unknown | undefined };
46
+ export type AddOrganizationClusterReplicaResponse = AddOrganizationClusterReplicaResponseBodyMap;
47
+ /** Current and target weights for existing replicas. Must include `old_weights` and `new_weights`. */
48
+ export type AddOrganizationClusterReplicaByNameRequestExistingReplicasMap = {
49
+ [key: string]: unknown | undefined;
50
+ };
51
+ /** Weights to assign to the new replica by role. */
52
+ export type AddOrganizationClusterReplicaByNameRequestNewReplicaMap = {
53
+ [key: string]: unknown | undefined;
54
+ };
55
+ export interface AddOrganizationClusterReplicaByNameRequest {
56
+ organization: string;
57
+ cluster: string;
58
+ replica: string;
59
+ /** Replica shape in `cpu-memory` format, for example `4-16`. */
60
+ replica_size?: string | undefined;
61
+ /** Current and target weights for existing replicas. Must include `old_weights` and `new_weights`. */
62
+ existing_replicas?: AddOrganizationClusterReplicaByNameRequestExistingReplicasMap | undefined;
63
+ /** Weights to assign to the new replica by role. */
64
+ new_replica?: AddOrganizationClusterReplicaByNameRequestNewReplicaMap | undefined;
65
+ }
66
+ export type AddOrganizationClusterReplicaByNameResponseBodyMap = {
67
+ [key: string]: unknown | undefined;
68
+ };
69
+ export type AddOrganizationClusterReplicaByNameResponse =
70
+ AddOrganizationClusterReplicaByNameResponseBodyMap;
71
+ export interface GetOrganizationClustersConfigurationRequest {
72
+ organization: string;
73
+ }
74
+ /** Available cloud regions grouped by provider. */
75
+ export type GetOrganizationClustersConfigurationResponseCloudRegionsMap = {
76
+ [key: string]: unknown | undefined;
77
+ };
78
+ export interface GetOrganizationClustersConfigurationResponseAvailableSizesValueItem {
79
+ /** Replica size in `cpu-memory` format. */
80
+ name?: string | undefined;
81
+ /** Number of vCPUs for the replica size. */
82
+ cpu?: number | undefined;
83
+ /** Amount of memory in GB for the replica size. */
84
+ memory_gb?: number | undefined;
85
+ }
86
+ export type GetOrganizationClustersConfigurationResponseAvailableSizesValueList =
87
+ Array<GetOrganizationClustersConfigurationResponseAvailableSizesValueItem>;
88
+ /** Available replica sizes grouped by provider. */
89
+ export type GetOrganizationClustersConfigurationResponseAvailableSizesMap = {
90
+ [key: string]: GetOrganizationClustersConfigurationResponseAvailableSizesValueList | undefined;
91
+ };
92
+ /** Cluster roles that can be managed in scaling and rebalancing operations. */
93
+ export type GetOrganizationClustersConfigurationResponseAvailableRolesList = Array<string>;
94
+ export interface GetOrganizationClustersConfigurationResponse {
95
+ /** Available cloud regions grouped by provider. */
96
+ cloud_regions?: GetOrganizationClustersConfigurationResponseCloudRegionsMap | undefined;
97
+ /** Available replica sizes grouped by provider. */
98
+ available_sizes?: GetOrganizationClustersConfigurationResponseAvailableSizesMap | undefined;
99
+ /** Cluster roles that can be managed in scaling and rebalancing operations. */
100
+ available_roles?: GetOrganizationClustersConfigurationResponseAvailableRolesList | undefined;
101
+ }
102
+ export interface ListOrganizationClustersRequest {
103
+ organization: string;
104
+ }
105
+ /** Current traffic distribution by role and replica. */
106
+ export type ListOrganizationClustersResponseClustersItemClusterWeightsMap = {
107
+ [key: string]: unknown | undefined;
108
+ };
109
+ /** Replica details keyed by replica name. */
110
+ export type ListOrganizationClustersResponseClustersItemReplicasMap = {
111
+ [key: string]: unknown | undefined;
112
+ };
113
+ /** Supported target versions for upgrades. */
114
+ export type ListOrganizationClustersResponseClustersItemAvailableClickhouseVersionsList =
115
+ Array<string>;
116
+ /** Rolling update settings when configured. */
117
+ export type ListOrganizationClustersResponseClustersItemRollingUpdateConfigMap = {
118
+ [key: string]: unknown | undefined;
119
+ };
120
+ export interface ListOrganizationClustersResponseClustersItem {
121
+ /** Identifier used by management operations. */
122
+ cluster_id?: string | undefined;
123
+ /** Internal cluster name. */
124
+ cluster_name?: string | undefined;
125
+ /** Cloud provider hosting the cluster. */
126
+ cloud_provider?: string | undefined;
127
+ /** Region where the cluster is deployed. */
128
+ cloud_region?: string | undefined;
129
+ /** Whether a cluster operation is currently running. */
130
+ operation_in_progress?: boolean | undefined;
131
+ /** Whether weights can be rebalanced at this time. */
132
+ can_rebalance?: boolean | undefined;
133
+ /** Whether replicas can be scaled at this time. */
134
+ can_scale?: boolean | undefined;
135
+ /** Current traffic distribution by role and replica. */
136
+ cluster_weights?: ListOrganizationClustersResponseClustersItemClusterWeightsMap | undefined;
137
+ /** Replica details keyed by replica name. */
138
+ replicas?: ListOrganizationClustersResponseClustersItemReplicasMap | undefined;
139
+ /** Last cluster-level error, if any. */
140
+ error?: string | null | undefined;
141
+ /** Whether the cluster is currently under maintenance. */
142
+ ongoing_maintenance?: boolean | undefined;
143
+ /** Current ClickHouse version for the cluster. */
144
+ clickhouse_version?: string | null | undefined;
145
+ /** Supported target versions for upgrades. */
146
+ available_clickhouse_versions?:
147
+ | ListOrganizationClustersResponseClustersItemAvailableClickhouseVersionsList
148
+ | undefined;
149
+ /** Rolling update settings when configured. */
150
+ rolling_update_config?:
151
+ | ListOrganizationClustersResponseClustersItemRollingUpdateConfigMap
152
+ | null
153
+ | undefined;
154
+ }
155
+ /** List of dedicated clusters configured for the organization. */
156
+ export type ListOrganizationClustersResponseClustersList =
157
+ Array<ListOrganizationClustersResponseClustersItem>;
158
+ export interface ListOrganizationClustersResponse {
159
+ /** List of dedicated clusters configured for the organization. */
160
+ clusters?: ListOrganizationClustersResponseClustersList | undefined;
161
+ }
162
+ /** Current weights by role and replica. */
163
+ export type RemoveOrganizationClusterReplicaRequestOldWeightsMap = {
164
+ [key: string]: unknown | undefined;
165
+ };
166
+ /** Target weights by role and replica. It must not include the removed replica. */
167
+ export type RemoveOrganizationClusterReplicaRequestNewWeightsMap = {
168
+ [key: string]: unknown | undefined;
169
+ };
170
+ export interface RemoveOrganizationClusterReplicaRequest {
171
+ organization: string;
172
+ cluster: string;
173
+ /** Current weights by role and replica. */
174
+ old_weights?: RemoveOrganizationClusterReplicaRequestOldWeightsMap | undefined;
175
+ /** Target weights by role and replica. It must not include the removed replica. */
176
+ new_weights?: RemoveOrganizationClusterReplicaRequestNewWeightsMap | undefined;
177
+ }
178
+ export type RemoveOrganizationClusterReplicaResponseBodyMap = {
179
+ [key: string]: unknown | undefined;
180
+ };
181
+ export type RemoveOrganizationClusterReplicaResponse =
182
+ RemoveOrganizationClusterReplicaResponseBodyMap;
183
+ /** Current weights by role and replica. */
184
+ export type RemoveOrganizationClusterReplicaByNameRequestOldWeightsMap = {
185
+ [key: string]: unknown | undefined;
186
+ };
187
+ /** Target weights by role and replica. It must not include the removed replica. */
188
+ export type RemoveOrganizationClusterReplicaByNameRequestNewWeightsMap = {
189
+ [key: string]: unknown | undefined;
190
+ };
191
+ export interface RemoveOrganizationClusterReplicaByNameRequest {
192
+ organization: string;
193
+ cluster: string;
194
+ replica: string;
195
+ /** Current weights by role and replica. */
196
+ old_weights?: RemoveOrganizationClusterReplicaByNameRequestOldWeightsMap | undefined;
197
+ /** Target weights by role and replica. It must not include the removed replica. */
198
+ new_weights?: RemoveOrganizationClusterReplicaByNameRequestNewWeightsMap | undefined;
199
+ }
200
+ export type RemoveOrganizationClusterReplicaByNameResponseBodyMap = {
201
+ [key: string]: unknown | undefined;
202
+ };
203
+ export type RemoveOrganizationClusterReplicaByNameResponse =
204
+ RemoveOrganizationClusterReplicaByNameResponseBodyMap;
205
+ /** Current weights by role and replica. */
206
+ export type UpdateOrganizationClusterWeightsRequestOldWeightsMap = {
207
+ [key: string]: unknown | undefined;
208
+ };
209
+ /** Target weights by role and replica. */
210
+ export type UpdateOrganizationClusterWeightsRequestNewWeightsMap = {
211
+ [key: string]: unknown | undefined;
212
+ };
213
+ export interface UpdateOrganizationClusterWeightsRequest {
214
+ organization: string;
215
+ cluster: string;
216
+ /** Current weights by role and replica. */
217
+ old_weights?: UpdateOrganizationClusterWeightsRequestOldWeightsMap | undefined;
218
+ /** Target weights by role and replica. */
219
+ new_weights?: UpdateOrganizationClusterWeightsRequestNewWeightsMap | undefined;
220
+ }
221
+ export type UpdateOrganizationClusterWeightsResponseBodyMap = {
222
+ [key: string]: unknown | undefined;
223
+ };
224
+ export type UpdateOrganizationClusterWeightsResponse =
225
+ UpdateOrganizationClusterWeightsResponseBodyMap;
226
+ export type AddOrganizationClusterReplicaError = TinybirdOpError;
227
+ /** Adds a replica to a dedicated cluster and triggers rebalancing. Reference: https://www.tinybird.co/docs/api-reference/organizations-api */
228
+ export const addOrganizationClusterReplica: API.OperationMethod<
229
+ AddOrganizationClusterReplicaRequest,
230
+ AddOrganizationClusterReplicaResponse,
231
+ AddOrganizationClusterReplicaError,
232
+ TinybirdOpContext
233
+ > = /*@__PURE__*/ API.make(() => ({
234
+ input: __S(0, __c0, 0) as any as S.Schema<AddOrganizationClusterReplicaRequest>,
235
+ output: __S(16, __c2, 0) as any as S.Schema<AddOrganizationClusterReplicaResponse>,
236
+ errors: [],
237
+ serviceErrors: TinybirdServiceErrors,
238
+ protocol: TinybirdProtocol,
239
+ retry: Retry.Retry,
240
+ telemetry: TELEMETRY,
241
+ span: "AddOrganizationClusterReplica",
242
+ }));
243
+
244
+ export type AddOrganizationClusterReplicaByNameError = TinybirdOpError;
245
+ /** Adds a replica to a dedicated cluster and triggers rebalancing. Reference: https://www.tinybird.co/docs/api-reference/organizations-api */
246
+ export const addOrganizationClusterReplicaByName: API.OperationMethod<
247
+ AddOrganizationClusterReplicaByNameRequest,
248
+ AddOrganizationClusterReplicaByNameResponse,
249
+ AddOrganizationClusterReplicaByNameError,
250
+ TinybirdOpContext
251
+ > = /*@__PURE__*/ API.make(() => ({
252
+ input: __S(24, __c3, 0) as any as S.Schema<AddOrganizationClusterReplicaByNameRequest>,
253
+ output: __S(16, __c2, 0) as any as S.Schema<AddOrganizationClusterReplicaByNameResponse>,
254
+ errors: [],
255
+ serviceErrors: TinybirdServiceErrors,
256
+ protocol: TinybirdProtocol,
257
+ retry: Retry.Retry,
258
+ telemetry: TELEMETRY,
259
+ span: "AddOrganizationClusterReplicaByName",
260
+ }));
261
+
262
+ export type GetOrganizationClustersConfigurationError = TinybirdOpError;
263
+ /** Returns cluster configuration metadata, including available replica sizes. Request body requirements: - `PUT /v0/organizations/{organization_id}/clusters/{cluster_id}/weights` expects `old_weights` and `new_weights`. - `POST /v0/organizations/{organization_id}/clusters/{cluster_id}/replicas` expects `replica_size`, `existing_replicas`, and `new_replica`. - `DELETE /v0/organizations/{organization_id}/clusters/{cluster_id}/replicas/{replica_name}` expects `old_weights` and `new_weights`. Reference: https://www.tinybird.co/docs/api-reference/organizations-api */
264
+ export const getOrganizationClustersConfiguration: API.OperationMethod<
265
+ GetOrganizationClustersConfigurationRequest,
266
+ GetOrganizationClustersConfigurationResponse,
267
+ GetOrganizationClustersConfigurationError,
268
+ TinybirdOpContext
269
+ > = /*@__PURE__*/ API.make(() => ({
270
+ input: __S(32, __c4, 0) as any as S.Schema<GetOrganizationClustersConfigurationRequest>,
271
+ output: __S(36, __c4, 4) as any as S.Schema<GetOrganizationClustersConfigurationResponse>,
272
+ errors: [],
273
+ serviceErrors: TinybirdServiceErrors,
274
+ protocol: TinybirdProtocol,
275
+ retry: Retry.Retry,
276
+ telemetry: TELEMETRY,
277
+ span: "GetOrganizationClustersConfiguration",
278
+ }));
279
+
280
+ export type ListOrganizationClustersError = TinybirdOpError;
281
+ /** Returns detailed cluster information for an organization. This endpoint lists dedicated clusters assigned to the organization, including replica state, traffic weights, and maintenance/version metadata used by cluster management tooling. Reference: https://www.tinybird.co/docs/api-reference/organizations-api */
282
+ export const listOrganizationClusters: API.OperationMethod<
283
+ ListOrganizationClustersRequest,
284
+ ListOrganizationClustersResponse,
285
+ ListOrganizationClustersError,
286
+ TinybirdOpContext
287
+ > = /*@__PURE__*/ API.make(() => ({
288
+ input: __S(48, __c6, 0) as any as S.Schema<ListOrganizationClustersRequest>,
289
+ output: __S(51, __c6, 3) as any as S.Schema<ListOrganizationClustersResponse>,
290
+ errors: [],
291
+ serviceErrors: TinybirdServiceErrors,
292
+ protocol: TinybirdProtocol,
293
+ retry: Retry.Retry,
294
+ telemetry: TELEMETRY,
295
+ span: "ListOrganizationClusters",
296
+ }));
297
+
298
+ export type RemoveOrganizationClusterReplicaError = TinybirdOpError;
299
+ /** Removes a replica from a dedicated cluster and rebalances traffic. Reference: https://www.tinybird.co/docs/api-reference/organizations-api */
300
+ export const removeOrganizationClusterReplica: API.OperationMethod<
301
+ RemoveOrganizationClusterReplicaRequest,
302
+ RemoveOrganizationClusterReplicaResponse,
303
+ RemoveOrganizationClusterReplicaError,
304
+ TinybirdOpContext
305
+ > = /*@__PURE__*/ API.make(() => ({
306
+ input: __S(56, __c7, 0) as any as S.Schema<RemoveOrganizationClusterReplicaRequest>,
307
+ output: __S(16, __c2, 0) as any as S.Schema<RemoveOrganizationClusterReplicaResponse>,
308
+ errors: [],
309
+ serviceErrors: TinybirdServiceErrors,
310
+ protocol: TinybirdProtocol,
311
+ retry: Retry.Retry,
312
+ telemetry: TELEMETRY,
313
+ span: "RemoveOrganizationClusterReplica",
314
+ }));
315
+
316
+ export type RemoveOrganizationClusterReplicaByNameError = TinybirdOpError;
317
+ /** Removes a replica from a dedicated cluster and rebalances traffic. Reference: https://www.tinybird.co/docs/api-reference/organizations-api */
318
+ export const removeOrganizationClusterReplicaByName: API.OperationMethod<
319
+ RemoveOrganizationClusterReplicaByNameRequest,
320
+ RemoveOrganizationClusterReplicaByNameResponse,
321
+ RemoveOrganizationClusterReplicaByNameError,
322
+ TinybirdOpContext
323
+ > = /*@__PURE__*/ API.make(() => ({
324
+ input: __S(64, __c8, 0) as any as S.Schema<RemoveOrganizationClusterReplicaByNameRequest>,
325
+ output: __S(16, __c2, 0) as any as S.Schema<RemoveOrganizationClusterReplicaByNameResponse>,
326
+ errors: [],
327
+ serviceErrors: TinybirdServiceErrors,
328
+ protocol: TinybirdProtocol,
329
+ retry: Retry.Retry,
330
+ telemetry: TELEMETRY,
331
+ span: "RemoveOrganizationClusterReplicaByName",
332
+ }));
333
+
334
+ export type UpdateOrganizationClusterWeightsError = TinybirdOpError;
335
+ /** Updates traffic weights for replicas in a dedicated cluster. Use this endpoint to request a manual rebalance by sending the current weights and the desired new weights. Reference: https://www.tinybird.co/docs/api-reference/organizations-api */
336
+ export const updateOrganizationClusterWeights: API.OperationMethod<
337
+ UpdateOrganizationClusterWeightsRequest,
338
+ UpdateOrganizationClusterWeightsResponse,
339
+ UpdateOrganizationClusterWeightsError,
340
+ TinybirdOpContext
341
+ > = /*@__PURE__*/ API.make(() => ({
342
+ input: __S(72, __c9, 0) as any as S.Schema<UpdateOrganizationClusterWeightsRequest>,
343
+ output: __S(16, __c2, 0) as any as S.Schema<UpdateOrganizationClusterWeightsResponse>,
344
+ errors: [],
345
+ serviceErrors: TinybirdServiceErrors,
346
+ protocol: TinybirdProtocol,
347
+ retry: Retry.Retry,
348
+ telemetry: TELEMETRY,
349
+ span: "UpdateOrganizationClusterWeights",
350
+ }));
351
+
352
+ // Schema builders: each runs one schema initializer, on that schema's first use.
353
+ function __c0(j: number): any {
354
+ switch (j) {
355
+ case 0:
356
+ return S.suspend(() =>
357
+ S.Struct({
358
+ organization: S.String.pipe(T.Label()),
359
+ cluster: S.String.pipe(T.Label()),
360
+ replica_size: S.optional(S.String),
361
+ existing_replicas: S.optional(__S(8, __c1, 0)),
362
+ new_replica: S.optional(__S(8, __c1, 0)),
363
+ }).pipe(
364
+ T.Http({
365
+ method: "POST",
366
+ uri: "/v0/organizations/{organization}/clusters/{cluster}/replicas",
367
+ code: 200,
368
+ }),
369
+ ),
370
+ ).annotate({ identifier: "AddOrganizationClusterReplicaRequest" });
371
+ }
372
+ }
373
+ function __c1(j: number): any {
374
+ switch (j) {
375
+ case 0:
376
+ return S.Record(S.String, S.Unknown);
377
+ }
378
+ }
379
+ function __c2(j: number): any {
380
+ switch (j) {
381
+ case 0:
382
+ return S.suspend(() => __S(8, __c1, 0).pipe(T.RawResponseRoot())).annotate({
383
+ identifier: "AddOrganizationClusterReplicaResponse",
384
+ });
385
+ }
386
+ }
387
+ function __c3(j: number): any {
388
+ switch (j) {
389
+ case 0:
390
+ return S.suspend(() =>
391
+ S.Struct({
392
+ organization: S.String.pipe(T.Label()),
393
+ cluster: S.String.pipe(T.Label()),
394
+ replica: S.String.pipe(T.Label()),
395
+ replica_size: S.optional(S.String),
396
+ existing_replicas: S.optional(__S(8, __c1, 0)),
397
+ new_replica: S.optional(__S(8, __c1, 0)),
398
+ }).pipe(
399
+ T.Http({
400
+ method: "POST",
401
+ uri: "/v0/organizations/{organization}/clusters/{cluster}/replicas/{replica}",
402
+ code: 200,
403
+ }),
404
+ ),
405
+ ).annotate({ identifier: "AddOrganizationClusterReplicaByNameRequest" });
406
+ }
407
+ }
408
+ function __c4(j: number): any {
409
+ switch (j) {
410
+ case 0:
411
+ return S.suspend(() =>
412
+ S.Struct({
413
+ organization: S.String.pipe(T.Label()),
414
+ }).pipe(
415
+ T.Http({
416
+ method: "GET",
417
+ uri: "/v0/organizations/{organization}/clusters-configuration",
418
+ code: 200,
419
+ }),
420
+ ),
421
+ ).annotate({ identifier: "GetOrganizationClustersConfigurationRequest" });
422
+ case 1:
423
+ return S.suspend(() =>
424
+ S.Struct({
425
+ name: S.optional(S.String),
426
+ cpu: S.optional(S.Number),
427
+ memory_gb: S.optional(S.Number),
428
+ }),
429
+ ).annotate({
430
+ identifier: "GetOrganizationClustersConfigurationResponseAvailableSizesValueItem",
431
+ });
432
+ case 2:
433
+ return S.Array(__S(33, __c4, 1));
434
+ case 3:
435
+ return S.Record(S.String, __S(34, __c4, 2));
436
+ case 4:
437
+ return S.suspend(() =>
438
+ S.Struct({
439
+ cloud_regions: S.optional(__S(8, __c1, 0)),
440
+ available_sizes: S.optional(__S(35, __c4, 3)),
441
+ available_roles: S.optional(__S(40, __c5, 0)),
442
+ }),
443
+ ).annotate({ identifier: "GetOrganizationClustersConfigurationResponse" });
444
+ }
445
+ }
446
+ function __c5(j: number): any {
447
+ switch (j) {
448
+ case 0:
449
+ return S.Array(S.String);
450
+ }
451
+ }
452
+ function __c6(j: number): any {
453
+ switch (j) {
454
+ case 0:
455
+ return S.suspend(() =>
456
+ S.Struct({
457
+ organization: S.String.pipe(T.Label()),
458
+ }).pipe(
459
+ T.Http({ method: "GET", uri: "/v0/organizations/{organization}/clusters", code: 200 }),
460
+ ),
461
+ ).annotate({ identifier: "ListOrganizationClustersRequest" });
462
+ case 1:
463
+ return S.suspend(() =>
464
+ S.Struct({
465
+ cluster_id: S.optional(S.String),
466
+ cluster_name: S.optional(S.String),
467
+ cloud_provider: S.optional(S.String),
468
+ cloud_region: S.optional(S.String),
469
+ operation_in_progress: S.optional(S.Boolean),
470
+ can_rebalance: S.optional(S.Boolean),
471
+ can_scale: S.optional(S.Boolean),
472
+ cluster_weights: S.optional(__S(8, __c1, 0)),
473
+ replicas: S.optional(__S(8, __c1, 0)),
474
+ error: S.optional(S.NullOr(S.String)),
475
+ ongoing_maintenance: S.optional(S.Boolean),
476
+ clickhouse_version: S.optional(S.NullOr(S.String)),
477
+ available_clickhouse_versions: S.optional(__S(40, __c5, 0)),
478
+ rolling_update_config: S.optional(S.NullOr(__S(8, __c1, 0))),
479
+ }),
480
+ ).annotate({ identifier: "ListOrganizationClustersResponseClustersItem" });
481
+ case 2:
482
+ return S.Array(__S(49, __c6, 1));
483
+ case 3:
484
+ return S.suspend(() =>
485
+ S.Struct({
486
+ clusters: S.optional(__S(50, __c6, 2)),
487
+ }),
488
+ ).annotate({ identifier: "ListOrganizationClustersResponse" });
489
+ }
490
+ }
491
+ function __c7(j: number): any {
492
+ switch (j) {
493
+ case 0:
494
+ return S.suspend(() =>
495
+ S.Struct({
496
+ organization: S.String.pipe(T.Label()),
497
+ cluster: S.String.pipe(T.Label()),
498
+ old_weights: S.optional(__S(8, __c1, 0)),
499
+ new_weights: S.optional(__S(8, __c1, 0)),
500
+ }).pipe(
501
+ T.Http({
502
+ method: "DELETE",
503
+ uri: "/v0/organizations/{organization}/clusters/{cluster}/replicas",
504
+ code: 200,
505
+ }),
506
+ ),
507
+ ).annotate({ identifier: "RemoveOrganizationClusterReplicaRequest" });
508
+ }
509
+ }
510
+ function __c8(j: number): any {
511
+ switch (j) {
512
+ case 0:
513
+ return S.suspend(() =>
514
+ S.Struct({
515
+ organization: S.String.pipe(T.Label()),
516
+ cluster: S.String.pipe(T.Label()),
517
+ replica: S.String.pipe(T.Label()),
518
+ old_weights: S.optional(__S(8, __c1, 0)),
519
+ new_weights: S.optional(__S(8, __c1, 0)),
520
+ }).pipe(
521
+ T.Http({
522
+ method: "DELETE",
523
+ uri: "/v0/organizations/{organization}/clusters/{cluster}/replicas/{replica}",
524
+ code: 200,
525
+ }),
526
+ ),
527
+ ).annotate({ identifier: "RemoveOrganizationClusterReplicaByNameRequest" });
528
+ }
529
+ }
530
+ function __c9(j: number): any {
531
+ switch (j) {
532
+ case 0:
533
+ return S.suspend(() =>
534
+ S.Struct({
535
+ organization: S.String.pipe(T.Label()),
536
+ cluster: S.String.pipe(T.Label()),
537
+ old_weights: S.optional(__S(8, __c1, 0)),
538
+ new_weights: S.optional(__S(8, __c1, 0)),
539
+ }).pipe(
540
+ T.Http({
541
+ method: "PUT",
542
+ uri: "/v0/organizations/{organization}/clusters/{cluster}/weights",
543
+ code: 200,
544
+ }),
545
+ ),
546
+ ).annotate({ identifier: "UpdateOrganizationClusterWeightsRequest" });
547
+ }
548
+ }
549
+ // Schema table: entry i is schema j of builder f, made on first reach.
550
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
551
+ return (__s[i] ??= __L.at(f, j));
552
+ }