@databricks/sdk-logdelivery 0.1.0-dev.3 → 0.1.0-dev.5
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/README.md +28 -0
- package/dist/v1/client.d.ts +3 -3
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +23 -20
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/model.d.ts +23 -19
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +32 -32
- package/dist/v1/model.js.map +1 -1
- package/dist/v1/transport.d.ts +30 -2
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +33 -16
- package/dist/v1/transport.js.map +1 -1
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +2 -1
- package/dist/v1/utils.js.map +1 -1
- package/package.json +9 -5
- package/src/v1/client.ts +0 -241
- package/src/v1/index.ts +0 -24
- package/src/v1/model.ts +0 -404
- package/src/v1/transport.ts +0 -73
- package/src/v1/utils.ts +0 -156
package/src/v1/model.ts
DELETED
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import {z} from 'zod';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* *
|
|
7
|
-
* Log Delivery Status
|
|
8
|
-
*
|
|
9
|
-
* `ENABLED`: All dependencies have executed and succeeded
|
|
10
|
-
* `DISABLED`: At least one dependency has succeeded
|
|
11
|
-
*/
|
|
12
|
-
export enum LogDeliveryConfigStatus {
|
|
13
|
-
/** Configuration is enabled */
|
|
14
|
-
ENABLED = 'ENABLED',
|
|
15
|
-
/** Configuration is disabled */
|
|
16
|
-
DISABLED = 'DISABLED',
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* *
|
|
21
|
-
* Log Delivery Output Format
|
|
22
|
-
*/
|
|
23
|
-
export enum LogDeliveryOutputFormat {
|
|
24
|
-
/** Deliver CSV files */
|
|
25
|
-
CSV = 'CSV',
|
|
26
|
-
/** Deliver JSON files */
|
|
27
|
-
JSON = 'JSON',
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* *
|
|
32
|
-
* The status string for log delivery. Possible values are:
|
|
33
|
-
* `CREATED`: There were no log delivery attempts since the config was created.
|
|
34
|
-
* `SUCCEEDED`: The latest attempt of log delivery has succeeded completely.
|
|
35
|
-
* `USER_FAILURE`: The latest attempt of log delivery failed because of misconfiguration of customer provided permissions on role or storage.
|
|
36
|
-
* `SYSTEM_FAILURE`: The latest attempt of log delivery failed because of an <Databricks> internal error. Contact support if it doesn't go away soon.
|
|
37
|
-
* `NOT_FOUND`: The log delivery status as the configuration has been disabled since the release of this feature or there are no workspaces in the account.
|
|
38
|
-
*/
|
|
39
|
-
export enum LogDeliveryStatusEnum {
|
|
40
|
-
/** Configuration is just created and logs haven't delivered yet */
|
|
41
|
-
CREATED = 'CREATED',
|
|
42
|
-
/** Configuration has succeeded in the last run */
|
|
43
|
-
SUCCEEDED = 'SUCCEEDED',
|
|
44
|
-
/** Configuration has failed in the last run due to user failure */
|
|
45
|
-
USER_FAILURE = 'USER_FAILURE',
|
|
46
|
-
/** Configuration has failed in the last run due to system failure */
|
|
47
|
-
SYSTEM_FAILURE = 'SYSTEM_FAILURE',
|
|
48
|
-
/** Status not found */
|
|
49
|
-
NOT_FOUND = 'NOT_FOUND',
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* *
|
|
54
|
-
* Log Delivery Type
|
|
55
|
-
*/
|
|
56
|
-
export enum LogDeliveryType {
|
|
57
|
-
/** Deliver Billable Usage logs */
|
|
58
|
-
BILLABLE_USAGE = 'BILLABLE_USAGE',
|
|
59
|
-
/** Deliver Audit Logs */
|
|
60
|
-
AUDIT_LOGS = 'AUDIT_LOGS',
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* *
|
|
65
|
-
* Log Delivery Configuration
|
|
66
|
-
*/
|
|
67
|
-
export interface CreateLogDeliveryConfigurationParams {
|
|
68
|
-
/** The unique UUID of log delivery configuration */
|
|
69
|
-
configId?: string | undefined;
|
|
70
|
-
/** The optional human-readable name of the log delivery configuration. Defaults to empty. */
|
|
71
|
-
configName?: string | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* Log delivery type. Supported values are:
|
|
74
|
-
* * `BILLABLE_USAGE` — Configure [billable usage log delivery](https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html). For the CSV schema, see the [View billable usage](https://docs.databricks.com/administration-guide/account-settings/usage.html).
|
|
75
|
-
* * `AUDIT_LOGS` — Configure [audit log delivery](https://docs.databricks.com/administration-guide/account-settings/audit-logs.html). For the JSON schema, see [Configure audit logging](https://docs.databricks.com/administration-guide/account-settings/audit-logs.html)
|
|
76
|
-
*/
|
|
77
|
-
logType?: LogDeliveryType | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* The file type of log delivery.
|
|
80
|
-
* * If `log_type` is `BILLABLE_USAGE`, this value must be `CSV`. Only the CSV (comma-separated values) format is supported. For the schema, see the [View billable usage](https://docs.databricks.com/administration-guide/account-settings/usage.html)
|
|
81
|
-
* * If `log_type` is `AUDIT_LOGS`, this value must be `JSON`. Only the JSON (JavaScript Object Notation) format is supported. For the schema, see the [Configuring audit logs](https://docs.databricks.com/administration-guide/account-settings/audit-logs.html).
|
|
82
|
-
*/
|
|
83
|
-
outputFormat?: LogDeliveryOutputFormat | undefined;
|
|
84
|
-
/** <Databricks> account ID. */
|
|
85
|
-
accountId?: string | undefined;
|
|
86
|
-
/** The ID for a method:credentials/create that represents the AWS IAM role with policy and trust relationship as described in the main billable usage documentation page. See [Configure billable usage delivery](https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html). */
|
|
87
|
-
credentialsId?: string | undefined;
|
|
88
|
-
/** The ID for a method:storage/create that represents the S3 bucket with bucket policy as described in the main billable usage documentation page. See [Configure billable usage delivery](https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html). */
|
|
89
|
-
storageConfigurationId?: string | undefined;
|
|
90
|
-
/** Optional filter that specifies workspace IDs to deliver logs for. By default the workspace filter is empty and log delivery applies at the account level, delivering workspace-level logs for all workspaces in your account, plus account level logs. You can optionally set this field to an array of workspace IDs (each one is an `int64`) to which log delivery should apply, in which case only workspace-level logs relating to the specified workspaces are delivered. If you plan to use different log delivery configurations for different workspaces, set this field explicitly. Be aware that delivery configurations mentioning specific workspaces won't apply to new workspaces created in the future, and delivery won't include account level logs. For some types of <Databricks> deployments there is only one workspace per account ID, so this field is unnecessary. */
|
|
91
|
-
workspaceIdsFilter?: bigint[] | undefined;
|
|
92
|
-
/** The optional delivery path prefix within Amazon S3 storage. Defaults to empty, which means that logs are delivered to the root of the bucket. This must be a valid S3 object key. This must not start or end with a slash character. */
|
|
93
|
-
deliveryPathPrefix?: string | undefined;
|
|
94
|
-
/** This field applies only if log_type is BILLABLE_USAGE. This is the optional start month and year for delivery, specified in YYYY-MM format. Defaults to current year and month. BILLABLE_USAGE logs are not available for usage before March 2019 (2019-03). */
|
|
95
|
-
deliveryStartTime?: string | undefined;
|
|
96
|
-
/** Status of log delivery configuration. Set to `ENABLED` (enabled) or `DISABLED` (disabled). Defaults to `ENABLED`. You can [enable or disable the configuration](#operation/patch-log-delivery-config-status) later. Deletion of a configuration is not supported, so disable a log delivery configuration that is no longer needed. */
|
|
97
|
-
status?: LogDeliveryConfigStatus | undefined;
|
|
98
|
-
/** Time in epoch milliseconds when the log delivery configuration was created. */
|
|
99
|
-
creationTime?: bigint | undefined;
|
|
100
|
-
/** Time in epoch milliseconds when the log delivery configuration was updated. */
|
|
101
|
-
updateTime?: bigint | undefined;
|
|
102
|
-
/** The LogDeliveryStatus of this log delivery configuration */
|
|
103
|
-
logDeliveryStatus?: LogDeliveryStatus | undefined;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* *
|
|
108
|
-
* Properties of the new log delivery configuration.
|
|
109
|
-
*/
|
|
110
|
-
export interface CreateLogDeliveryConfigurationRequest {
|
|
111
|
-
logDeliveryConfiguration?: CreateLogDeliveryConfigurationParams | undefined;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export interface CreateLogDeliveryConfigurationResponse {
|
|
115
|
-
/** The created log delivery configuration */
|
|
116
|
-
logDeliveryConfiguration?: LogDeliveryConfiguration | undefined;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* *
|
|
121
|
-
* Get Log Delivery Configuration
|
|
122
|
-
*/
|
|
123
|
-
export interface GetLogDeliveryConfigurationRequest {
|
|
124
|
-
/** The log delivery configuration id of customer */
|
|
125
|
-
configId?: string | undefined;
|
|
126
|
-
/** <Databricks> account ID. */
|
|
127
|
-
accountId?: string | undefined;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export interface GetLogDeliveryConfigurationResponse {
|
|
131
|
-
/** The fetched log delivery configuration */
|
|
132
|
-
logDeliveryConfiguration?: LogDeliveryConfiguration | undefined;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* *
|
|
137
|
-
* List Log Delivery Configuration
|
|
138
|
-
*/
|
|
139
|
-
export interface ListLogDeliveryConfigurationRequest {
|
|
140
|
-
/** <Databricks> account ID. */
|
|
141
|
-
accountId?: string | undefined;
|
|
142
|
-
/** The Credentials id to filter the search results with */
|
|
143
|
-
credentialsId?: string | undefined;
|
|
144
|
-
/** The Storage Configuration id to filter the search results with */
|
|
145
|
-
storageConfigurationId?: string | undefined;
|
|
146
|
-
/** The log delivery status to filter the search results with */
|
|
147
|
-
status?: LogDeliveryConfigStatus | undefined;
|
|
148
|
-
/**
|
|
149
|
-
* A page token received from a previous get all budget configurations call. This token can be used to retrieve the subsequent page.
|
|
150
|
-
* Requests first page if absent.
|
|
151
|
-
*/
|
|
152
|
-
pageToken?: string | undefined;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export interface ListLogDeliveryConfigurationResponse {
|
|
156
|
-
/** Log delivery configurations were returned successfully. */
|
|
157
|
-
logDeliveryConfigurations?: LogDeliveryConfiguration[] | undefined;
|
|
158
|
-
/** Token which can be sent as `page_token` to retrieve the next page of results. If this field is omitted, there are no subsequent budgets. */
|
|
159
|
-
nextPageToken?: string | undefined;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* *
|
|
164
|
-
* Log Delivery Configuration
|
|
165
|
-
*/
|
|
166
|
-
export interface LogDeliveryConfiguration {
|
|
167
|
-
/** The unique UUID of log delivery configuration */
|
|
168
|
-
configId?: string | undefined;
|
|
169
|
-
/** The optional human-readable name of the log delivery configuration. Defaults to empty. */
|
|
170
|
-
configName?: string | undefined;
|
|
171
|
-
/**
|
|
172
|
-
* Log delivery type. Supported values are:
|
|
173
|
-
* * `BILLABLE_USAGE` — Configure [billable usage log delivery](https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html). For the CSV schema, see the [View billable usage](https://docs.databricks.com/administration-guide/account-settings/usage.html).
|
|
174
|
-
* * `AUDIT_LOGS` — Configure [audit log delivery](https://docs.databricks.com/administration-guide/account-settings/audit-logs.html). For the JSON schema, see [Configure audit logging](https://docs.databricks.com/administration-guide/account-settings/audit-logs.html)
|
|
175
|
-
*/
|
|
176
|
-
logType?: LogDeliveryType | undefined;
|
|
177
|
-
/**
|
|
178
|
-
* The file type of log delivery.
|
|
179
|
-
* * If `log_type` is `BILLABLE_USAGE`, this value must be `CSV`. Only the CSV (comma-separated values) format is supported. For the schema, see the [View billable usage](https://docs.databricks.com/administration-guide/account-settings/usage.html)
|
|
180
|
-
* * If `log_type` is `AUDIT_LOGS`, this value must be `JSON`. Only the JSON (JavaScript Object Notation) format is supported. For the schema, see the [Configuring audit logs](https://docs.databricks.com/administration-guide/account-settings/audit-logs.html).
|
|
181
|
-
*/
|
|
182
|
-
outputFormat?: LogDeliveryOutputFormat | undefined;
|
|
183
|
-
/** <Databricks> account ID. */
|
|
184
|
-
accountId?: string | undefined;
|
|
185
|
-
/** The ID for a method:credentials/create that represents the AWS IAM role with policy and trust relationship as described in the main billable usage documentation page. See [Configure billable usage delivery](https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html). */
|
|
186
|
-
credentialsId?: string | undefined;
|
|
187
|
-
/** The ID for a method:storage/create that represents the S3 bucket with bucket policy as described in the main billable usage documentation page. See [Configure billable usage delivery](https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html). */
|
|
188
|
-
storageConfigurationId?: string | undefined;
|
|
189
|
-
/** Optional filter that specifies workspace IDs to deliver logs for. By default the workspace filter is empty and log delivery applies at the account level, delivering workspace-level logs for all workspaces in your account, plus account level logs. You can optionally set this field to an array of workspace IDs (each one is an `int64`) to which log delivery should apply, in which case only workspace-level logs relating to the specified workspaces are delivered. If you plan to use different log delivery configurations for different workspaces, set this field explicitly. Be aware that delivery configurations mentioning specific workspaces won't apply to new workspaces created in the future, and delivery won't include account level logs. For some types of <Databricks> deployments there is only one workspace per account ID, so this field is unnecessary. */
|
|
190
|
-
workspaceIdsFilter?: bigint[] | undefined;
|
|
191
|
-
/** The optional delivery path prefix within Amazon S3 storage. Defaults to empty, which means that logs are delivered to the root of the bucket. This must be a valid S3 object key. This must not start or end with a slash character. */
|
|
192
|
-
deliveryPathPrefix?: string | undefined;
|
|
193
|
-
/** This field applies only if log_type is BILLABLE_USAGE. This is the optional start month and year for delivery, specified in YYYY-MM format. Defaults to current year and month. BILLABLE_USAGE logs are not available for usage before March 2019 (2019-03). */
|
|
194
|
-
deliveryStartTime?: string | undefined;
|
|
195
|
-
/** Status of log delivery configuration. Set to `ENABLED` (enabled) or `DISABLED` (disabled). Defaults to `ENABLED`. You can [enable or disable the configuration](#operation/patch-log-delivery-config-status) later. Deletion of a configuration is not supported, so disable a log delivery configuration that is no longer needed. */
|
|
196
|
-
status?: LogDeliveryConfigStatus | undefined;
|
|
197
|
-
/** Time in epoch milliseconds when the log delivery configuration was created. */
|
|
198
|
-
creationTime?: bigint | undefined;
|
|
199
|
-
/** Time in epoch milliseconds when the log delivery configuration was updated. */
|
|
200
|
-
updateTime?: bigint | undefined;
|
|
201
|
-
/** The LogDeliveryStatus of this log delivery configuration */
|
|
202
|
-
logDeliveryStatus?: LogDeliveryStatus | undefined;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export interface LogDeliveryStatus {
|
|
206
|
-
/**
|
|
207
|
-
* Enum that describes the status. Possible values are:
|
|
208
|
-
* * `CREATED`: There were no log delivery attempts since the config was created.
|
|
209
|
-
* * `SUCCEEDED`: The latest attempt of log delivery has succeeded completely.
|
|
210
|
-
* * `USER_FAILURE`: The latest attempt of log delivery failed because of misconfiguration of customer provided permissions on role or storage.
|
|
211
|
-
* * `SYSTEM_FAILURE`: The latest attempt of log delivery failed because of an <Databricks> internal error. Contact support if it doesn't go away soon.
|
|
212
|
-
* * `NOT_FOUND`: The log delivery status as the configuration has been disabled since the release of this feature or there are no workspaces in the account.
|
|
213
|
-
*/
|
|
214
|
-
status?: LogDeliveryStatusEnum | undefined;
|
|
215
|
-
/** The UTC time for the latest log delivery attempt. */
|
|
216
|
-
lastAttemptTime?: string | undefined;
|
|
217
|
-
/** The UTC time for the latest successful log delivery. */
|
|
218
|
-
lastSuccessfulAttemptTime?: string | undefined;
|
|
219
|
-
/** Informative message about the latest log delivery attempt. If the log delivery fails with USER_FAILURE, error details will be provided for fixing misconfigurations in cloud permissions. */
|
|
220
|
-
message?: string | undefined;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* *
|
|
225
|
-
* Update Log Delivery Configuration
|
|
226
|
-
*/
|
|
227
|
-
export interface UpdateLogDeliveryConfigurationRequest {
|
|
228
|
-
/** The log delivery configuration id of customer */
|
|
229
|
-
configId?: string | undefined;
|
|
230
|
-
/** <Databricks> account ID of any type. For non-E2 account types, get your account ID from the [Accounts Console](https://docs.databricks.com/administration-guide/account-settings/usage.html). */
|
|
231
|
-
accountId?: string | undefined;
|
|
232
|
-
/** Status of log delivery configuration. Set to `ENABLED` (enabled) or `DISABLED` (disabled). Defaults to `ENABLED`. You can [enable or disable the configuration](#operation/patch-log-delivery-config-status) later. Deletion of a configuration is not supported, so disable a log delivery configuration that is no longer needed. */
|
|
233
|
-
status?: LogDeliveryConfigStatus | undefined;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
237
|
-
export interface UpdateLogDeliveryConfigurationResponse {}
|
|
238
|
-
|
|
239
|
-
export const unmarshalCreateLogDeliveryConfigurationResponseSchema: z.ZodType<CreateLogDeliveryConfigurationResponse> =
|
|
240
|
-
z
|
|
241
|
-
.object({
|
|
242
|
-
log_delivery_configuration: z
|
|
243
|
-
.lazy(() => unmarshalLogDeliveryConfigurationSchema)
|
|
244
|
-
.optional(),
|
|
245
|
-
})
|
|
246
|
-
.transform(d => ({
|
|
247
|
-
logDeliveryConfiguration: d.log_delivery_configuration,
|
|
248
|
-
}));
|
|
249
|
-
|
|
250
|
-
export const unmarshalGetLogDeliveryConfigurationResponseSchema: z.ZodType<GetLogDeliveryConfigurationResponse> =
|
|
251
|
-
z
|
|
252
|
-
.object({
|
|
253
|
-
log_delivery_configuration: z
|
|
254
|
-
.lazy(() => unmarshalLogDeliveryConfigurationSchema)
|
|
255
|
-
.optional(),
|
|
256
|
-
})
|
|
257
|
-
.transform(d => ({
|
|
258
|
-
logDeliveryConfiguration: d.log_delivery_configuration,
|
|
259
|
-
}));
|
|
260
|
-
|
|
261
|
-
export const unmarshalListLogDeliveryConfigurationResponseSchema: z.ZodType<ListLogDeliveryConfigurationResponse> =
|
|
262
|
-
z
|
|
263
|
-
.object({
|
|
264
|
-
log_delivery_configurations: z
|
|
265
|
-
.array(z.lazy(() => unmarshalLogDeliveryConfigurationSchema))
|
|
266
|
-
.optional(),
|
|
267
|
-
next_page_token: z.string().optional(),
|
|
268
|
-
})
|
|
269
|
-
.transform(d => ({
|
|
270
|
-
logDeliveryConfigurations: d.log_delivery_configurations,
|
|
271
|
-
nextPageToken: d.next_page_token,
|
|
272
|
-
}));
|
|
273
|
-
|
|
274
|
-
export const unmarshalLogDeliveryConfigurationSchema: z.ZodType<LogDeliveryConfiguration> =
|
|
275
|
-
z
|
|
276
|
-
.object({
|
|
277
|
-
config_id: z.string().optional(),
|
|
278
|
-
config_name: z.string().optional(),
|
|
279
|
-
log_type: z.enum(LogDeliveryType).optional(),
|
|
280
|
-
output_format: z.enum(LogDeliveryOutputFormat).optional(),
|
|
281
|
-
account_id: z.string().optional(),
|
|
282
|
-
credentials_id: z.string().optional(),
|
|
283
|
-
storage_configuration_id: z.string().optional(),
|
|
284
|
-
workspace_ids_filter: z
|
|
285
|
-
.array(z.union([z.number(), z.bigint()]).transform(v => BigInt(v)))
|
|
286
|
-
.optional(),
|
|
287
|
-
delivery_path_prefix: z.string().optional(),
|
|
288
|
-
delivery_start_time: z.string().optional(),
|
|
289
|
-
status: z.enum(LogDeliveryConfigStatus).optional(),
|
|
290
|
-
creation_time: z
|
|
291
|
-
.union([z.number(), z.bigint()])
|
|
292
|
-
.transform(v => BigInt(v))
|
|
293
|
-
.optional(),
|
|
294
|
-
update_time: z
|
|
295
|
-
.union([z.number(), z.bigint()])
|
|
296
|
-
.transform(v => BigInt(v))
|
|
297
|
-
.optional(),
|
|
298
|
-
log_delivery_status: z
|
|
299
|
-
.lazy(() => unmarshalLogDeliveryStatusSchema)
|
|
300
|
-
.optional(),
|
|
301
|
-
})
|
|
302
|
-
.transform(d => ({
|
|
303
|
-
configId: d.config_id,
|
|
304
|
-
configName: d.config_name,
|
|
305
|
-
logType: d.log_type,
|
|
306
|
-
outputFormat: d.output_format,
|
|
307
|
-
accountId: d.account_id,
|
|
308
|
-
credentialsId: d.credentials_id,
|
|
309
|
-
storageConfigurationId: d.storage_configuration_id,
|
|
310
|
-
workspaceIdsFilter: d.workspace_ids_filter,
|
|
311
|
-
deliveryPathPrefix: d.delivery_path_prefix,
|
|
312
|
-
deliveryStartTime: d.delivery_start_time,
|
|
313
|
-
status: d.status,
|
|
314
|
-
creationTime: d.creation_time,
|
|
315
|
-
updateTime: d.update_time,
|
|
316
|
-
logDeliveryStatus: d.log_delivery_status,
|
|
317
|
-
}));
|
|
318
|
-
|
|
319
|
-
export const unmarshalLogDeliveryStatusSchema: z.ZodType<LogDeliveryStatus> = z
|
|
320
|
-
.object({
|
|
321
|
-
status: z.enum(LogDeliveryStatusEnum).optional(),
|
|
322
|
-
last_attempt_time: z.string().optional(),
|
|
323
|
-
last_successful_attempt_time: z.string().optional(),
|
|
324
|
-
message: z.string().optional(),
|
|
325
|
-
})
|
|
326
|
-
.transform(d => ({
|
|
327
|
-
status: d.status,
|
|
328
|
-
lastAttemptTime: d.last_attempt_time,
|
|
329
|
-
lastSuccessfulAttemptTime: d.last_successful_attempt_time,
|
|
330
|
-
message: d.message,
|
|
331
|
-
}));
|
|
332
|
-
|
|
333
|
-
export const unmarshalUpdateLogDeliveryConfigurationResponseSchema: z.ZodType<UpdateLogDeliveryConfigurationResponse> =
|
|
334
|
-
z.object({});
|
|
335
|
-
|
|
336
|
-
export const marshalCreateLogDeliveryConfigurationParamsSchema: z.ZodType = z
|
|
337
|
-
.object({
|
|
338
|
-
configId: z.string().optional(),
|
|
339
|
-
configName: z.string().optional(),
|
|
340
|
-
logType: z.enum(LogDeliveryType).optional(),
|
|
341
|
-
outputFormat: z.enum(LogDeliveryOutputFormat).optional(),
|
|
342
|
-
accountId: z.string().optional(),
|
|
343
|
-
credentialsId: z.string().optional(),
|
|
344
|
-
storageConfigurationId: z.string().optional(),
|
|
345
|
-
workspaceIdsFilter: z.array(z.bigint()).optional(),
|
|
346
|
-
deliveryPathPrefix: z.string().optional(),
|
|
347
|
-
deliveryStartTime: z.string().optional(),
|
|
348
|
-
status: z.enum(LogDeliveryConfigStatus).optional(),
|
|
349
|
-
creationTime: z.bigint().optional(),
|
|
350
|
-
updateTime: z.bigint().optional(),
|
|
351
|
-
logDeliveryStatus: z.lazy(() => marshalLogDeliveryStatusSchema).optional(),
|
|
352
|
-
})
|
|
353
|
-
.transform(d => ({
|
|
354
|
-
config_id: d.configId,
|
|
355
|
-
config_name: d.configName,
|
|
356
|
-
log_type: d.logType,
|
|
357
|
-
output_format: d.outputFormat,
|
|
358
|
-
account_id: d.accountId,
|
|
359
|
-
credentials_id: d.credentialsId,
|
|
360
|
-
storage_configuration_id: d.storageConfigurationId,
|
|
361
|
-
workspace_ids_filter: d.workspaceIdsFilter,
|
|
362
|
-
delivery_path_prefix: d.deliveryPathPrefix,
|
|
363
|
-
delivery_start_time: d.deliveryStartTime,
|
|
364
|
-
status: d.status,
|
|
365
|
-
creation_time: d.creationTime,
|
|
366
|
-
update_time: d.updateTime,
|
|
367
|
-
log_delivery_status: d.logDeliveryStatus,
|
|
368
|
-
}));
|
|
369
|
-
|
|
370
|
-
export const marshalCreateLogDeliveryConfigurationRequestSchema: z.ZodType = z
|
|
371
|
-
.object({
|
|
372
|
-
logDeliveryConfiguration: z
|
|
373
|
-
.lazy(() => marshalCreateLogDeliveryConfigurationParamsSchema)
|
|
374
|
-
.optional(),
|
|
375
|
-
})
|
|
376
|
-
.transform(d => ({
|
|
377
|
-
log_delivery_configuration: d.logDeliveryConfiguration,
|
|
378
|
-
}));
|
|
379
|
-
|
|
380
|
-
export const marshalLogDeliveryStatusSchema: z.ZodType = z
|
|
381
|
-
.object({
|
|
382
|
-
status: z.enum(LogDeliveryStatusEnum).optional(),
|
|
383
|
-
lastAttemptTime: z.string().optional(),
|
|
384
|
-
lastSuccessfulAttemptTime: z.string().optional(),
|
|
385
|
-
message: z.string().optional(),
|
|
386
|
-
})
|
|
387
|
-
.transform(d => ({
|
|
388
|
-
status: d.status,
|
|
389
|
-
last_attempt_time: d.lastAttemptTime,
|
|
390
|
-
last_successful_attempt_time: d.lastSuccessfulAttemptTime,
|
|
391
|
-
message: d.message,
|
|
392
|
-
}));
|
|
393
|
-
|
|
394
|
-
export const marshalUpdateLogDeliveryConfigurationRequestSchema: z.ZodType = z
|
|
395
|
-
.object({
|
|
396
|
-
configId: z.string().optional(),
|
|
397
|
-
accountId: z.string().optional(),
|
|
398
|
-
status: z.enum(LogDeliveryConfigStatus).optional(),
|
|
399
|
-
})
|
|
400
|
-
.transform(d => ({
|
|
401
|
-
config_id: d.configId,
|
|
402
|
-
account_id: d.accountId,
|
|
403
|
-
status: d.status,
|
|
404
|
-
}));
|
package/src/v1/transport.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import type {Credentials} from '@databricks/sdk-auth';
|
|
4
|
-
import {defaultCredentials} from '@databricks/sdk-auth/credentials';
|
|
5
|
-
import type {
|
|
6
|
-
HttpClient,
|
|
7
|
-
HttpRequest,
|
|
8
|
-
HttpResponse,
|
|
9
|
-
} from '@databricks/sdk-core/http';
|
|
10
|
-
import {newFetchHttpClient} from '@databricks/sdk-core/http';
|
|
11
|
-
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
12
|
-
|
|
13
|
-
/** Creates a new HTTP client with the given options. */
|
|
14
|
-
export function newHttpClient(options?: ClientOptions): HttpClient {
|
|
15
|
-
const opts = options ?? {};
|
|
16
|
-
|
|
17
|
-
// If an HTTP client is provided, use it as-is. Throw if other options are
|
|
18
|
-
// also set, since they would be silently ignored.
|
|
19
|
-
if (opts.httpClient !== undefined) {
|
|
20
|
-
if (opts.credentials !== undefined || opts.timeout !== undefined) {
|
|
21
|
-
throw new Error(
|
|
22
|
-
'httpClient cannot be combined with credentials or timeout'
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
return opts.httpClient;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const credentials = opts.credentials ?? defaultCredentials();
|
|
29
|
-
|
|
30
|
-
const base = newFetchHttpClient();
|
|
31
|
-
let client: HttpClient = new AuthHttpClient(base, credentials);
|
|
32
|
-
|
|
33
|
-
if (opts.timeout !== undefined) {
|
|
34
|
-
client = new TimeoutHttpClient(client, opts.timeout);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return client;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** Wraps an HttpClient and adds authentication headers to requests. */
|
|
41
|
-
class AuthHttpClient implements HttpClient {
|
|
42
|
-
constructor(
|
|
43
|
-
private readonly base: HttpClient,
|
|
44
|
-
private readonly credentials: Credentials
|
|
45
|
-
) {}
|
|
46
|
-
|
|
47
|
-
async send(request: HttpRequest): Promise<HttpResponse> {
|
|
48
|
-
const authHeaders = await this.credentials.authHeaders();
|
|
49
|
-
// Do not modify the original request.
|
|
50
|
-
const headers = new Headers(request.headers);
|
|
51
|
-
for (const h of authHeaders) {
|
|
52
|
-
headers.set(h.key, h.value);
|
|
53
|
-
}
|
|
54
|
-
return this.base.send({...request, headers});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Wraps an HttpClient and applies a default timeout to requests. */
|
|
59
|
-
class TimeoutHttpClient implements HttpClient {
|
|
60
|
-
constructor(
|
|
61
|
-
private readonly base: HttpClient,
|
|
62
|
-
private readonly timeout: number
|
|
63
|
-
) {}
|
|
64
|
-
|
|
65
|
-
async send(request: HttpRequest): Promise<HttpResponse> {
|
|
66
|
-
const timeoutSignal = AbortSignal.timeout(this.timeout);
|
|
67
|
-
const signal =
|
|
68
|
-
request.signal !== undefined
|
|
69
|
-
? AbortSignal.any([request.signal, timeoutSignal])
|
|
70
|
-
: timeoutSignal;
|
|
71
|
-
return this.base.send({...request, signal});
|
|
72
|
-
}
|
|
73
|
-
}
|
package/src/v1/utils.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import type {Options} from '@databricks/sdk-core/ops';
|
|
4
|
-
import {execute} from '@databricks/sdk-core/ops';
|
|
5
|
-
import {ApiError} from '@databricks/sdk-core/apierror';
|
|
6
|
-
import type {
|
|
7
|
-
HttpClient,
|
|
8
|
-
HttpRequest,
|
|
9
|
-
HttpResponse,
|
|
10
|
-
} from '@databricks/sdk-core/http';
|
|
11
|
-
import type {Logger} from '@databricks/sdk-core/logger';
|
|
12
|
-
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
13
|
-
import JSONBig from 'json-bigint';
|
|
14
|
-
import type {z} from 'zod';
|
|
15
|
-
|
|
16
|
-
// JSON codec that preserves int64 precision. On the way in, large integer
|
|
17
|
-
// literals come back as bigint instead of being rounded to JS Number. On the
|
|
18
|
-
// way out, bigint values are emitted as raw JSON number digits.
|
|
19
|
-
const jsonBigint = JSONBig({useNativeBigInt: true});
|
|
20
|
-
|
|
21
|
-
export interface HttpCallOptions {
|
|
22
|
-
readonly request: HttpRequest;
|
|
23
|
-
readonly httpClient: HttpClient;
|
|
24
|
-
readonly logger: Logger;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Translates public CallOptions to the internal Options shape accepted by
|
|
29
|
-
* execute(). Even though the shapes match today, this isolates the public
|
|
30
|
-
* API from the executor's internal type so they can diverge.
|
|
31
|
-
*/
|
|
32
|
-
export async function executeCall(
|
|
33
|
-
call: (signal?: AbortSignal) => Promise<void>,
|
|
34
|
-
options?: CallOptions
|
|
35
|
-
): Promise<void> {
|
|
36
|
-
const opts: Options = {
|
|
37
|
-
...(options?.retrier !== undefined && {retrier: options.retrier}),
|
|
38
|
-
...(options?.rateLimiter !== undefined && {
|
|
39
|
-
rateLimiter: options.rateLimiter,
|
|
40
|
-
}),
|
|
41
|
-
...(options?.timeout !== undefined && {timeout: options.timeout}),
|
|
42
|
-
};
|
|
43
|
-
return execute(options?.signal, call, opts);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async function readAll(
|
|
47
|
-
body: ReadableStream<Uint8Array> | null
|
|
48
|
-
): Promise<Uint8Array> {
|
|
49
|
-
if (body === null) {
|
|
50
|
-
return new Uint8Array(0);
|
|
51
|
-
}
|
|
52
|
-
const reader = body.getReader();
|
|
53
|
-
const chunks: Uint8Array[] = [];
|
|
54
|
-
for (;;) {
|
|
55
|
-
const {done, value} = await reader.read();
|
|
56
|
-
if (done) {
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
chunks.push(value);
|
|
60
|
-
}
|
|
61
|
-
const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
|
|
62
|
-
const result = new Uint8Array(totalLength);
|
|
63
|
-
let offset = 0;
|
|
64
|
-
for (const chunk of chunks) {
|
|
65
|
-
result.set(chunk, offset);
|
|
66
|
-
offset += chunk.length;
|
|
67
|
-
}
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export async function executeHttpCall(
|
|
72
|
-
opts: HttpCallOptions
|
|
73
|
-
): Promise<Uint8Array> {
|
|
74
|
-
opts.logger.debug('HTTP request', {
|
|
75
|
-
method: opts.request.method,
|
|
76
|
-
url: opts.request.url,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
let resp: HttpResponse;
|
|
80
|
-
try {
|
|
81
|
-
resp = await opts.httpClient.send(opts.request);
|
|
82
|
-
} catch (e: unknown) {
|
|
83
|
-
opts.logger.debug('HTTP request failed');
|
|
84
|
-
throw e;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const body = await readAll(resp.body);
|
|
88
|
-
|
|
89
|
-
opts.logger.debug('HTTP response', {
|
|
90
|
-
statusCode: resp.statusCode,
|
|
91
|
-
body: new TextDecoder().decode(body),
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
const apiErr = ApiError.fromHttpError(resp.statusCode, resp.headers, body);
|
|
95
|
-
if (apiErr !== undefined) {
|
|
96
|
-
throw apiErr;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return body;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export function buildHttpRequest(
|
|
103
|
-
method: string,
|
|
104
|
-
url: string,
|
|
105
|
-
headers: Headers,
|
|
106
|
-
signal?: AbortSignal,
|
|
107
|
-
body?: string | ReadableStream<Uint8Array>
|
|
108
|
-
): HttpRequest {
|
|
109
|
-
const req: HttpRequest = {url, method, headers};
|
|
110
|
-
if (body !== undefined) {
|
|
111
|
-
req.body = body;
|
|
112
|
-
}
|
|
113
|
-
if (signal !== undefined) {
|
|
114
|
-
req.signal = signal;
|
|
115
|
-
}
|
|
116
|
-
return req;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T {
|
|
120
|
-
const text = new TextDecoder().decode(body);
|
|
121
|
-
const parsed: unknown = jsonBigint.parse(text);
|
|
122
|
-
return schema.parse(parsed);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export function marshalRequest(data: unknown, schema: z.ZodType): string {
|
|
126
|
-
return jsonBigint.stringify(schema.parse(data));
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export function flattenQueryParams(
|
|
130
|
-
prefix: string,
|
|
131
|
-
value: unknown,
|
|
132
|
-
params: URLSearchParams
|
|
133
|
-
): void {
|
|
134
|
-
if (value === null || value === undefined) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (Array.isArray(value)) {
|
|
138
|
-
// arrays of objects are not yet supported
|
|
139
|
-
for (const item of value) {
|
|
140
|
-
params.append(prefix, String(item));
|
|
141
|
-
}
|
|
142
|
-
} else if (typeof value === 'object') {
|
|
143
|
-
for (const [key, val] of Object.entries(value as Record<string, unknown>)) {
|
|
144
|
-
flattenQueryParams(`${prefix}.${key}`, val, params);
|
|
145
|
-
}
|
|
146
|
-
} else if (
|
|
147
|
-
typeof value === 'string' ||
|
|
148
|
-
typeof value === 'number' ||
|
|
149
|
-
typeof value === 'boolean' ||
|
|
150
|
-
typeof value === 'bigint'
|
|
151
|
-
) {
|
|
152
|
-
params.append(prefix, String(value));
|
|
153
|
-
} else {
|
|
154
|
-
throw new Error(`Unsupported query parameter type: ${typeof value}`);
|
|
155
|
-
}
|
|
156
|
-
}
|