@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.
- package/LICENSE +201 -0
- package/README.md +138 -2
- 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 +94 -3
- 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,347 @@
|
|
|
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: "Backups",
|
|
27
|
+
labels: "clickhouse_cloud",
|
|
28
|
+
propagate: "w3c",
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
export interface GetBackupRequest {
|
|
32
|
+
/** ID of the organization that owns the backup. */
|
|
33
|
+
organizationId: string;
|
|
34
|
+
/** ID of the service the backup was created from. */
|
|
35
|
+
serviceId: string;
|
|
36
|
+
/** ID of the requested backup. */
|
|
37
|
+
backupId: string;
|
|
38
|
+
}
|
|
39
|
+
/** Status of the backup: 'done', 'error', 'in_progress'. */
|
|
40
|
+
export type BackupStatus = "done" | "error" | "in_progress";
|
|
41
|
+
/** Backup type ("full" or "incremental"). */
|
|
42
|
+
export type BackupType = "full" | "incremental";
|
|
43
|
+
/** Bucket provider */
|
|
44
|
+
export type AwsBackupBucketPropertiesBucketProvider = "AWS";
|
|
45
|
+
export interface AwsBackupBucketProperties {
|
|
46
|
+
/** Bucket provider */
|
|
47
|
+
bucketProvider?: AwsBackupBucketPropertiesBucketProvider | undefined;
|
|
48
|
+
/** Bucket path */
|
|
49
|
+
bucketPath?: string | undefined;
|
|
50
|
+
/** AWS IAM Role */
|
|
51
|
+
iamRoleArn?: string | undefined;
|
|
52
|
+
/** AWS IAM Role */
|
|
53
|
+
iamRoleSessionName?: string | undefined;
|
|
54
|
+
/** External ID the IAM role trust policy requires when the data plane assumes the role */
|
|
55
|
+
iamRoleExternalId?: string | undefined;
|
|
56
|
+
}
|
|
57
|
+
/** Bucket provider */
|
|
58
|
+
export type GcpBackupBucketPropertiesBucketProvider = "GCP";
|
|
59
|
+
export interface GcpBackupBucketProperties {
|
|
60
|
+
/** Bucket provider */
|
|
61
|
+
bucketProvider?: GcpBackupBucketPropertiesBucketProvider | undefined;
|
|
62
|
+
/** Bucket path */
|
|
63
|
+
bucketPath?: string | undefined;
|
|
64
|
+
/** Access Key ID (HMAC key) */
|
|
65
|
+
accessKeyId?: string | undefined;
|
|
66
|
+
}
|
|
67
|
+
/** Bucket provider */
|
|
68
|
+
export type AzureBackupBucketPropertiesBucketProvider = "AZURE";
|
|
69
|
+
export interface AzureBackupBucketProperties {
|
|
70
|
+
/** Bucket provider */
|
|
71
|
+
bucketProvider?: AzureBackupBucketPropertiesBucketProvider | undefined;
|
|
72
|
+
/** Container Name */
|
|
73
|
+
containerName?: string | undefined;
|
|
74
|
+
}
|
|
75
|
+
export type BackupBucketProperties =
|
|
76
|
+
| AwsBackupBucketProperties
|
|
77
|
+
| GcpBackupBucketProperties
|
|
78
|
+
| AzureBackupBucketProperties;
|
|
79
|
+
export interface Backup {
|
|
80
|
+
/** Unique backup ID. */
|
|
81
|
+
id?: string | undefined;
|
|
82
|
+
/** Status of the backup: 'done', 'error', 'in_progress'. */
|
|
83
|
+
status?: BackupStatus | undefined;
|
|
84
|
+
/** Name */
|
|
85
|
+
serviceId?: string | undefined;
|
|
86
|
+
/** Backup start timestamp. ISO-8601. */
|
|
87
|
+
startedAt?: string | undefined;
|
|
88
|
+
/** Backup finish timestamp. ISO-8601. Available only for finished backups */
|
|
89
|
+
finishedAt?: string | undefined;
|
|
90
|
+
/** Size of the backup in bytes. */
|
|
91
|
+
sizeInBytes?: number | undefined;
|
|
92
|
+
/** Time in seconds it took to perform the backup. If the status still in_progress, this is the time in seconds since the backup started until now. */
|
|
93
|
+
durationInSeconds?: number | undefined;
|
|
94
|
+
/** Backup type ("full" or "incremental"). */
|
|
95
|
+
type?: BackupType | undefined;
|
|
96
|
+
/** Backup name on the external backup bucket. */
|
|
97
|
+
backupName?: string | undefined;
|
|
98
|
+
/** Backup bucket where the backup is stored. */
|
|
99
|
+
bucket?: BackupBucketProperties | undefined;
|
|
100
|
+
}
|
|
101
|
+
export interface GetBackupConfigurationRequest {
|
|
102
|
+
/** ID of the organization that owns the service. */
|
|
103
|
+
organizationId: string;
|
|
104
|
+
/** ID of the service. */
|
|
105
|
+
serviceId: string;
|
|
106
|
+
}
|
|
107
|
+
export interface BackupConfiguration {
|
|
108
|
+
/** The interval in hours between each backup. */
|
|
109
|
+
backupPeriodInHours?: number | undefined;
|
|
110
|
+
/** The minimum duration in hours for which the backups are available. Must be a whole number of days between 24 (1 day) and 1080 (45 days) -- i.e. a multiple of 24. */
|
|
111
|
+
backupRetentionPeriodInHours?: number | undefined;
|
|
112
|
+
/** The time in HH:MM format for the backups to be performed (evaluated in UTC timezone). When defined the backup period resets to every 24 hours. */
|
|
113
|
+
backupStartTime?: string | undefined;
|
|
114
|
+
}
|
|
115
|
+
export interface ListBackupsRequest {
|
|
116
|
+
/** ID of the organization that owns the backup. */
|
|
117
|
+
organizationId: string;
|
|
118
|
+
/** ID of the service the backup was created from. */
|
|
119
|
+
serviceId: string;
|
|
120
|
+
}
|
|
121
|
+
export type ListBackupsResponseBodyList = Array<Backup>;
|
|
122
|
+
export type ListBackupsResponse = ListBackupsResponseBodyList;
|
|
123
|
+
export interface UpdateBackupConfigurationRequest {
|
|
124
|
+
/** ID of the organization that owns the service. */
|
|
125
|
+
organizationId: string;
|
|
126
|
+
/** ID of the service. */
|
|
127
|
+
serviceId: string;
|
|
128
|
+
/** The interval in hours between each backup. */
|
|
129
|
+
backupPeriodInHours?: number | null | undefined;
|
|
130
|
+
/** The minimum duration in hours for which the backups are available. Must be a whole number of days between 24 (1 day) and 1080 (45 days) -- i.e. a multiple of 24. */
|
|
131
|
+
backupRetentionPeriodInHours?: number | null | undefined;
|
|
132
|
+
/** The time in HH:MM format for the backups to be performed (evaluated in UTC timezone). When defined the backup period resets to every 24 hours. */
|
|
133
|
+
backupStartTime?: string | null | undefined;
|
|
134
|
+
}
|
|
135
|
+
export type GetBackupError = ClickHouseCloudOpError;
|
|
136
|
+
/** Get backup details Returns a single backup info. */
|
|
137
|
+
export const getBackup: API.OperationMethod<
|
|
138
|
+
GetBackupRequest,
|
|
139
|
+
Backup,
|
|
140
|
+
GetBackupError,
|
|
141
|
+
ClickHouseCloudOpContext
|
|
142
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
143
|
+
input: __S(0, __c0, 0) as any as S.Schema<GetBackupRequest>,
|
|
144
|
+
output: __S(12, __c1, 4) as any as S.Schema<Backup>,
|
|
145
|
+
errors: [],
|
|
146
|
+
serviceErrors: ClickHouseCloudServiceErrors,
|
|
147
|
+
protocol: ClickHouseCloudProtocol,
|
|
148
|
+
retry: Retry.Retry,
|
|
149
|
+
telemetry: TELEMETRY,
|
|
150
|
+
span: "GetBackup",
|
|
151
|
+
}));
|
|
152
|
+
|
|
153
|
+
export type GetBackupConfigurationError = ClickHouseCloudOpError;
|
|
154
|
+
/** Get service backup configuration Returns the service backup configuration. */
|
|
155
|
+
export const getBackupConfiguration: API.OperationMethod<
|
|
156
|
+
GetBackupConfigurationRequest,
|
|
157
|
+
BackupConfiguration,
|
|
158
|
+
GetBackupConfigurationError,
|
|
159
|
+
ClickHouseCloudOpContext
|
|
160
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
161
|
+
input: __S(16, __c2, 0) as any as S.Schema<GetBackupConfigurationRequest>,
|
|
162
|
+
output: __S(24, __c3, 0) as any as S.Schema<BackupConfiguration>,
|
|
163
|
+
errors: [],
|
|
164
|
+
serviceErrors: ClickHouseCloudServiceErrors,
|
|
165
|
+
protocol: ClickHouseCloudProtocol,
|
|
166
|
+
retry: Retry.Retry,
|
|
167
|
+
telemetry: TELEMETRY,
|
|
168
|
+
span: "GetBackupConfiguration",
|
|
169
|
+
}));
|
|
170
|
+
|
|
171
|
+
export type ListBackupsError = ClickHouseCloudOpError;
|
|
172
|
+
/** List of service backups Returns a list of all backups for the service. The most recent backups comes first in the list. */
|
|
173
|
+
export const listBackups: API.OperationMethod<
|
|
174
|
+
ListBackupsRequest,
|
|
175
|
+
ListBackupsResponse,
|
|
176
|
+
ListBackupsError,
|
|
177
|
+
ClickHouseCloudOpContext
|
|
178
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
179
|
+
input: __S(32, __c4, 0) as any as S.Schema<ListBackupsRequest>,
|
|
180
|
+
output: __S(34, __c4, 2) as any as S.Schema<ListBackupsResponse>,
|
|
181
|
+
errors: [],
|
|
182
|
+
serviceErrors: ClickHouseCloudServiceErrors,
|
|
183
|
+
protocol: ClickHouseCloudProtocol,
|
|
184
|
+
retry: Retry.Retry,
|
|
185
|
+
telemetry: TELEMETRY,
|
|
186
|
+
span: "ListBackups",
|
|
187
|
+
}));
|
|
188
|
+
|
|
189
|
+
export type UpdateBackupConfigurationError = ClickHouseCloudOpError;
|
|
190
|
+
/** Update service backup configuration Updates service backup configuration. Requires ADMIN auth key role. Setting the properties with null value, will reset the properties to theirs default values. */
|
|
191
|
+
export const updateBackupConfiguration: API.OperationMethod<
|
|
192
|
+
UpdateBackupConfigurationRequest,
|
|
193
|
+
BackupConfiguration,
|
|
194
|
+
UpdateBackupConfigurationError,
|
|
195
|
+
ClickHouseCloudOpContext
|
|
196
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
197
|
+
input: __S(40, __c5, 0) as any as S.Schema<UpdateBackupConfigurationRequest>,
|
|
198
|
+
output: __S(24, __c3, 0) as any as S.Schema<BackupConfiguration>,
|
|
199
|
+
errors: [],
|
|
200
|
+
serviceErrors: ClickHouseCloudServiceErrors,
|
|
201
|
+
protocol: ClickHouseCloudProtocol,
|
|
202
|
+
retry: Retry.Retry,
|
|
203
|
+
telemetry: TELEMETRY,
|
|
204
|
+
span: "UpdateBackupConfiguration",
|
|
205
|
+
}));
|
|
206
|
+
|
|
207
|
+
// Schema builders: each runs one schema initializer, on that schema's first use.
|
|
208
|
+
function __c0(j: number): any {
|
|
209
|
+
switch (j) {
|
|
210
|
+
case 0:
|
|
211
|
+
return S.suspend(() =>
|
|
212
|
+
S.Struct({
|
|
213
|
+
organizationId: S.String.pipe(T.Label()),
|
|
214
|
+
serviceId: S.String.pipe(T.Label()),
|
|
215
|
+
backupId: S.String.pipe(T.Label()),
|
|
216
|
+
}).pipe(
|
|
217
|
+
T.Http({
|
|
218
|
+
method: "GET",
|
|
219
|
+
uri: "/v1/organizations/{organizationId}/services/{serviceId}/backups/{backupId}",
|
|
220
|
+
code: 200,
|
|
221
|
+
}),
|
|
222
|
+
),
|
|
223
|
+
).annotate({ identifier: "GetBackupRequest" });
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function __c1(j: number): any {
|
|
227
|
+
switch (j) {
|
|
228
|
+
case 0:
|
|
229
|
+
return S.suspend(() =>
|
|
230
|
+
S.Struct({
|
|
231
|
+
bucketProvider: S.optional(S.String),
|
|
232
|
+
bucketPath: S.optional(S.String),
|
|
233
|
+
iamRoleArn: S.optional(S.String),
|
|
234
|
+
iamRoleSessionName: S.optional(S.String),
|
|
235
|
+
iamRoleExternalId: S.optional(S.String),
|
|
236
|
+
}),
|
|
237
|
+
).annotate({ identifier: "AwsBackupBucketProperties" });
|
|
238
|
+
case 1:
|
|
239
|
+
return S.suspend(() =>
|
|
240
|
+
S.Struct({
|
|
241
|
+
bucketProvider: S.optional(S.String),
|
|
242
|
+
bucketPath: S.optional(S.String),
|
|
243
|
+
accessKeyId: S.optional(S.String),
|
|
244
|
+
}),
|
|
245
|
+
).annotate({ identifier: "GcpBackupBucketProperties" });
|
|
246
|
+
case 2:
|
|
247
|
+
return S.suspend(() =>
|
|
248
|
+
S.Struct({
|
|
249
|
+
bucketProvider: S.optional(S.String),
|
|
250
|
+
containerName: S.optional(S.String),
|
|
251
|
+
}),
|
|
252
|
+
).annotate({ identifier: "AzureBackupBucketProperties" });
|
|
253
|
+
case 3:
|
|
254
|
+
return S.Union([__S(8, __c1, 0), __S(9, __c1, 1), __S(10, __c1, 2)]);
|
|
255
|
+
case 4:
|
|
256
|
+
return S.suspend(() =>
|
|
257
|
+
S.Struct({
|
|
258
|
+
id: S.optional(S.String),
|
|
259
|
+
status: S.optional(S.String),
|
|
260
|
+
serviceId: S.optional(S.String),
|
|
261
|
+
startedAt: S.optional(S.String),
|
|
262
|
+
finishedAt: S.optional(S.String),
|
|
263
|
+
sizeInBytes: S.optional(S.Number),
|
|
264
|
+
durationInSeconds: S.optional(S.Number),
|
|
265
|
+
type: S.optional(S.String),
|
|
266
|
+
backupName: S.optional(S.String),
|
|
267
|
+
bucket: S.optional(__S(11, __c1, 3)),
|
|
268
|
+
}),
|
|
269
|
+
).annotate({ identifier: "Backup" });
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function __c2(j: number): any {
|
|
273
|
+
switch (j) {
|
|
274
|
+
case 0:
|
|
275
|
+
return S.suspend(() =>
|
|
276
|
+
S.Struct({
|
|
277
|
+
organizationId: S.String.pipe(T.Label()),
|
|
278
|
+
serviceId: S.String.pipe(T.Label()),
|
|
279
|
+
}).pipe(
|
|
280
|
+
T.Http({
|
|
281
|
+
method: "GET",
|
|
282
|
+
uri: "/v1/organizations/{organizationId}/services/{serviceId}/backupConfiguration",
|
|
283
|
+
code: 200,
|
|
284
|
+
}),
|
|
285
|
+
),
|
|
286
|
+
).annotate({ identifier: "GetBackupConfigurationRequest" });
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function __c3(j: number): any {
|
|
290
|
+
switch (j) {
|
|
291
|
+
case 0:
|
|
292
|
+
return S.suspend(() =>
|
|
293
|
+
S.Struct({
|
|
294
|
+
backupPeriodInHours: S.optional(S.Number),
|
|
295
|
+
backupRetentionPeriodInHours: S.optional(S.Number),
|
|
296
|
+
backupStartTime: S.optional(S.String),
|
|
297
|
+
}),
|
|
298
|
+
).annotate({ identifier: "BackupConfiguration" });
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function __c4(j: number): any {
|
|
302
|
+
switch (j) {
|
|
303
|
+
case 0:
|
|
304
|
+
return S.suspend(() =>
|
|
305
|
+
S.Struct({
|
|
306
|
+
organizationId: S.String.pipe(T.Label()),
|
|
307
|
+
serviceId: S.String.pipe(T.Label()),
|
|
308
|
+
}).pipe(
|
|
309
|
+
T.Http({
|
|
310
|
+
method: "GET",
|
|
311
|
+
uri: "/v1/organizations/{organizationId}/services/{serviceId}/backups",
|
|
312
|
+
code: 200,
|
|
313
|
+
}),
|
|
314
|
+
),
|
|
315
|
+
).annotate({ identifier: "ListBackupsRequest" });
|
|
316
|
+
case 1:
|
|
317
|
+
return S.Array(__S(12, __c1, 4));
|
|
318
|
+
case 2:
|
|
319
|
+
return S.suspend(() => __S(33, __c4, 1).pipe(T.RawResponseRoot())).annotate({
|
|
320
|
+
identifier: "ListBackupsResponse",
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function __c5(j: number): any {
|
|
325
|
+
switch (j) {
|
|
326
|
+
case 0:
|
|
327
|
+
return S.suspend(() =>
|
|
328
|
+
S.Struct({
|
|
329
|
+
organizationId: S.String.pipe(T.Label()),
|
|
330
|
+
serviceId: S.String.pipe(T.Label()),
|
|
331
|
+
backupPeriodInHours: S.optional(S.NullOr(S.Number)),
|
|
332
|
+
backupRetentionPeriodInHours: S.optional(S.NullOr(S.Number)),
|
|
333
|
+
backupStartTime: S.optional(S.NullOr(S.String)),
|
|
334
|
+
}).pipe(
|
|
335
|
+
T.Http({
|
|
336
|
+
method: "PATCH",
|
|
337
|
+
uri: "/v1/organizations/{organizationId}/services/{serviceId}/backupConfiguration",
|
|
338
|
+
code: 200,
|
|
339
|
+
}),
|
|
340
|
+
),
|
|
341
|
+
).annotate({ identifier: "UpdateBackupConfigurationRequest" });
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
// Schema table: entry i is schema j of builder f, made on first reach.
|
|
345
|
+
function __S(i: number, f: (j: number) => unknown, j: number): any {
|
|
346
|
+
return (__s[i] ??= __L.at(f, j));
|
|
347
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
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: "Billing",
|
|
27
|
+
labels: "clickhouse_cloud",
|
|
28
|
+
propagate: "w3c",
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
export type GetUsageCostRequestFilterList = Array<string>;
|
|
32
|
+
export interface GetUsageCostRequest {
|
|
33
|
+
/** ID of the requested organization. */
|
|
34
|
+
organizationId: string;
|
|
35
|
+
/** Start date for the report, e.g. 2024-12-19. */
|
|
36
|
+
from_date: string;
|
|
37
|
+
/** End date (inclusive) for the report, e.g. 2024-12-20. This date cannot be more than 30 days after from_date (for a maximum queried period of 31 days). */
|
|
38
|
+
to_date: string;
|
|
39
|
+
/** Filter criteria to apply when retrieving the usage cost report. Currently, only filtering by resource tags is supported. */
|
|
40
|
+
filter?: GetUsageCostRequestFilterList | undefined;
|
|
41
|
+
}
|
|
42
|
+
/** Type of the entity. */
|
|
43
|
+
export type UsageCostRecordEntityType = "datawarehouse" | "service" | "clickpipe";
|
|
44
|
+
export interface UsageCostMetrics {
|
|
45
|
+
/** Cost of storage in ClickHouse Credits (CHCs). Applies to dataWarehouse entities. */
|
|
46
|
+
storageCHC?: number | undefined;
|
|
47
|
+
/** Cost of backup in ClickHouse Credits (CHCs). Applies to dataWarehouse entities. */
|
|
48
|
+
backupCHC?: number | undefined;
|
|
49
|
+
/** Cost of compute in ClickHouse Credits (CHCs). Applies to service and clickpipe entities. */
|
|
50
|
+
computeCHC?: number | undefined;
|
|
51
|
+
/** Cost of data transfer in ClickHouse Credits (CHCs). Applies to clickpipe entities. */
|
|
52
|
+
dataTransferCHC?: number | undefined;
|
|
53
|
+
/** Cost of initial load and resyncs in ClickHouse Credits (CHCs). Applies to clickpipe entities. */
|
|
54
|
+
initialLoadCHC?: number | undefined;
|
|
55
|
+
/** Cost of data transfer in ClickHouse Credits (CHCs). Applies to service entities. */
|
|
56
|
+
publicDataTransferCHC?: number | undefined;
|
|
57
|
+
/** Cost of tier1 inter-region data transfer in ClickHouse Credits (CHCs). Applies to service entities. */
|
|
58
|
+
interRegionTier1DataTransferCHC?: number | undefined;
|
|
59
|
+
/** Cost of tier2 inter-region data transfer in ClickHouse Credits (CHCs). Applies to service entities. */
|
|
60
|
+
interRegionTier2DataTransferCHC?: number | undefined;
|
|
61
|
+
/** Cost of tier3 inter-region data transfer in ClickHouse Credits (CHCs). Applies to service entities. */
|
|
62
|
+
interRegionTier3DataTransferCHC?: number | undefined;
|
|
63
|
+
/** Cost of tier4 inter-region data transfer in ClickHouse Credits (CHCs). Applies to service entities. */
|
|
64
|
+
interRegionTier4DataTransferCHC?: number | undefined;
|
|
65
|
+
}
|
|
66
|
+
export interface UsageCostRecord {
|
|
67
|
+
/** ID of the dataWarehouse this entity belongs to (or is). */
|
|
68
|
+
dataWarehouseId?: string | undefined;
|
|
69
|
+
/** ID of the service this entity belongs to (or is). Set to null for dataWarehouse entities. */
|
|
70
|
+
serviceId?: string | null | undefined;
|
|
71
|
+
/** Date of the usage. ISO-8601 date, based on the UTC timezone. */
|
|
72
|
+
date?: string | undefined;
|
|
73
|
+
/** Type of the entity. */
|
|
74
|
+
entityType?: UsageCostRecordEntityType | undefined;
|
|
75
|
+
/** Unique ID of the entity. */
|
|
76
|
+
entityId?: string | undefined;
|
|
77
|
+
/** Name of the entity. */
|
|
78
|
+
entityName?: string | undefined;
|
|
79
|
+
metrics?: UsageCostMetrics | undefined;
|
|
80
|
+
/** Total cost of usage in ClickHouse Credits (CHCs) for this entity. */
|
|
81
|
+
totalCHC?: number | undefined;
|
|
82
|
+
/** When true, the record is immutable. Unlocked records are subject to change until locked. */
|
|
83
|
+
locked?: boolean | undefined;
|
|
84
|
+
}
|
|
85
|
+
/** List of daily, per-entity usage cost records. */
|
|
86
|
+
export type UsageCostCostsList = Array<UsageCostRecord>;
|
|
87
|
+
export interface UsageCost {
|
|
88
|
+
/** Grand total cost of usage in ClickHouse Credits (CHCs). */
|
|
89
|
+
grandTotalCHC?: number | undefined;
|
|
90
|
+
/** List of daily, per-entity usage cost records. */
|
|
91
|
+
costs?: UsageCostCostsList | undefined;
|
|
92
|
+
}
|
|
93
|
+
export type GetUsageCostError = ClickHouseCloudOpError;
|
|
94
|
+
/** Get organization usage costs Returns a grand total and a list of daily, per-entity organization usage cost records for the organization in the queried time period (maximum 31 days). All days in both the request and the response are evaluated based on the UTC timezone. */
|
|
95
|
+
export const getUsageCost: API.OperationMethod<
|
|
96
|
+
GetUsageCostRequest,
|
|
97
|
+
UsageCost,
|
|
98
|
+
GetUsageCostError,
|
|
99
|
+
ClickHouseCloudOpContext
|
|
100
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
101
|
+
input: __S(1, __c0, 1) as any as S.Schema<GetUsageCostRequest>,
|
|
102
|
+
output: __S(5, __c0, 5) as any as S.Schema<UsageCost>,
|
|
103
|
+
errors: [],
|
|
104
|
+
serviceErrors: ClickHouseCloudServiceErrors,
|
|
105
|
+
protocol: ClickHouseCloudProtocol,
|
|
106
|
+
retry: Retry.Retry,
|
|
107
|
+
telemetry: TELEMETRY,
|
|
108
|
+
span: "GetUsageCost",
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
// Schema builders: each runs one schema initializer, on that schema's first use.
|
|
112
|
+
function __c0(j: number): any {
|
|
113
|
+
switch (j) {
|
|
114
|
+
case 0:
|
|
115
|
+
return S.Array(S.String);
|
|
116
|
+
case 1:
|
|
117
|
+
return S.suspend(() =>
|
|
118
|
+
S.Struct({
|
|
119
|
+
organizationId: S.String.pipe(T.Label()),
|
|
120
|
+
from_date: S.String.pipe(T.Query()),
|
|
121
|
+
to_date: S.String.pipe(T.Query()),
|
|
122
|
+
filter: S.optional(__S(0, __c0, 0).pipe(T.Query())),
|
|
123
|
+
}).pipe(
|
|
124
|
+
T.Http({ method: "GET", uri: "/v1/organizations/{organizationId}/usageCost", code: 200 }),
|
|
125
|
+
),
|
|
126
|
+
).annotate({ identifier: "GetUsageCostRequest" });
|
|
127
|
+
case 2:
|
|
128
|
+
return S.suspend(() =>
|
|
129
|
+
S.Struct({
|
|
130
|
+
storageCHC: S.optional(S.Number),
|
|
131
|
+
backupCHC: S.optional(S.Number),
|
|
132
|
+
computeCHC: S.optional(S.Number),
|
|
133
|
+
dataTransferCHC: S.optional(S.Number),
|
|
134
|
+
initialLoadCHC: S.optional(S.Number),
|
|
135
|
+
publicDataTransferCHC: S.optional(S.Number),
|
|
136
|
+
interRegionTier1DataTransferCHC: S.optional(S.Number),
|
|
137
|
+
interRegionTier2DataTransferCHC: S.optional(S.Number),
|
|
138
|
+
interRegionTier3DataTransferCHC: S.optional(S.Number),
|
|
139
|
+
interRegionTier4DataTransferCHC: S.optional(S.Number),
|
|
140
|
+
}),
|
|
141
|
+
).annotate({ identifier: "UsageCostMetrics" });
|
|
142
|
+
case 3:
|
|
143
|
+
return S.suspend(() =>
|
|
144
|
+
S.Struct({
|
|
145
|
+
dataWarehouseId: S.optional(S.String),
|
|
146
|
+
serviceId: S.optional(S.NullOr(S.String)),
|
|
147
|
+
date: S.optional(S.String),
|
|
148
|
+
entityType: S.optional(S.String),
|
|
149
|
+
entityId: S.optional(S.String),
|
|
150
|
+
entityName: S.optional(S.String),
|
|
151
|
+
metrics: S.optional(__S(2, __c0, 2)),
|
|
152
|
+
totalCHC: S.optional(S.Number),
|
|
153
|
+
locked: S.optional(S.Boolean),
|
|
154
|
+
}),
|
|
155
|
+
).annotate({ identifier: "UsageCostRecord" });
|
|
156
|
+
case 4:
|
|
157
|
+
return S.Array(__S(3, __c0, 3));
|
|
158
|
+
case 5:
|
|
159
|
+
return S.suspend(() =>
|
|
160
|
+
S.Struct({
|
|
161
|
+
grandTotalCHC: S.optional(S.Number),
|
|
162
|
+
costs: S.optional(__S(4, __c0, 4)),
|
|
163
|
+
}),
|
|
164
|
+
).annotate({ identifier: "UsageCost" });
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Schema table: entry i is schema j of builder f, made on first reach.
|
|
168
|
+
function __S(i: number, f: (j: number) => unknown, j: number): any {
|
|
169
|
+
return (__s[i] ??= __L.at(f, j));
|
|
170
|
+
}
|