@distilled.cloud/clickhouse-cloud 0.0.0-stage → 1.0.0-rc.21

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 (183) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +138 -2
  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 +34 -0
  8. package/lib/credentials.d.ts.map +1 -0
  9. package/lib/credentials.js +1 -0
  10. package/lib/errors.d.ts +58 -0
  11. package/lib/errors.d.ts.map +1 -0
  12. package/lib/errors.js +1 -0
  13. package/lib/index.d.ts +49 -0
  14. package/lib/index.d.ts.map +1 -0
  15. package/lib/index.js +6 -0
  16. package/lib/pagination.d.ts +10 -0
  17. package/lib/pagination.d.ts.map +1 -0
  18. package/lib/pagination.js +1 -0
  19. package/lib/protocol.d.ts +19 -0
  20. package/lib/protocol.d.ts.map +1 -0
  21. package/lib/protocol.js +1 -0
  22. package/lib/retry.d.ts +35 -0
  23. package/lib/retry.d.ts.map +1 -0
  24. package/lib/retry.js +1 -0
  25. package/lib/services/api_keys.d.ts +175 -0
  26. package/lib/services/api_keys.d.ts.map +1 -0
  27. package/lib/services/api_keys.js +2 -0
  28. package/lib/services/api_keys.js.map +1 -0
  29. package/lib/services/backup.d.ts +117 -0
  30. package/lib/services/backup.d.ts.map +1 -0
  31. package/lib/services/backup.js +2 -0
  32. package/lib/services/backup.js.map +1 -0
  33. package/lib/services/billing.d.ts +69 -0
  34. package/lib/services/billing.d.ts.map +1 -0
  35. package/lib/services/billing.js +2 -0
  36. package/lib/services/billing.js.map +1 -0
  37. package/lib/services/click_pipes.d.ts +1637 -0
  38. package/lib/services/click_pipes.d.ts.map +1 -0
  39. package/lib/services/click_pipes.js +31 -0
  40. package/lib/services/click_pipes.js.map +1 -0
  41. package/lib/services/index.d.ts +14 -0
  42. package/lib/services/index.d.ts.map +1 -0
  43. package/lib/services/index.js +13 -0
  44. package/lib/services/organization.d.ts +336 -0
  45. package/lib/services/organization.d.ts.map +1 -0
  46. package/lib/services/organization.js +2 -0
  47. package/lib/services/organization.js.map +1 -0
  48. package/lib/services/postgres.d.ts +726 -0
  49. package/lib/services/postgres.d.ts.map +1 -0
  50. package/lib/services/postgres.js +31 -0
  51. package/lib/services/postgres.js.map +1 -0
  52. package/lib/services/prometheus.d.ts +71 -0
  53. package/lib/services/prometheus.d.ts.map +1 -0
  54. package/lib/services/prometheus.js +2 -0
  55. package/lib/services/prometheus.js.map +1 -0
  56. package/lib/services/query_api_endpoints.d.ts +189 -0
  57. package/lib/services/query_api_endpoints.d.ts.map +1 -0
  58. package/lib/services/query_api_endpoints.js +2 -0
  59. package/lib/services/query_api_endpoints.js.map +1 -0
  60. package/lib/services/role_management.d.ts +159 -0
  61. package/lib/services/role_management.d.ts.map +1 -0
  62. package/lib/services/role_management.js +2 -0
  63. package/lib/services/role_management.js.map +1 -0
  64. package/lib/services/saved_queries.d.ts +129 -0
  65. package/lib/services/saved_queries.d.ts.map +1 -0
  66. package/lib/services/saved_queries.js +2 -0
  67. package/lib/services/saved_queries.js.map +1 -0
  68. package/lib/services/service.d.ts +886 -0
  69. package/lib/services/service.d.ts.map +1 -0
  70. package/lib/services/service.js +41 -0
  71. package/lib/services/service.js.map +1 -0
  72. package/lib/services/udf.d.ts +373 -0
  73. package/lib/services/udf.d.ts.map +1 -0
  74. package/lib/services/udf.js +24 -0
  75. package/lib/services/udf.js.map +1 -0
  76. package/lib/services/user_management.d.ts +150 -0
  77. package/lib/services/user_management.d.ts.map +1 -0
  78. package/lib/services/user_management.js +2 -0
  79. package/lib/services/user_management.js.map +1 -0
  80. package/lib/services.lazy/api_keys.js +1 -0
  81. package/lib/services.lazy/backup.js +1 -0
  82. package/lib/services.lazy/billing.js +1 -0
  83. package/lib/services.lazy/click_pipes.js +3 -0
  84. package/lib/services.lazy/index.js +3 -0
  85. package/lib/services.lazy/organization.js +1 -0
  86. package/lib/services.lazy/postgres.js +4 -0
  87. package/lib/services.lazy/prometheus.js +1 -0
  88. package/lib/services.lazy/query_api_endpoints.js +1 -0
  89. package/lib/services.lazy/role_management.js +1 -0
  90. package/lib/services.lazy/saved_queries.js +1 -0
  91. package/lib/services.lazy/service.js +4 -0
  92. package/lib/services.lazy/udf.js +3 -0
  93. package/lib/services.lazy/user_management.js +1 -0
  94. package/lib/traits.d.ts +11 -0
  95. package/lib/traits.d.ts.map +1 -0
  96. package/lib/traits.js +1 -0
  97. package/lib/unstable-services/backup.d.ts +165 -0
  98. package/lib/unstable-services/backup.d.ts.map +1 -0
  99. package/lib/unstable-services/backup.js +2 -0
  100. package/lib/unstable-services/backup.js.map +1 -0
  101. package/lib/unstable-services/billing.d.ts +84 -0
  102. package/lib/unstable-services/billing.d.ts.map +1 -0
  103. package/lib/unstable-services/billing.js +2 -0
  104. package/lib/unstable-services/billing.js.map +1 -0
  105. package/lib/unstable-services/click_pipes.d.ts +324 -0
  106. package/lib/unstable-services/click_pipes.d.ts.map +1 -0
  107. package/lib/unstable-services/click_pipes.js +2 -0
  108. package/lib/unstable-services/click_pipes.js.map +1 -0
  109. package/lib/unstable-services/click_stack.d.ts +3538 -0
  110. package/lib/unstable-services/click_stack.d.ts.map +1 -0
  111. package/lib/unstable-services/click_stack.js +60 -0
  112. package/lib/unstable-services/click_stack.js.map +1 -0
  113. package/lib/unstable-services/index.d.ts +11 -0
  114. package/lib/unstable-services/index.d.ts.map +1 -0
  115. package/lib/unstable-services/index.js +10 -0
  116. package/lib/unstable-services/notifications.d.ts +166 -0
  117. package/lib/unstable-services/notifications.d.ts.map +1 -0
  118. package/lib/unstable-services/notifications.js +2 -0
  119. package/lib/unstable-services/notifications.js.map +1 -0
  120. package/lib/unstable-services/organization.d.ts +403 -0
  121. package/lib/unstable-services/organization.d.ts.map +1 -0
  122. package/lib/unstable-services/organization.js +26 -0
  123. package/lib/unstable-services/organization.js.map +1 -0
  124. package/lib/unstable-services/postgres.d.ts +415 -0
  125. package/lib/unstable-services/postgres.d.ts.map +1 -0
  126. package/lib/unstable-services/postgres.js +2 -0
  127. package/lib/unstable-services/postgres.js.map +1 -0
  128. package/lib/unstable-services/service.d.ts +244 -0
  129. package/lib/unstable-services/service.d.ts.map +1 -0
  130. package/lib/unstable-services/service.js +2 -0
  131. package/lib/unstable-services/service.js.map +1 -0
  132. package/lib/unstable-services/snapshot.d.ts +146 -0
  133. package/lib/unstable-services/snapshot.d.ts.map +1 -0
  134. package/lib/unstable-services/snapshot.js +2 -0
  135. package/lib/unstable-services/snapshot.js.map +1 -0
  136. package/lib/unstable-services/user_management.d.ts +41 -0
  137. package/lib/unstable-services/user_management.d.ts.map +1 -0
  138. package/lib/unstable-services/user_management.js +2 -0
  139. package/lib/unstable-services/user_management.js.map +1 -0
  140. package/lib/unstable-services.lazy/backup.js +1 -0
  141. package/lib/unstable-services.lazy/billing.js +1 -0
  142. package/lib/unstable-services.lazy/click_pipes.js +1 -0
  143. package/lib/unstable-services.lazy/click_stack.js +4 -0
  144. package/lib/unstable-services.lazy/index.js +3 -0
  145. package/lib/unstable-services.lazy/notifications.js +1 -0
  146. package/lib/unstable-services.lazy/organization.js +4 -0
  147. package/lib/unstable-services.lazy/postgres.js +1 -0
  148. package/lib/unstable-services.lazy/service.js +1 -0
  149. package/lib/unstable-services.lazy/snapshot.js +1 -0
  150. package/lib/unstable-services.lazy/user_management.js +1 -0
  151. package/package.json +94 -3
  152. package/src/credentials.ts +88 -0
  153. package/src/errors.ts +76 -0
  154. package/src/index.ts +53 -0
  155. package/src/pagination.ts +9 -0
  156. package/src/protocol.ts +76 -0
  157. package/src/retry.ts +53 -0
  158. package/src/services/api_keys.ts +466 -0
  159. package/src/services/backup.ts +347 -0
  160. package/src/services/billing.ts +170 -0
  161. package/src/services/click_pipes.ts +3483 -0
  162. package/src/services/index.ts +14 -0
  163. package/src/services/organization.ts +901 -0
  164. package/src/services/postgres.ts +1967 -0
  165. package/src/services/prometheus.ts +271 -0
  166. package/src/services/query_api_endpoints.ts +466 -0
  167. package/src/services/role_management.ts +436 -0
  168. package/src/services/saved_queries.ts +384 -0
  169. package/src/services/service.ts +2112 -0
  170. package/src/services/udf.ts +1019 -0
  171. package/src/services/user_management.ts +508 -0
  172. package/src/traits.ts +45 -0
  173. package/src/unstable-services/backup.ts +422 -0
  174. package/src/unstable-services/billing.ts +232 -0
  175. package/src/unstable-services/click_pipes.ts +702 -0
  176. package/src/unstable-services/click_stack.ts +7114 -0
  177. package/src/unstable-services/index.ts +11 -0
  178. package/src/unstable-services/notifications.ts +451 -0
  179. package/src/unstable-services/organization.ts +1107 -0
  180. package/src/unstable-services/postgres.ts +1061 -0
  181. package/src/unstable-services/service.ts +795 -0
  182. package/src/unstable-services/snapshot.ts +397 -0
  183. package/src/unstable-services/user_management.ts +127 -0
