@distilled.cloud/clickhouse-cloud 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.
- package/LICENSE +201 -0
- package/README.md +134 -4
- package/lib/.lazy.json +1 -0
- package/lib/_bundle/lazy.js +4 -0
- package/lib/_bundle/sdk.js +2 -0
- package/lib/_bundle/sdk.js.map +1 -0
- package/lib/credentials.d.ts +34 -0
- package/lib/credentials.d.ts.map +1 -0
- package/lib/credentials.js +1 -0
- package/lib/errors.d.ts +58 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +1 -0
- package/lib/index.d.ts +49 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +6 -0
- package/lib/pagination.d.ts +10 -0
- package/lib/pagination.d.ts.map +1 -0
- package/lib/pagination.js +1 -0
- package/lib/protocol.d.ts +19 -0
- package/lib/protocol.d.ts.map +1 -0
- package/lib/protocol.js +1 -0
- package/lib/retry.d.ts +35 -0
- package/lib/retry.d.ts.map +1 -0
- package/lib/retry.js +1 -0
- package/lib/services/api_keys.d.ts +175 -0
- package/lib/services/api_keys.d.ts.map +1 -0
- package/lib/services/api_keys.js +2 -0
- package/lib/services/api_keys.js.map +1 -0
- package/lib/services/backup.d.ts +117 -0
- package/lib/services/backup.d.ts.map +1 -0
- package/lib/services/backup.js +2 -0
- package/lib/services/backup.js.map +1 -0
- package/lib/services/billing.d.ts +69 -0
- package/lib/services/billing.d.ts.map +1 -0
- package/lib/services/billing.js +2 -0
- package/lib/services/billing.js.map +1 -0
- package/lib/services/click_pipes.d.ts +1637 -0
- package/lib/services/click_pipes.d.ts.map +1 -0
- package/lib/services/click_pipes.js +31 -0
- package/lib/services/click_pipes.js.map +1 -0
- package/lib/services/index.d.ts +14 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +13 -0
- package/lib/services/organization.d.ts +336 -0
- package/lib/services/organization.d.ts.map +1 -0
- package/lib/services/organization.js +2 -0
- package/lib/services/organization.js.map +1 -0
- package/lib/services/postgres.d.ts +726 -0
- package/lib/services/postgres.d.ts.map +1 -0
- package/lib/services/postgres.js +31 -0
- package/lib/services/postgres.js.map +1 -0
- package/lib/services/prometheus.d.ts +71 -0
- package/lib/services/prometheus.d.ts.map +1 -0
- package/lib/services/prometheus.js +2 -0
- package/lib/services/prometheus.js.map +1 -0
- package/lib/services/query_api_endpoints.d.ts +189 -0
- package/lib/services/query_api_endpoints.d.ts.map +1 -0
- package/lib/services/query_api_endpoints.js +2 -0
- package/lib/services/query_api_endpoints.js.map +1 -0
- package/lib/services/role_management.d.ts +159 -0
- package/lib/services/role_management.d.ts.map +1 -0
- package/lib/services/role_management.js +2 -0
- package/lib/services/role_management.js.map +1 -0
- package/lib/services/saved_queries.d.ts +129 -0
- package/lib/services/saved_queries.d.ts.map +1 -0
- package/lib/services/saved_queries.js +2 -0
- package/lib/services/saved_queries.js.map +1 -0
- package/lib/services/service.d.ts +886 -0
- package/lib/services/service.d.ts.map +1 -0
- package/lib/services/service.js +41 -0
- package/lib/services/service.js.map +1 -0
- package/lib/services/udf.d.ts +373 -0
- package/lib/services/udf.d.ts.map +1 -0
- package/lib/services/udf.js +24 -0
- package/lib/services/udf.js.map +1 -0
- package/lib/services/user_management.d.ts +150 -0
- package/lib/services/user_management.d.ts.map +1 -0
- package/lib/services/user_management.js +2 -0
- package/lib/services/user_management.js.map +1 -0
- package/lib/services.lazy/api_keys.js +1 -0
- package/lib/services.lazy/backup.js +1 -0
- package/lib/services.lazy/billing.js +1 -0
- package/lib/services.lazy/click_pipes.js +3 -0
- package/lib/services.lazy/index.js +3 -0
- package/lib/services.lazy/organization.js +1 -0
- package/lib/services.lazy/postgres.js +4 -0
- package/lib/services.lazy/prometheus.js +1 -0
- package/lib/services.lazy/query_api_endpoints.js +1 -0
- package/lib/services.lazy/role_management.js +1 -0
- package/lib/services.lazy/saved_queries.js +1 -0
- package/lib/services.lazy/service.js +4 -0
- package/lib/services.lazy/udf.js +3 -0
- package/lib/services.lazy/user_management.js +1 -0
- package/lib/traits.d.ts +11 -0
- package/lib/traits.d.ts.map +1 -0
- package/lib/traits.js +1 -0
- package/lib/unstable-services/backup.d.ts +165 -0
- package/lib/unstable-services/backup.d.ts.map +1 -0
- package/lib/unstable-services/backup.js +2 -0
- package/lib/unstable-services/backup.js.map +1 -0
- package/lib/unstable-services/billing.d.ts +84 -0
- package/lib/unstable-services/billing.d.ts.map +1 -0
- package/lib/unstable-services/billing.js +2 -0
- package/lib/unstable-services/billing.js.map +1 -0
- package/lib/unstable-services/click_pipes.d.ts +324 -0
- package/lib/unstable-services/click_pipes.d.ts.map +1 -0
- package/lib/unstable-services/click_pipes.js +2 -0
- package/lib/unstable-services/click_pipes.js.map +1 -0
- package/lib/unstable-services/click_stack.d.ts +3538 -0
- package/lib/unstable-services/click_stack.d.ts.map +1 -0
- package/lib/unstable-services/click_stack.js +60 -0
- package/lib/unstable-services/click_stack.js.map +1 -0
- package/lib/unstable-services/index.d.ts +11 -0
- package/lib/unstable-services/index.d.ts.map +1 -0
- package/lib/unstable-services/index.js +10 -0
- package/lib/unstable-services/notifications.d.ts +166 -0
- package/lib/unstable-services/notifications.d.ts.map +1 -0
- package/lib/unstable-services/notifications.js +2 -0
- package/lib/unstable-services/notifications.js.map +1 -0
- package/lib/unstable-services/organization.d.ts +403 -0
- package/lib/unstable-services/organization.d.ts.map +1 -0
- package/lib/unstable-services/organization.js +26 -0
- package/lib/unstable-services/organization.js.map +1 -0
- package/lib/unstable-services/postgres.d.ts +415 -0
- package/lib/unstable-services/postgres.d.ts.map +1 -0
- package/lib/unstable-services/postgres.js +2 -0
- package/lib/unstable-services/postgres.js.map +1 -0
- package/lib/unstable-services/service.d.ts +244 -0
- package/lib/unstable-services/service.d.ts.map +1 -0
- package/lib/unstable-services/service.js +2 -0
- package/lib/unstable-services/service.js.map +1 -0
- package/lib/unstable-services/snapshot.d.ts +146 -0
- package/lib/unstable-services/snapshot.d.ts.map +1 -0
- package/lib/unstable-services/snapshot.js +2 -0
- package/lib/unstable-services/snapshot.js.map +1 -0
- package/lib/unstable-services/user_management.d.ts +41 -0
- package/lib/unstable-services/user_management.d.ts.map +1 -0
- package/lib/unstable-services/user_management.js +2 -0
- package/lib/unstable-services/user_management.js.map +1 -0
- package/lib/unstable-services.lazy/backup.js +1 -0
- package/lib/unstable-services.lazy/billing.js +1 -0
- package/lib/unstable-services.lazy/click_pipes.js +1 -0
- package/lib/unstable-services.lazy/click_stack.js +4 -0
- package/lib/unstable-services.lazy/index.js +3 -0
- package/lib/unstable-services.lazy/notifications.js +1 -0
- package/lib/unstable-services.lazy/organization.js +4 -0
- package/lib/unstable-services.lazy/postgres.js +1 -0
- package/lib/unstable-services.lazy/service.js +1 -0
- package/lib/unstable-services.lazy/snapshot.js +1 -0
- package/lib/unstable-services.lazy/user_management.js +1 -0
- package/package.json +89 -2
- package/src/credentials.ts +88 -0
- package/src/errors.ts +76 -0
- package/src/index.ts +53 -0
- package/src/pagination.ts +9 -0
- package/src/protocol.ts +76 -0
- package/src/retry.ts +53 -0
- package/src/services/api_keys.ts +466 -0
- package/src/services/backup.ts +347 -0
- package/src/services/billing.ts +170 -0
- package/src/services/click_pipes.ts +3483 -0
- package/src/services/index.ts +14 -0
- package/src/services/organization.ts +901 -0
- package/src/services/postgres.ts +1967 -0
- package/src/services/prometheus.ts +271 -0
- package/src/services/query_api_endpoints.ts +466 -0
- package/src/services/role_management.ts +436 -0
- package/src/services/saved_queries.ts +384 -0
- package/src/services/service.ts +2112 -0
- package/src/services/udf.ts +1019 -0
- package/src/services/user_management.ts +508 -0
- package/src/traits.ts +45 -0
- package/src/unstable-services/backup.ts +422 -0
- package/src/unstable-services/billing.ts +232 -0
- package/src/unstable-services/click_pipes.ts +702 -0
- package/src/unstable-services/click_stack.ts +7114 -0
- package/src/unstable-services/index.ts +11 -0
- package/src/unstable-services/notifications.ts +451 -0
- package/src/unstable-services/organization.ts +1107 -0
- package/src/unstable-services/postgres.ts +1061 -0
- package/src/unstable-services/service.ts +795 -0
- package/src/unstable-services/snapshot.ts +397 -0
- package/src/unstable-services/user_management.ts +127 -0
|
@@ -0,0 +1,466 @@
|
|
|
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 type * as Redacted from "effect/Redacted";
|
|
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: "ApiKeys",
|
|
30
|
+
labels: "clickhouse_cloud",
|
|
31
|
+
propagate: "w3c",
|
|
32
|
+
} as const;
|
|
33
|
+
|
|
34
|
+
/** Initial state of the key: 'enabled', 'disabled'. If not provided the new key will be 'enabled'. */
|
|
35
|
+
export type CreateApiKeyRequestState = "enabled" | "disabled";
|
|
36
|
+
export interface ApiKeyHashData {
|
|
37
|
+
/** Hash of the key ID. */
|
|
38
|
+
keyIdHash?: string | undefined;
|
|
39
|
+
/** Last 4 digits of the key ID. Algorithm: echo -n "yourpassword" | sha256sum | tr -d '-' | xxd -r -p | base64 */
|
|
40
|
+
keyIdSuffix?: string | undefined;
|
|
41
|
+
/** Hash of the key secret. Algorithm: echo -n "yourpassword" | sha256sum | tr -d '-' | xxd -r -p | base64 */
|
|
42
|
+
keySecretHash?: string | Redacted.Redacted<string> | undefined;
|
|
43
|
+
}
|
|
44
|
+
export type CreateApiKeyRequestRolesItem = "admin" | "developer" | "query_endpoints";
|
|
45
|
+
/** DEPRECATED. Use `assignedRoleIds` instead. List of roles assigned to the key. Contains at least 1 element. */
|
|
46
|
+
export type CreateApiKeyRequestRolesList = Array<CreateApiKeyRequestRolesItem | (string & {})>;
|
|
47
|
+
/** Array of role UUIDs to assign to the API key */
|
|
48
|
+
export type CreateApiKeyRequestAssignedRoleIdsList = Array<string>;
|
|
49
|
+
export interface IpAccessListEntry {
|
|
50
|
+
/** IP or CIDR */
|
|
51
|
+
source?: string | undefined;
|
|
52
|
+
/** Optional description of IPv4 address or IPv4 CIDR to allow access from */
|
|
53
|
+
description?: string | undefined;
|
|
54
|
+
}
|
|
55
|
+
/** List of IP addresses allowed to access the API using this key */
|
|
56
|
+
export type CreateApiKeyRequestIpAccessListList = Array<IpAccessListEntry>;
|
|
57
|
+
export interface CreateApiKeyRequest {
|
|
58
|
+
/** ID of the organization that will own the key. */
|
|
59
|
+
organizationId: string;
|
|
60
|
+
/** Name of the key. */
|
|
61
|
+
name: string;
|
|
62
|
+
/** Timestamp the key expires. If not present, `null` or is empty the key never expires. ISO-8601. */
|
|
63
|
+
expireAt?: string | null | undefined;
|
|
64
|
+
/** Initial state of the key: 'enabled', 'disabled'. If not provided the new key will be 'enabled'. */
|
|
65
|
+
state?: CreateApiKeyRequestState | (string & {}) | undefined;
|
|
66
|
+
hashData?: ApiKeyHashData | undefined;
|
|
67
|
+
/** DEPRECATED. Use `assignedRoleIds` instead. List of roles assigned to the key. Contains at least 1 element. */
|
|
68
|
+
roles?: CreateApiKeyRequestRolesList | undefined;
|
|
69
|
+
/** Array of role UUIDs to assign to the API key */
|
|
70
|
+
assignedRoleIds?: CreateApiKeyRequestAssignedRoleIdsList | undefined;
|
|
71
|
+
/** List of IP addresses allowed to access the API using this key */
|
|
72
|
+
ipAccessList?: CreateApiKeyRequestIpAccessListList | undefined;
|
|
73
|
+
}
|
|
74
|
+
/** State of the key: 'enabled', 'disabled'. */
|
|
75
|
+
export type ApiKeyState = "enabled" | "disabled";
|
|
76
|
+
export type ApiKeyRolesItem = "admin" | "developer" | "query_endpoints";
|
|
77
|
+
/** DEPRECATED. Use `assignedRoles` instead. List of roles assigned to the key. For organizations that have migrated to custom roles, this field is frozen at the pre-migration value and does not reflect current role assignments. */
|
|
78
|
+
export type ApiKeyRolesList = Array<ApiKeyRolesItem>;
|
|
79
|
+
/** Type of role: system (predefined) or custom (organization-defined) */
|
|
80
|
+
export type AssignedRoleRoleType = "system" | "custom";
|
|
81
|
+
export interface AssignedRole {
|
|
82
|
+
/** Unique identifier of the role */
|
|
83
|
+
roleId?: string | undefined;
|
|
84
|
+
/** Human-readable name of the role */
|
|
85
|
+
roleName?: string | undefined;
|
|
86
|
+
/** Type of role: system (predefined) or custom (organization-defined) */
|
|
87
|
+
roleType?: AssignedRoleRoleType | undefined;
|
|
88
|
+
}
|
|
89
|
+
/** Custom roles and System roles assigned to this API key */
|
|
90
|
+
export type ApiKeyAssignedRolesList = Array<AssignedRole>;
|
|
91
|
+
/** List of IP addresses allowed to access the API using this key */
|
|
92
|
+
export type ApiKeyIpAccessListList = Array<IpAccessListEntry>;
|
|
93
|
+
export interface ApiKey {
|
|
94
|
+
/** Unique API key ID. */
|
|
95
|
+
id: string;
|
|
96
|
+
/** Name of the key */
|
|
97
|
+
name?: string | undefined;
|
|
98
|
+
/** State of the key: 'enabled', 'disabled'. */
|
|
99
|
+
state?: ApiKeyState | undefined;
|
|
100
|
+
/** DEPRECATED. Use `assignedRoles` instead. List of roles assigned to the key. For organizations that have migrated to custom roles, this field is frozen at the pre-migration value and does not reflect current role assignments. */
|
|
101
|
+
roles?: ApiKeyRolesList | undefined;
|
|
102
|
+
/** Custom roles and System roles assigned to this API key */
|
|
103
|
+
assignedRoles?: ApiKeyAssignedRolesList | undefined;
|
|
104
|
+
/** Last 4 letters of the key. */
|
|
105
|
+
keySuffix?: string | undefined;
|
|
106
|
+
/** Timestamp the key was created. ISO-8601. */
|
|
107
|
+
createdAt?: string | undefined;
|
|
108
|
+
/** Timestamp the key expires. If not present, `null` or is empty the key never expires. ISO-8601. */
|
|
109
|
+
expireAt?: string | null | undefined;
|
|
110
|
+
/** Timestamp the key was used last time, with one-minute precision. If not present the key was never used. ISO-8601. */
|
|
111
|
+
usedAt?: string | undefined;
|
|
112
|
+
/** List of IP addresses allowed to access the API using this key */
|
|
113
|
+
ipAccessList?: ApiKeyIpAccessListList | undefined;
|
|
114
|
+
}
|
|
115
|
+
export interface ApiKeyPostResponse {
|
|
116
|
+
key: ApiKey;
|
|
117
|
+
/** Generated key ID. Provided only if there was no 'hashData' in the request. */
|
|
118
|
+
keyId?: string | undefined;
|
|
119
|
+
/** Generated key secret. Provided only if there was no 'hashData' in the request. */
|
|
120
|
+
keySecret?: string | Redacted.Redacted<string> | undefined;
|
|
121
|
+
}
|
|
122
|
+
export interface DeleteApiKeyRequest {
|
|
123
|
+
/** ID of the organization that owns the key. */
|
|
124
|
+
organizationId: string;
|
|
125
|
+
/** ID of the key to delete. */
|
|
126
|
+
keyId: string;
|
|
127
|
+
}
|
|
128
|
+
export interface DeleteApiKeyResponse {
|
|
129
|
+
/** HTTP status code. */
|
|
130
|
+
status?: number | undefined;
|
|
131
|
+
/** Unique id assigned to every request. UUIDv4 */
|
|
132
|
+
requestId?: string | undefined;
|
|
133
|
+
}
|
|
134
|
+
export interface GetApiKeyRequest {
|
|
135
|
+
/** ID of the requested organization. */
|
|
136
|
+
organizationId: string;
|
|
137
|
+
/** ID of the requested key. */
|
|
138
|
+
keyId: string;
|
|
139
|
+
}
|
|
140
|
+
export interface ListApiKeysRequest {
|
|
141
|
+
/** ID of the requested organization. */
|
|
142
|
+
organizationId: string;
|
|
143
|
+
/** Maximum number of results to return. */
|
|
144
|
+
limit?: number | undefined;
|
|
145
|
+
/** Opaque cursor from a previous response's `nextCursor`, marking where to resume the list. */
|
|
146
|
+
cursor?: string | undefined;
|
|
147
|
+
}
|
|
148
|
+
export type ListApiKeysResponseResultList = Array<ApiKey>;
|
|
149
|
+
export interface ListApiKeysResponse {
|
|
150
|
+
/** HTTP status code. */
|
|
151
|
+
status?: number | undefined;
|
|
152
|
+
/** Unique id assigned to every request. UUIDv4 */
|
|
153
|
+
requestId?: string | undefined;
|
|
154
|
+
result: ListApiKeysResponseResultList;
|
|
155
|
+
/** Maximum number of results returned in this page. */
|
|
156
|
+
limit?: number | undefined;
|
|
157
|
+
/** 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. */
|
|
158
|
+
totalCount?: number | null | undefined;
|
|
159
|
+
/** Cursor for the next page, to be sent as the `cursor` query parameter. Null on the last page. */
|
|
160
|
+
nextCursor?: string | null | undefined;
|
|
161
|
+
}
|
|
162
|
+
export type UpdateApiKeyRequestRolesItem = "admin" | "developer" | "query_endpoints";
|
|
163
|
+
/** DEPRECATED. Use `assignedRoleIds` instead. List of roles assigned to the key. */
|
|
164
|
+
export type UpdateApiKeyRequestRolesList = Array<UpdateApiKeyRequestRolesItem | (string & {})>;
|
|
165
|
+
/** Array of role UUIDs to assign to the API key */
|
|
166
|
+
export type UpdateApiKeyRequestAssignedRoleIdsList = Array<string>;
|
|
167
|
+
/** State of the key: 'enabled', 'disabled'. */
|
|
168
|
+
export type UpdateApiKeyRequestState = "enabled" | "disabled";
|
|
169
|
+
/** List of IP addresses allowed to access the API using this key */
|
|
170
|
+
export type UpdateApiKeyRequestIpAccessListList = Array<IpAccessListEntry>;
|
|
171
|
+
export interface UpdateApiKeyRequest {
|
|
172
|
+
/** ID of the organization that owns the key. */
|
|
173
|
+
organizationId: string;
|
|
174
|
+
/** ID of the key to update. */
|
|
175
|
+
keyId: string;
|
|
176
|
+
/** Name of the key */
|
|
177
|
+
name?: string | undefined;
|
|
178
|
+
/** DEPRECATED. Use `assignedRoleIds` instead. List of roles assigned to the key. */
|
|
179
|
+
roles?: UpdateApiKeyRequestRolesList | undefined;
|
|
180
|
+
/** Array of role UUIDs to assign to the API key */
|
|
181
|
+
assignedRoleIds?: UpdateApiKeyRequestAssignedRoleIdsList | undefined;
|
|
182
|
+
/** Timestamp the key expires. If `null` or is empty the key never expires. ISO-8601. */
|
|
183
|
+
expireAt?: string | null | undefined;
|
|
184
|
+
/** State of the key: 'enabled', 'disabled'. */
|
|
185
|
+
state?: UpdateApiKeyRequestState | (string & {}) | undefined;
|
|
186
|
+
/** List of IP addresses allowed to access the API using this key */
|
|
187
|
+
ipAccessList?: UpdateApiKeyRequestIpAccessListList | undefined;
|
|
188
|
+
}
|
|
189
|
+
export type CreateApiKeyError = ClickHouseCloudOpError;
|
|
190
|
+
/** Create key Creates new API key. */
|
|
191
|
+
export const createApiKey: API.OperationMethod<
|
|
192
|
+
CreateApiKeyRequest,
|
|
193
|
+
ApiKeyPostResponse,
|
|
194
|
+
CreateApiKeyError,
|
|
195
|
+
ClickHouseCloudOpContext
|
|
196
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
197
|
+
input: __S(1, __c0, 1) as any as S.Schema<CreateApiKeyRequest>,
|
|
198
|
+
output: __S(2, __c0, 2) as any as S.Schema<ApiKeyPostResponse>,
|
|
199
|
+
errors: [],
|
|
200
|
+
serviceErrors: ClickHouseCloudServiceErrors,
|
|
201
|
+
protocol: ClickHouseCloudProtocol,
|
|
202
|
+
retry: Retry.Retry,
|
|
203
|
+
telemetry: TELEMETRY,
|
|
204
|
+
span: "CreateApiKey",
|
|
205
|
+
}));
|
|
206
|
+
|
|
207
|
+
export type DeleteApiKeyError = ClickHouseCloudOpError;
|
|
208
|
+
/** Delete key Deletes API key. Only a key not used to authenticate the active request can be deleted. */
|
|
209
|
+
export const deleteApiKey: API.OperationMethod<
|
|
210
|
+
DeleteApiKeyRequest,
|
|
211
|
+
DeleteApiKeyResponse,
|
|
212
|
+
DeleteApiKeyError,
|
|
213
|
+
ClickHouseCloudOpContext
|
|
214
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
215
|
+
input: __S(24, __c3, 0) as any as S.Schema<DeleteApiKeyRequest>,
|
|
216
|
+
output: __S(25, __c3, 1) as any as S.Schema<DeleteApiKeyResponse>,
|
|
217
|
+
errors: [],
|
|
218
|
+
serviceErrors: ClickHouseCloudServiceErrors,
|
|
219
|
+
protocol: ClickHouseCloudProtocol,
|
|
220
|
+
retry: Retry.Retry,
|
|
221
|
+
telemetry: TELEMETRY,
|
|
222
|
+
span: "DeleteApiKey",
|
|
223
|
+
}));
|
|
224
|
+
|
|
225
|
+
export type GetApiKeyError = ClickHouseCloudOpError;
|
|
226
|
+
/** Get key details Returns a single key details. */
|
|
227
|
+
export const getApiKey: API.OperationMethod<
|
|
228
|
+
GetApiKeyRequest,
|
|
229
|
+
ApiKey,
|
|
230
|
+
GetApiKeyError,
|
|
231
|
+
ClickHouseCloudOpContext
|
|
232
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
233
|
+
input: __S(32, __c4, 0) as any as S.Schema<GetApiKeyRequest>,
|
|
234
|
+
output: __S(13, __c1, 5) as any as S.Schema<ApiKey>,
|
|
235
|
+
errors: [],
|
|
236
|
+
serviceErrors: ClickHouseCloudServiceErrors,
|
|
237
|
+
protocol: ClickHouseCloudProtocol,
|
|
238
|
+
retry: Retry.Retry,
|
|
239
|
+
telemetry: TELEMETRY,
|
|
240
|
+
span: "GetApiKey",
|
|
241
|
+
}));
|
|
242
|
+
|
|
243
|
+
export type ListApiKeysError = ClickHouseCloudOpError;
|
|
244
|
+
/** Get list of keys Returns a list of keys in the organization, ordered by creation date, oldest 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. */
|
|
245
|
+
export const listApiKeys: API.PaginatedOperationMethod<
|
|
246
|
+
ListApiKeysRequest,
|
|
247
|
+
ListApiKeysResponse,
|
|
248
|
+
ListApiKeysError,
|
|
249
|
+
ClickHouseCloudOpContext,
|
|
250
|
+
ApiKey
|
|
251
|
+
> = /*@__PURE__*/ API.makePaginated(
|
|
252
|
+
() => ({
|
|
253
|
+
input: __S(40, __c5, 0) as any as S.Schema<ListApiKeysRequest>,
|
|
254
|
+
output: __S(42, __c5, 2) as any as S.Schema<ListApiKeysResponse>,
|
|
255
|
+
errors: [],
|
|
256
|
+
serviceErrors: ClickHouseCloudServiceErrors,
|
|
257
|
+
protocol: ClickHouseCloudPaginatedProtocol,
|
|
258
|
+
retry: Retry.Retry,
|
|
259
|
+
telemetry: TELEMETRY,
|
|
260
|
+
span: "ListApiKeys",
|
|
261
|
+
pagination: {
|
|
262
|
+
mode: "cursor",
|
|
263
|
+
inputToken: "cursor",
|
|
264
|
+
outputToken: "nextCursor",
|
|
265
|
+
items: "result",
|
|
266
|
+
pageSize: "limit",
|
|
267
|
+
} as const,
|
|
268
|
+
}),
|
|
269
|
+
paginateCursor,
|
|
270
|
+
) as any;
|
|
271
|
+
|
|
272
|
+
export type UpdateApiKeyError = ClickHouseCloudOpError;
|
|
273
|
+
/** Update key Updates API key properties. */
|
|
274
|
+
export const updateApiKey: API.OperationMethod<
|
|
275
|
+
UpdateApiKeyRequest,
|
|
276
|
+
ApiKey,
|
|
277
|
+
UpdateApiKeyError,
|
|
278
|
+
ClickHouseCloudOpContext
|
|
279
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
280
|
+
input: __S(48, __c6, 0) as any as S.Schema<UpdateApiKeyRequest>,
|
|
281
|
+
output: __S(13, __c1, 5) as any as S.Schema<ApiKey>,
|
|
282
|
+
errors: [],
|
|
283
|
+
serviceErrors: ClickHouseCloudServiceErrors,
|
|
284
|
+
protocol: ClickHouseCloudProtocol,
|
|
285
|
+
retry: Retry.Retry,
|
|
286
|
+
telemetry: TELEMETRY,
|
|
287
|
+
span: "UpdateApiKey",
|
|
288
|
+
}));
|
|
289
|
+
|
|
290
|
+
// Schema builders: each runs one schema initializer, on that schema's first use.
|
|
291
|
+
function __c0(j: number): any {
|
|
292
|
+
switch (j) {
|
|
293
|
+
case 0:
|
|
294
|
+
return S.suspend(() =>
|
|
295
|
+
S.Struct({
|
|
296
|
+
keyIdHash: S.optional(S.String),
|
|
297
|
+
keyIdSuffix: S.optional(S.String),
|
|
298
|
+
keySecretHash: S.optional(S.String.pipe(T.SensitiveValue({}))),
|
|
299
|
+
}),
|
|
300
|
+
).annotate({ identifier: "ApiKeyHashData" });
|
|
301
|
+
case 1:
|
|
302
|
+
return S.suspend(() =>
|
|
303
|
+
S.Struct({
|
|
304
|
+
organizationId: S.String.pipe(T.Label()),
|
|
305
|
+
name: S.String,
|
|
306
|
+
expireAt: S.optional(S.NullOr(S.String)),
|
|
307
|
+
state: S.optional(S.String),
|
|
308
|
+
hashData: S.optional(__S(0, __c0, 0)),
|
|
309
|
+
roles: S.optional(__S(8, __c1, 0)),
|
|
310
|
+
assignedRoleIds: S.optional(__S(16, __c2, 0)),
|
|
311
|
+
ipAccessList: S.optional(__S(10, __c1, 2)),
|
|
312
|
+
}).pipe(
|
|
313
|
+
T.Http({ method: "POST", uri: "/v1/organizations/{organizationId}/keys", code: 200 }),
|
|
314
|
+
),
|
|
315
|
+
).annotate({ identifier: "CreateApiKeyRequest" });
|
|
316
|
+
case 2:
|
|
317
|
+
return S.suspend(() =>
|
|
318
|
+
S.Struct({
|
|
319
|
+
key: __S(13, __c1, 5),
|
|
320
|
+
keyId: S.optional(S.String),
|
|
321
|
+
keySecret: S.optional(S.String.pipe(T.SensitiveValue({}))),
|
|
322
|
+
}),
|
|
323
|
+
).annotate({ identifier: "ApiKeyPostResponse" });
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function __c1(j: number): any {
|
|
327
|
+
switch (j) {
|
|
328
|
+
case 0:
|
|
329
|
+
return S.Array(S.String);
|
|
330
|
+
case 1:
|
|
331
|
+
return S.suspend(() =>
|
|
332
|
+
S.Struct({
|
|
333
|
+
source: S.optional(S.String),
|
|
334
|
+
description: S.optional(S.String),
|
|
335
|
+
}),
|
|
336
|
+
).annotate({ identifier: "IpAccessListEntry" });
|
|
337
|
+
case 2:
|
|
338
|
+
return S.Array(__S(9, __c1, 1));
|
|
339
|
+
case 3:
|
|
340
|
+
return S.suspend(() =>
|
|
341
|
+
S.Struct({
|
|
342
|
+
roleId: S.optional(S.String),
|
|
343
|
+
roleName: S.optional(S.String),
|
|
344
|
+
roleType: S.optional(S.String),
|
|
345
|
+
}),
|
|
346
|
+
).annotate({ identifier: "AssignedRole" });
|
|
347
|
+
case 4:
|
|
348
|
+
return S.Array(__S(11, __c1, 3));
|
|
349
|
+
case 5:
|
|
350
|
+
return S.suspend(() =>
|
|
351
|
+
S.Struct({
|
|
352
|
+
id: S.String,
|
|
353
|
+
name: S.optional(S.String),
|
|
354
|
+
state: S.optional(S.String),
|
|
355
|
+
roles: S.optional(__S(8, __c1, 0)),
|
|
356
|
+
assignedRoles: S.optional(__S(12, __c1, 4)),
|
|
357
|
+
keySuffix: S.optional(S.String),
|
|
358
|
+
createdAt: S.optional(S.String),
|
|
359
|
+
expireAt: S.optional(S.NullOr(S.String)),
|
|
360
|
+
usedAt: S.optional(S.String),
|
|
361
|
+
ipAccessList: S.optional(__S(10, __c1, 2)),
|
|
362
|
+
}),
|
|
363
|
+
).annotate({ identifier: "ApiKey" });
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
function __c2(j: number): any {
|
|
367
|
+
switch (j) {
|
|
368
|
+
case 0:
|
|
369
|
+
return S.Array(S.String);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
function __c3(j: number): any {
|
|
373
|
+
switch (j) {
|
|
374
|
+
case 0:
|
|
375
|
+
return S.suspend(() =>
|
|
376
|
+
S.Struct({
|
|
377
|
+
organizationId: S.String.pipe(T.Label()),
|
|
378
|
+
keyId: S.String.pipe(T.Label()),
|
|
379
|
+
}).pipe(
|
|
380
|
+
T.Http({
|
|
381
|
+
method: "DELETE",
|
|
382
|
+
uri: "/v1/organizations/{organizationId}/keys/{keyId}",
|
|
383
|
+
code: 200,
|
|
384
|
+
}),
|
|
385
|
+
),
|
|
386
|
+
).annotate({ identifier: "DeleteApiKeyRequest" });
|
|
387
|
+
case 1:
|
|
388
|
+
return S.suspend(() =>
|
|
389
|
+
S.Struct({
|
|
390
|
+
status: S.optional(S.Number),
|
|
391
|
+
requestId: S.optional(S.String),
|
|
392
|
+
}),
|
|
393
|
+
).annotate({ identifier: "DeleteApiKeyResponse" });
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
function __c4(j: number): any {
|
|
397
|
+
switch (j) {
|
|
398
|
+
case 0:
|
|
399
|
+
return S.suspend(() =>
|
|
400
|
+
S.Struct({
|
|
401
|
+
organizationId: S.String.pipe(T.Label()),
|
|
402
|
+
keyId: S.String.pipe(T.Label()),
|
|
403
|
+
}).pipe(
|
|
404
|
+
T.Http({
|
|
405
|
+
method: "GET",
|
|
406
|
+
uri: "/v1/organizations/{organizationId}/keys/{keyId}",
|
|
407
|
+
code: 200,
|
|
408
|
+
}),
|
|
409
|
+
),
|
|
410
|
+
).annotate({ identifier: "GetApiKeyRequest" });
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
function __c5(j: number): any {
|
|
414
|
+
switch (j) {
|
|
415
|
+
case 0:
|
|
416
|
+
return S.suspend(() =>
|
|
417
|
+
S.Struct({
|
|
418
|
+
organizationId: S.String.pipe(T.Label()),
|
|
419
|
+
limit: S.optional(S.Number.pipe(T.Query())),
|
|
420
|
+
cursor: S.optional(S.String.pipe(T.Query())),
|
|
421
|
+
}).pipe(
|
|
422
|
+
T.Http({ method: "GET", uri: "/v1/organizations/{organizationId}/keys", code: 200 }),
|
|
423
|
+
),
|
|
424
|
+
).annotate({ identifier: "ListApiKeysRequest" });
|
|
425
|
+
case 1:
|
|
426
|
+
return S.Array(__S(13, __c1, 5));
|
|
427
|
+
case 2:
|
|
428
|
+
return S.suspend(() =>
|
|
429
|
+
S.Struct({
|
|
430
|
+
status: S.optional(S.Number),
|
|
431
|
+
requestId: S.optional(S.String),
|
|
432
|
+
result: __S(41, __c5, 1),
|
|
433
|
+
limit: S.optional(S.Number),
|
|
434
|
+
totalCount: S.optional(S.NullOr(S.Number)),
|
|
435
|
+
nextCursor: S.optional(S.NullOr(S.String)),
|
|
436
|
+
}),
|
|
437
|
+
).annotate({ identifier: "ListApiKeysResponse" });
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
function __c6(j: number): any {
|
|
441
|
+
switch (j) {
|
|
442
|
+
case 0:
|
|
443
|
+
return S.suspend(() =>
|
|
444
|
+
S.Struct({
|
|
445
|
+
organizationId: S.String.pipe(T.Label()),
|
|
446
|
+
keyId: S.String.pipe(T.Label()),
|
|
447
|
+
name: S.optional(S.String),
|
|
448
|
+
roles: S.optional(__S(8, __c1, 0)),
|
|
449
|
+
assignedRoleIds: S.optional(__S(16, __c2, 0)),
|
|
450
|
+
expireAt: S.optional(S.NullOr(S.String)),
|
|
451
|
+
state: S.optional(S.String),
|
|
452
|
+
ipAccessList: S.optional(__S(10, __c1, 2)),
|
|
453
|
+
}).pipe(
|
|
454
|
+
T.Http({
|
|
455
|
+
method: "PATCH",
|
|
456
|
+
uri: "/v1/organizations/{organizationId}/keys/{keyId}",
|
|
457
|
+
code: 200,
|
|
458
|
+
}),
|
|
459
|
+
),
|
|
460
|
+
).annotate({ identifier: "UpdateApiKeyRequest" });
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
// Schema table: entry i is schema j of builder f, made on first reach.
|
|
464
|
+
function __S(i: number, f: (j: number) => unknown, j: number): any {
|
|
465
|
+
return (__s[i] ??= __L.at(f, j));
|
|
466
|
+
}
|