@@ -0,0 +1,397 @@
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 (specs/spec-mirror-clickhouse-cloud/specs/openapi.json). 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 { ClickHouseCloudServiceErrors } from "../errors.ts";
7
+ import { paginateCursor } from "../pagination.ts";
8
+ import {
9
+ ClickHouseCloudProtocol,
10
+ ClickHouseCloudPaginatedProtocol,
11
+ type ClickHouseCloudOpError,
12
+ type ClickHouseCloudOpContext,
13
+ } from "../protocol.ts";
14
+ import * as Retry from "../retry.ts";
15
+ import * as T from "../traits.ts";
16
+ // Schema table, filled on first reach (see __S at the end).
17
+ const __s: any[] = [];
18
+
19
+ export type { ClickHouseCloudOpError, ClickHouseCloudOpContext };
20
+
21
+ /** Span facts shared by every operation (com.distilled.telemetry#service). */
22
+ const TELEMETRY = {
23
+ system: "clickhouse-cloud-api",
24
+ responseHeaders: [
25
+ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
26
+ { header: "request-id", name: "http.response.header.request-id", transform: "list" },
27
+ ],
28
+ prefix: "ClickhouseCloud",
29
+ service: "Snapshots",
30
+ labels: "clickhouse_cloud",
31
+ propagate: "w3c",
32
+ } as const;
33
+
34
+ /** The feature is not available to this organization or service: its plan does not include it, it is not enabled for the organization, or it is not set up. The message says which. */
35
+ export class FeatureUnavailable
36
+ extends /*@__PURE__*/ T.applyErrorMatchers(
37
+ /*@__PURE__*/ S.TaggedError<FeatureUnavailable>()("FeatureUnavailable", {
38
+ message: S.String,
39
+ body: /*@__PURE__*/ S.optional(S.Unknown),
40
+ headers: /*@__PURE__*/ S.optional(/*@__PURE__*/ S.Record(S.String, S.String)),
41
+ }).pipe(C.withAuthError),
42
+ [{ status: 403, message: { includes: "early access API endpoint" } }],
43
+ ) {}
44
+
45
+ export interface GetSnapshotRequest {
46
+ /** ID of the organization that owns the snapshot. */
47
+ organizationId: string;
48
+ /** ID of the service the snapshot was created from. */
49
+ serviceId: string;
50
+ /** ID of the requested snapshot. */
51
+ snapshotId: string;
52
+ }
53
+ /** Status of the snapshot: 'done', 'error', 'in_progress', 'throttled'. 'throttled' means snapshot creation was rate-limited and will be retried. */
54
+ export type SnapshotStatus = "done" | "error" | "in_progress" | "throttled";
55
+ /** Snapshot type. Always "full" -- snapshots never chain off a parent. */
56
+ export type SnapshotType = "full";
57
+ /** Bucket provider */
58
+ export type AwsBackupBucketPropertiesBucketProvider = "AWS";
59
+ export interface AwsBackupBucketProperties {
60
+ /** Bucket provider */
61
+ bucketProvider?: AwsBackupBucketPropertiesBucketProvider | undefined;
62
+ /** Bucket path */
63
+ bucketPath?: string | undefined;
64
+ /** AWS IAM Role */
65
+ iamRoleArn?: string | undefined;
66
+ /** AWS IAM Role */
67
+ iamRoleSessionName?: string | undefined;
68
+ /** External ID the IAM role trust policy requires when the data plane assumes the role */
69
+ iamRoleExternalId?: string | undefined;
70
+ }
71
+ /** Bucket provider */
72
+ export type GcpBackupBucketPropertiesBucketProvider = "GCP";
73
+ export interface GcpBackupBucketProperties {
74
+ /** Bucket provider */
75
+ bucketProvider?: GcpBackupBucketPropertiesBucketProvider | undefined;
76
+ /** Bucket path */
77
+ bucketPath?: string | undefined;
78
+ /** Access Key ID (HMAC key) */
79
+ accessKeyId?: string | undefined;
80
+ }
81
+ /** Bucket provider */
82
+ export type AzureBackupBucketPropertiesBucketProvider = "AZURE";
83
+ export interface AzureBackupBucketProperties {
84
+ /** Bucket provider */
85
+ bucketProvider?: AzureBackupBucketPropertiesBucketProvider | undefined;
86
+ /** Container Name */
87
+ containerName?: string | undefined;
88
+ }
89
+ export type BackupBucketProperties =
90
+ | AwsBackupBucketProperties
91
+ | GcpBackupBucketProperties
92
+ | AzureBackupBucketProperties;
93
+ export interface Snapshot {
94
+ /** Unique snapshot ID. */
95
+ id?: string | undefined;
96
+ /** Status of the snapshot: 'done', 'error', 'in_progress', 'throttled'. 'throttled' means snapshot creation was rate-limited and will be retried. */
97
+ status?: SnapshotStatus | undefined;
98
+ /** ID of the service the snapshot was created from. */
99
+ serviceId?: string | undefined;
100
+ /** Snapshot start timestamp. ISO-8601. */
101
+ startedAt?: string | undefined;
102
+ /** Snapshot finish timestamp. ISO-8601. Available only for finished snapshots */
103
+ finishedAt?: string | undefined;
104
+ /** Size of the snapshot in bytes. */
105
+ sizeInBytes?: number | undefined;
106
+ /** Time in seconds it took to perform the snapshot. If the status is in_progress or throttled, this is the time in seconds since the snapshot started until now. */
107
+ durationInSeconds?: number | undefined;
108
+ /** Snapshot type. Always "full" -- snapshots never chain off a parent. */
109
+ type?: SnapshotType | undefined;
110
+ /** Snapshot name on the external backup bucket. */
111
+ backupName?: string | undefined;
112
+ /** Backup bucket where the snapshot is stored. */
113
+ bucket?: BackupBucketProperties | undefined;
114
+ }
115
+ export interface GetSnapshotConfigurationRequest {
116
+ /** ID of the organization that owns the service. */
117
+ organizationId: string;
118
+ /** ID of the service. */
119
+ serviceId: string;
120
+ }
121
+ export interface SnapshotConfiguration {
122
+ /** Whether scheduled snapshots are enabled for the service. */
123
+ enabled?: boolean | undefined;
124
+ /** Interval between snapshots, in minutes. One of 10, 20, 30, 60. Validated when an enabled configuration is saved; stored values are not re-validated on read. */
125
+ gap?: number | undefined;
126
+ /** Retention window the snapshots cover, in minutes. A whole number of days (a multiple of 1440), at least 1440; timeFrame / gap must not exceed 300 snapshots. Validated when an enabled configuration is saved; stored values are not re-validated on read. */
127
+ timeFrame?: number | undefined;
128
+ }
129
+ export interface ListSnapshotsRequest {
130
+ /** ID of the organization that owns the snapshot. */
131
+ organizationId: string;
132
+ /** ID of the service the snapshot was created from. */
133
+ serviceId: string;
134
+ /** Maximum number of results to return. */
135
+ limit?: number | undefined;
136
+ /** Opaque cursor from a previous response's `nextCursor`, marking where to resume the list. */
137
+ cursor?: string | undefined;
138
+ }
139
+ export type ListSnapshotsResponseResultList = Array<Snapshot>;
140
+ export interface ListSnapshotsResponse {
141
+ /** HTTP status code. */
142
+ status?: number | undefined;
143
+ /** Unique id assigned to every request. UUIDv4 */
144
+ requestId?: string | undefined;
145
+ result: ListSnapshotsResponseResultList;
146
+ /** Maximum number of results returned in this page. */
147
+ limit?: number | undefined;
148
+ /** Total number of results across all pages. It has only informative value, thus is not guaranteed and it is provided on a best-effort basis. Null if the total count is unknown. */
149
+ totalCount?: number | null | undefined;
150
+ /** Cursor for the next page, to be sent as the `cursor` query parameter. Null on the last page. */
151
+ nextCursor?: string | null | undefined;
152
+ }
153
+ export interface UpdateSnapshotConfigurationRequest {
154
+ /** ID of the organization that owns the service. */
155
+ organizationId: string;
156
+ /** ID of the service. */
157
+ serviceId: string;
158
+ /** Whether scheduled snapshots are enabled for the service. */
159
+ enabled?: boolean | undefined;
160
+ /** Interval between snapshots, in minutes. One of 10, 20, 30, 60. Validated when an enabled configuration is saved; stored values are not re-validated on read. */
161
+ gap?: number | undefined;
162
+ /** Retention window the snapshots cover, in minutes. A whole number of days (a multiple of 1440), at least 1440; timeFrame / gap must not exceed 300 snapshots. Validated when an enabled configuration is saved; stored values are not re-validated on read. */
163
+ timeFrame?: number | undefined;
164
+ }
165
+ export type GetSnapshotError = FeatureUnavailable | ClickHouseCloudOpError;
166
+ /** Get snapshot details **This endpoint is in beta.** API contract is stable, and no breaking changes are expected in the future. <br /><br /> Returns a single snapshot info. */
167
+ export const getSnapshot: API.OperationMethod<
168
+ GetSnapshotRequest,
169
+ Snapshot,
170
+ GetSnapshotError,
171
+ ClickHouseCloudOpContext
172
+ > = /*@__PURE__*/ API.make(() => ({
173
+ input: __S(0, __c0, 0) as any as S.Schema<GetSnapshotRequest>,
174
+ output: __S(12, __c1, 4) as any as S.Schema<Snapshot>,
175
+ errors: [FeatureUnavailable],
176
+ serviceErrors: ClickHouseCloudServiceErrors,
177
+ protocol: ClickHouseCloudProtocol,
178
+ retry: Retry.Retry,
179
+ telemetry: TELEMETRY,
180
+ span: "GetSnapshot",
181
+ }));
182
+
183
+ export type GetSnapshotConfigurationError = FeatureUnavailable | ClickHouseCloudOpError;
184
+ /** Get service snapshot configuration **This endpoint is in beta.** API contract is stable, and no breaking changes are expected in the future. <br /><br /> Returns the service snapshot configuration. */
185
+ export const getSnapshotConfiguration: API.OperationMethod<
186
+ GetSnapshotConfigurationRequest,
187
+ SnapshotConfiguration,
188
+ GetSnapshotConfigurationError,
189
+ ClickHouseCloudOpContext
190
+ > = /*@__PURE__*/ API.make(() => ({
191
+ input: __S(16, __c2, 0) as any as S.Schema<GetSnapshotConfigurationRequest>,
192
+ output: __S(24, __c3, 0) as any as S.Schema<SnapshotConfiguration>,
193
+ errors: [FeatureUnavailable],
194
+ serviceErrors: ClickHouseCloudServiceErrors,
195
+ protocol: ClickHouseCloudProtocol,
196
+ retry: Retry.Retry,
197
+ telemetry: TELEMETRY,
198
+ span: "GetSnapshotConfiguration",
199
+ }));
200
+
201
+ export type ListSnapshotsError = FeatureUnavailable | ClickHouseCloudOpError;
202
+ /** List of service snapshots **This endpoint is in beta.** API contract is stable, and no breaking changes are expected in the future. <br /><br /> Returns a list of snapshots for the service, most recent first. Results are capped at `limit` (default 250) per page; the server may return fewer and caps the value at its own maximum. Every response carries `limit`, `totalCount` and `nextCursor`; pass `nextCursor` as the `cursor` query parameter to fetch the next page, repeating until it is null. */
203
+ export const listSnapshots: API.PaginatedOperationMethod<
204
+ ListSnapshotsRequest,
205
+ ListSnapshotsResponse,
206
+ ListSnapshotsError,
207
+ ClickHouseCloudOpContext,
208
+ Snapshot
209
+ > = /*@__PURE__*/ API.makePaginated(
210
+ () => ({
211
+ input: __S(32, __c4, 0) as any as S.Schema<ListSnapshotsRequest>,
212
+ output: __S(34, __c4, 2) as any as S.Schema<ListSnapshotsResponse>,
213
+ errors: [FeatureUnavailable],
214
+ serviceErrors: ClickHouseCloudServiceErrors,
215
+ protocol: ClickHouseCloudPaginatedProtocol,
216
+ retry: Retry.Retry,
217
+ telemetry: TELEMETRY,
218
+ span: "ListSnapshots",
219
+ pagination: {
220
+ mode: "cursor",
221
+ inputToken: "cursor",
222
+ outputToken: "nextCursor",
223
+ items: "result",
224
+ pageSize: "limit",
225
+ } as const,
226
+ }),
227
+ paginateCursor,
228
+ ) as any;
229
+
230
+ export type UpdateSnapshotConfigurationError = FeatureUnavailable | ClickHouseCloudOpError;
231
+ /** Update service snapshot configuration **This endpoint is in beta.** API contract is stable, and no breaking changes are expected in the future. <br /><br /> Updates the service snapshot configuration. Requires ADMIN auth key role. Enables or disables scheduled snapshots and sets the cadence; when enabled, the resulting configuration (in minutes) must satisfy: gap must be one of 10, 20, 30, 60; timeFrame must be a whole number of days (a multiple of 1440), at least 1440; and timeFrame / gap (the number of snapshots the configuration keeps) must not exceed 300. Provide at least one of enabled, gap, timeFrame; omit a field to leave it unchanged (null is not accepted). Gap or timeFrame may be changed on its own; the rules are checked against the configuration that results from merging the request into the stored one. After a change to gap or timeFrame, snapshots taken under the previous configuration expire by the new timeFrame, and cleanup also deletes the oldest snapshots beyond the limit of 300, including ones still inside the new timeFrame. Enabling snapshots or changing the cadence requires an eligible organization (see the organization's capabilities.snapshots). */
232
+ export const updateSnapshotConfiguration: API.OperationMethod<
233
+ UpdateSnapshotConfigurationRequest,
234
+ SnapshotConfiguration,
235
+ UpdateSnapshotConfigurationError,
236
+ ClickHouseCloudOpContext
237
+ > = /*@__PURE__*/ API.make(() => ({
238
+ input: __S(40, __c5, 0) as any as S.Schema<UpdateSnapshotConfigurationRequest>,
239
+ output: __S(24, __c3, 0) as any as S.Schema<SnapshotConfiguration>,
240
+ errors: [FeatureUnavailable],
241
+ serviceErrors: ClickHouseCloudServiceErrors,
242
+ protocol: ClickHouseCloudProtocol,
243
+ retry: Retry.Retry,
244
+ telemetry: TELEMETRY,
245
+ span: "UpdateSnapshotConfiguration",
246
+ }));
247
+
248
+ // Schema builders: each runs one schema initializer, on that schema's first use.
249
+ function __c0(j: number): any {
250
+ switch (j) {
251
+ case 0:
252
+ return S.suspend(() =>
253
+ S.Struct({
254
+ organizationId: S.String.pipe(T.Label()),
255
+ serviceId: S.String.pipe(T.Label()),
256
+ snapshotId: S.String.pipe(T.Label()),
257
+ }).pipe(
258
+ T.Http({
259
+ method: "GET",
260
+ uri: "/v1/organizations/{organizationId}/services/{serviceId}/snapshots/{snapshotId}",
261
+ code: 200,
262
+ }),
263
+ ),
264
+ ).annotate({ identifier: "GetSnapshotRequest" });
265
+ }
266
+ }
267
+ function __c1(j: number): any {
268
+ switch (j) {
269
+ case 0:
270
+ return S.suspend(() =>
271
+ S.Struct({
272
+ bucketProvider: S.optional(S.String),
273
+ bucketPath: S.optional(S.String),
274
+ iamRoleArn: S.optional(S.String),
275
+ iamRoleSessionName: S.optional(S.String),
276
+ iamRoleExternalId: S.optional(S.String),
277
+ }),
278
+ ).annotate({ identifier: "AwsBackupBucketProperties" });
279
+ case 1:
280
+ return S.suspend(() =>
281
+ S.Struct({
282
+ bucketProvider: S.optional(S.String),
283
+ bucketPath: S.optional(S.String),
284
+ accessKeyId: S.optional(S.String),
285
+ }),
286
+ ).annotate({ identifier: "GcpBackupBucketProperties" });
287
+ case 2:
288
+ return S.suspend(() =>
289
+ S.Struct({
290
+ bucketProvider: S.optional(S.String),
291
+ containerName: S.optional(S.String),
292
+ }),
293
+ ).annotate({ identifier: "AzureBackupBucketProperties" });
294
+ case 3:
295
+ return S.Union([__S(8, __c1, 0), __S(9, __c1, 1), __S(10, __c1, 2)]);
296
+ case 4:
297
+ return S.suspend(() =>
298
+ S.Struct({
299
+ id: S.optional(S.String),
300
+ status: S.optional(S.String),
301
+ serviceId: S.optional(S.String),
302
+ startedAt: S.optional(S.String),
303
+ finishedAt: S.optional(S.String),
304
+ sizeInBytes: S.optional(S.Number),
305
+ durationInSeconds: S.optional(S.Number),
306
+ type: S.optional(S.String),
307
+ backupName: S.optional(S.String),
308
+ bucket: S.optional(__S(11, __c1, 3)),
309
+ }),
310
+ ).annotate({ identifier: "Snapshot" });
311
+ }
312
+ }
313
+ function __c2(j: number): any {
314
+ switch (j) {
315
+ case 0:
316
+ return S.suspend(() =>
317
+ S.Struct({
318
+ organizationId: S.String.pipe(T.Label()),
319
+ serviceId: S.String.pipe(T.Label()),
320
+ }).pipe(
321
+ T.Http({
322
+ method: "GET",
323
+ uri: "/v1/organizations/{organizationId}/services/{serviceId}/snapshotConfiguration",
324
+ code: 200,
325
+ }),
326
+ ),
327
+ ).annotate({ identifier: "GetSnapshotConfigurationRequest" });
328
+ }
329
+ }
330
+ function __c3(j: number): any {
331
+ switch (j) {
332
+ case 0:
333
+ return S.suspend(() =>
334
+ S.Struct({
335
+ enabled: S.optional(S.Boolean),
336
+ gap: S.optional(S.Number),
337
+ timeFrame: S.optional(S.Number),
338
+ }),
339
+ ).annotate({ identifier: "SnapshotConfiguration" });
340
+ }
341
+ }
342
+ function __c4(j: number): any {
343
+ switch (j) {
344
+ case 0:
345
+ return S.suspend(() =>
346
+ S.Struct({
347
+ organizationId: S.String.pipe(T.Label()),
348
+ serviceId: S.String.pipe(T.Label()),
349
+ limit: S.optional(S.Number.pipe(T.Query())),
350
+ cursor: S.optional(S.String.pipe(T.Query())),
351
+ }).pipe(
352
+ T.Http({
353
+ method: "GET",
354
+ uri: "/v1/organizations/{organizationId}/services/{serviceId}/snapshots",
355
+ code: 200,
356
+ }),
357
+ ),
358
+ ).annotate({ identifier: "ListSnapshotsRequest" });
359
+ case 1:
360
+ return S.Array(__S(12, __c1, 4));
361
+ case 2:
362
+ return S.suspend(() =>
363
+ S.Struct({
364
+ status: S.optional(S.Number),
365
+ requestId: S.optional(S.String),
366
+ result: __S(33, __c4, 1),
367
+ limit: S.optional(S.Number),
368
+ totalCount: S.optional(S.NullOr(S.Number)),
369
+ nextCursor: S.optional(S.NullOr(S.String)),
370
+ }),
371
+ ).annotate({ identifier: "ListSnapshotsResponse" });
372
+ }
373
+ }
374
+ function __c5(j: number): any {
375
+ switch (j) {
376
+ case 0:
377
+ return S.suspend(() =>
378
+ S.Struct({
379
+ organizationId: S.String.pipe(T.Label()),
380
+ serviceId: S.String.pipe(T.Label()),
381
+ enabled: S.optional(S.Boolean),
382
+ gap: S.optional(S.Number),
383
+ timeFrame: S.optional(S.Number),
384
+ }).pipe(
385
+ T.Http({
386
+ method: "PATCH",
387
+ uri: "/v1/organizations/{organizationId}/services/{serviceId}/snapshotConfiguration",
388
+ code: 200,
389
+ }),
390
+ ),
391
+ ).annotate({ identifier: "UpdateSnapshotConfigurationRequest" });
392
+ }
393
+ }
394
+ // Schema table: entry i is schema j of builder f, made on first reach.
395
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
396
+ return (__s[i] ??= __L.at(f, j));
397
+ }
@@ -0,0 +1,127 @@
1
+ import * as API from "@distilled.cloud/core/api";
2
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/spec-mirror-clickhouse-cloud/specs/openapi.json). 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 { ClickHouseCloudServiceErrors } from "../errors.ts";
6
+ import {
7
+ ClickHouseCloudProtocol,
8
+ type ClickHouseCloudOpError,
9
+ type ClickHouseCloudOpContext,
10
+ } from "../protocol.ts";
11
+ import * as Retry from "../retry.ts";
12
+ import * as T from "../traits.ts";
13
+ // Schema table, filled on first reach (see __S at the end).
14
+ const __s: any[] = [];
15
+
16
+ export type { ClickHouseCloudOpError, ClickHouseCloudOpContext };
17
+
18
+ /** Span facts shared by every operation (com.distilled.telemetry#service). */
19
+ const TELEMETRY = {
20
+ system: "clickhouse-cloud-api",
21
+ responseHeaders: [
22
+ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
23
+ { header: "request-id", name: "http.response.header.request-id", transform: "list" },
24
+ ],
25
+ prefix: "ClickhouseCloud",
26
+ service: "UserManagement",
27
+ propagate: "w3c",
28
+ } as const;
29
+
30
+ export interface GetWhoamiRequest {}
31
+ export interface WhoamiOrganization {
32
+ /** ID of the organization the user belongs to. */
33
+ organizationId: string;
34
+ /** Name of the organization. */
35
+ organizationName: string;
36
+ }
37
+ /** Organizations the user belongs to. */
38
+ export type WhoamiUserOrganizationsList = Array<WhoamiOrganization>;
39
+ export interface WhoamiUser {
40
+ /** Discriminator identifying the caller as a user (JWT or clickhousectl token). */
41
+ actorType: string;
42
+ /** Unique ID of the user. */
43
+ userId: string;
44
+ /** Email address of the user. */
45
+ email: string;
46
+ /** Full name of the user. */
47
+ name: string;
48
+ /** Organizations the user belongs to. */
49
+ organizations: WhoamiUserOrganizationsList;
50
+ }
51
+ export interface WhoamiApiKey {
52
+ /** Discriminator identifying the caller as an organization API key. */
53
+ actorType: string;
54
+ /** Unique ID of the API key. */
55
+ keyId: string;
56
+ /** Name of the API key. */
57
+ name: string;
58
+ /** ID of the organization that owns the API key. */
59
+ organizationId: string;
60
+ }
61
+ export type Whoami = WhoamiUser | WhoamiApiKey;
62
+ export type GetWhoamiResponse = Whoami;
63
+ export type GetWhoamiError = ClickHouseCloudOpError;
64
+ /** Resolve the caller identity **Disclaimer:** This beta endpoint is evolving; the API contract may change. <br /><br /> Returns the identity of the authenticated caller. For a user (JWT or clickhousectl token) the result carries the user fields; for an organization API key it carries the key fields instead. Use `actorType` to tell the two apart. */
65
+ export const getWhoami: API.OperationMethod<
66
+ GetWhoamiRequest,
67
+ GetWhoamiResponse,
68
+ GetWhoamiError,
69
+ ClickHouseCloudOpContext
70
+ > = /*@__PURE__*/ API.make(() => ({
71
+ input: __S(0, __c0, 0) as any as S.Schema<GetWhoamiRequest>,
72
+ output: __S(6, __c0, 6) as any as S.Schema<GetWhoamiResponse>,
73
+ errors: [],
74
+ serviceErrors: ClickHouseCloudServiceErrors,
75
+ protocol: ClickHouseCloudProtocol,
76
+ retry: Retry.Retry,
77
+ telemetry: TELEMETRY,
78
+ span: "GetWhoami",
79
+ }));
80
+
81
+ // Schema builders: each runs one schema initializer, on that schema's first use.
82
+ function __c0(j: number): any {
83
+ switch (j) {
84
+ case 0:
85
+ return S.suspend(() =>
86
+ S.Struct({}).pipe(T.Http({ method: "GET", uri: "/v1/whoami", code: 200 })),
87
+ ).annotate({ identifier: "GetWhoamiRequest" });
88
+ case 1:
89
+ return S.suspend(() =>
90
+ S.Struct({
91
+ organizationId: S.String,
92
+ organizationName: S.String,
93
+ }),
94
+ ).annotate({ identifier: "WhoamiOrganization" });
95
+ case 2:
96
+ return S.Array(__S(1, __c0, 1));
97
+ case 3:
98
+ return S.suspend(() =>
99
+ S.Struct({
100
+ actorType: S.String,
101
+ userId: S.String,
102
+ email: S.String,
103
+ name: S.String,
104
+ organizations: __S(2, __c0, 2),
105
+ }),
106
+ ).annotate({ identifier: "WhoamiUser" });
107
+ case 4:
108
+ return S.suspend(() =>
109
+ S.Struct({
110
+ actorType: S.String,
111
+ keyId: S.String,
112
+ name: S.String,
113
+ organizationId: S.String,
114
+ }),
115
+ ).annotate({ identifier: "WhoamiApiKey" });
116
+ case 5:
117
+ return S.Union([__S(3, __c0, 3), __S(4, __c0, 4)]);
118
+ case 6:
119
+ return S.suspend(() => __S(5, __c0, 5).pipe(T.RawResponseRoot())).annotate({
120
+ identifier: "GetWhoamiResponse",
121
+ });
122
+ }
123
+ }
124
+ // Schema table: entry i is schema j of builder f, made on first reach.
125
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
126
+ return (__s[i] ??= __L.at(f, j));
127
+ }