Skip to content

Commit 205d86f

Browse files
authored
SDK: Add workspace conf APIs (#121)
1 parent 5a14007 commit 205d86f

16 files changed

Lines changed: 223 additions & 137 deletions

File tree

packages/databricks-sdk-js/src/apis/.codegen.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"Repos",
66
"Workspace",
77
"Dbfs",
8-
"Permissions"
8+
"Permissions",
9+
"Workspace Conf"
910
],
1011
"formatter": "yarn fix",
1112
"packages": {

packages/databricks-sdk-js/src/apis/.codegen/model.ts.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
{{end}}{{.SnakeName}}{{if not .Required}}?{{end}}: {{template "type" .Entity}};{{end}}
1515
}
16-
16+
{{else if .MapValue}}export type {{.PascalName}} = {{template "type" .}};
1717
{{else if .Enum}}export type {{.PascalName}} =
1818
{{range $i, $e:=.Enum }}{{if $e.Comment "" 80}}/**
1919
{{$e.Comment "* " 80}}

packages/databricks-sdk-js/src/apis/clusters/model.ts

Lines changed: 38 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -137,29 +137,6 @@ export type AwsAttributesEbsVolumeType =
137137
| "GENERAL_PURPOSE_SSD"
138138
| "THROUGHPUT_OPTIMIZED_HDD";
139139

140-
export interface AwsCpalError {
141-
/**
142-
* <needs content added>
143-
*/
144-
aws_api_error_code?: string;
145-
/**
146-
* <needs content added>
147-
*/
148-
aws_error_message?: string;
149-
/**
150-
* <needs content added>
151-
*/
152-
aws_instance_state_reason?: string;
153-
/**
154-
* <needs content added>
155-
*/
156-
aws_spot_request_fault_code?: string;
157-
/**
158-
* <needs content added>
159-
*/
160-
aws_spot_request_status?: string;
161-
}
162-
163140
export interface AzureAttributes {
164141
/**
165142
* Availability type used for all subsequent nodes past the
@@ -549,10 +526,7 @@ export interface ClusterInfo {
549526
* subset of the cluster tags
550527
*/
551528
custom_tags?: Record<string, string>;
552-
/**
553-
* The data isolation level for UC data
554-
*/
555-
data_security_mode?: ClusterInfoDataSecurityMode;
529+
data_security_mode?: DataSecurityMode;
556530
/**
557531
* Tags that are added by Databricks regardless of any ``custom_tags``,
558532
* including:
@@ -673,7 +647,7 @@ export interface ClusterInfo {
673647
*/
674648
runtime_engine?: ClusterInfoRuntimeEngine;
675649
/**
676-
* Single user name if data_security_mode is 'SINGLE_USER'
650+
* Single user name if data_security_mode is `SINGLE_USER`
677651
*/
678652
single_user_name?: string;
679653
/**
@@ -759,14 +733,6 @@ export type ClusterInfoClusterSource =
759733
| "SQL"
760734
| "UI";
761735

762-
/**
763-
* The data isolation level for UC data
764-
*/
765-
export type ClusterInfoDataSecurityMode =
766-
| "NONE"
767-
| "SINGLE_USER"
768-
| "USER_ISOLATION";
769-
770736
/**
771737
* Decides which runtime engine to be use, e.g. Standard vs. Photon. If
772738
* unspecified, the runtime engine is inferred from spark_version.
@@ -824,87 +790,6 @@ export interface ClusterSize {
824790
num_workers?: number;
825791
}
826792

827-
export interface CpalFailureResponse {
828-
/**
829-
* <needs content added>
830-
*/
831-
aws_cpal_error_code?: CpalFailureResponseAwsCpalErrorCode;
832-
/**
833-
* <needs content added>
834-
*/
835-
aws_error?: AwsCpalError;
836-
/**
837-
* <needs content added>
838-
*/
839-
azure_cpal_error_code?: CpalFailureResponseAzureCpalErrorCode;
840-
/**
841-
* Deprecated after using cloud_provider_error field TODO define
842-
* AzureCpalError with code and message
843-
*/
844-
cloud_provider_error_code?: string;
845-
/**
846-
* Deprecated after using cloud_provider_error field TODO define
847-
* AzureCpalError with code and message
848-
*/
849-
cloud_provider_error_message?: string;
850-
/**
851-
* <needs content added>
852-
*/
853-
delegate_error_code?: CpalFailureResponseDelegateErrorCode;
854-
/**
855-
* <needs content added>
856-
*/
857-
error_message?: string;
858-
/**
859-
* <needs content added>
860-
*/
861-
stack_trace?: string;
862-
}
863-
864-
/**
865-
* <needs content added>
866-
*/
867-
export type CpalFailureResponseAwsCpalErrorCode =
868-
| "AWS_INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET_FAILURE"
869-
| "AWS_INSUFFICIENT_INSTANCE_CAPACITY_FAILURE"
870-
| "AWS_INVALID_INSTANCE_TYPE_FAILURE"
871-
| "AWS_MAX_SPOT_INSTANCE_COUNT_EXCEEDED"
872-
| "AWS_REQUEST_LIMIT_EXCEEDED"
873-
| "AWS_SERVICE_EXCEPTION"
874-
| "AWS_SPOT_REQUEST_FAILED"
875-
| "AWS_UNEXPECTED_EXCEPTION"
876-
| "AWS_UNEXPECTED_INSTANCE_STATE"
877-
| "AWS_UNSUPPORTED_INSTANCE_TYPE_FAILURE";
878-
879-
/**
880-
* <needs content added>
881-
*/
882-
export type CpalFailureResponseAzureCpalErrorCode =
883-
| "AZURE_AUTHENTICATION_EXCEPTION"
884-
| "AZURE_CLOUD_EXCEPTION"
885-
| "AZURE_INVALID_DEPLOYMENT_TEMPLATE"
886-
| "AZURE_LOAD_BALANCER_CONFIGURATION_EXCEPTION"
887-
| "AZURE_NOT_RUNNING_VM_EXCEPTION"
888-
| "AZURE_NULL_POINTER"
889-
| "AZURE_OPERATION_NOT_ALLOWED_EXCEPTION"
890-
| "AZURE_QUOTA_EXCEEDED_EXCEPTION"
891-
| "AZURE_RESOURCE_MANAGER_THROTTLING"
892-
| "AZURE_RESOURCE_PROVIDER_THROTTLING"
893-
| "AZURE_SERVER_EXCEPTION"
894-
| "AZURE_SERVER_UNREACHABLE"
895-
| "AZURE_SPOT_REQUEST_EXCEPTION"
896-
| "AZURE_SUBNET_EXHAUSTED_FAILURE"
897-
| "AZURE_UNEXPECTED_DEPLOYMENT_TEMPLATE_FAILURE"
898-
| "AZURE_UNKNOWN_EXCEPTION"
899-
| "AZURE_VNET_CONFIGURATION_EXCEPTION";
900-
901-
/**
902-
* <needs content added>
903-
*/
904-
export type CpalFailureResponseDelegateErrorCode =
905-
| "DELEGATE_UNEXPECTED_EXCEPTION"
906-
| "NO_SUCH_WORKER_ENVIRONMENT_EXCEPTION";
907-
908793
export interface CreateCluster {
909794
/**
910795
* Note: This field won't be true for webapp requests. Only API users will
@@ -1136,6 +1021,42 @@ export type DataPlaneEventDetailsEventType =
11361021
| "NODE_BLACKLISTED"
11371022
| "NODE_EXCLUDED_DECOMMISSIONED";
11381023

1024+
/**
1025+
* This describes an enum
1026+
*/
1027+
export type DataSecurityMode =
1028+
/**
1029+
* This mode is for users migrating from legacy Passthrough on high concurrency
1030+
* clusters.
1031+
*/
1032+
| "LEGACY_PASSTHROUGH"
1033+
/**
1034+
* This mode is for users migrating from legacy Passthrough on standard clusters.
1035+
*/
1036+
| "LEGACY_SINGLE_USER"
1037+
/**
1038+
* This mode is for users migrating from legacy Table ACL clusters.
1039+
*/
1040+
| "LEGACY_TABLE_ACL"
1041+
/**
1042+
* No security isolation for multiple users sharing the cluster. Data governance
1043+
* features are not available in this mode.
1044+
*/
1045+
| "NONE"
1046+
/**
1047+
* A secure cluster that can only be exclusively used by a single user specified
1048+
* in `single_user_name`. Most programming languages, cluster features and data
1049+
* governance features are available in this mode.
1050+
*/
1051+
| "SINGLE_USER"
1052+
/**
1053+
* A secure cluster that can be shared by multiple users. Cluster users are fully
1054+
* isolated so that they cannot see each other's data and credentials. Most data
1055+
* governance features are supported in this mode. But programming languages and
1056+
* cluster features might be limited.
1057+
*/
1058+
| "USER_ISOLATION";
1059+
11391060
export interface DbfsStorageInfo {
11401061
/**
11411062
* dbfs destination, e.g. ``dbfs:/my/path``
@@ -1600,18 +1521,10 @@ export interface ListClustersResponse {
16001521
}
16011522

16021523
export interface ListNodeTypesResponse {
1603-
/**
1604-
* <needs content added>
1605-
*/
1606-
failure?: CpalFailureResponse;
16071524
/**
16081525
* The list of available Spark node types.
16091526
*/
16101527
node_types?: Array<NodeType>;
1611-
/**
1612-
* <needs content added>
1613-
*/
1614-
success?: any /* MISSING TYPE */;
16151528
}
16161529

16171530
export interface LogAnalyticsInfo {
@@ -2003,7 +1916,6 @@ export interface ListRequest {
20031916
}
20041917

20051918
export interface ChangeClusterOwnerResponse {}
2006-
export interface CpalSuccessResponse {}
20071919
export interface DeleteClusterResponse {}
20081920
export interface EditClusterResponse {}
20091921
export interface PermanentDeleteClusterResponse {}

packages/databricks-sdk-js/src/apis/jobs/model.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ export interface ClusterSpec {
296296
* characters, inclusive. The value length must be less than or equal to 255
297297
* UTF-8 characters.
298298
*/
299+
export type ClusterTag = Record<string, string>;
299300

300301
export interface CreateJob {
301302
/**
@@ -1850,11 +1851,13 @@ export interface S3StorageInfo {
18501851
* An arbitrary object where the object key is a configuration propery name and
18511852
* the value is a configuration property value.
18521853
*/
1854+
export type SparkConfPair = Record<string, any /* MISSING TYPE */>;
18531855

18541856
/**
18551857
* An arbitrary object where the object key is an environment variable name and
18561858
* the value is an environment variable value.
18571859
*/
1860+
export type SparkEnvPair = Record<string, any /* MISSING TYPE */>;
18581861

18591862
export interface SparkJarTask {
18601863
/**

packages/databricks-sdk-js/src/apis/repos/api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ export class ReposService {
4747
}
4848

4949
/**
50-
* Deletes the repo
50+
* Delete a repo
5151
*
52-
* Deletes the specified repo
52+
* Deletes the specified repo.
5353
*/
5454
async delete(
5555
request: model.DeleteRequest,
@@ -102,7 +102,7 @@ export class ReposService {
102102
}
103103

104104
/**
105-
* Updates the repo to the given branch or tag
105+
* Update a repo
106106
*
107107
* Updates the repo to a different branch or tag, or updates the repo to the
108108
* latest commit on the same branch.

packages/databricks-sdk-js/src/apis/repos/model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface UpdateRepo {
2828
/**
2929
* The ID for the corresponding repo to access.
3030
*/
31-
repo_id: string;
31+
repo_id: number;
3232
tag?: string;
3333
}
3434

@@ -40,14 +40,14 @@ export interface DeleteRequest {
4040
/**
4141
* The ID for the corresponding repo to access.
4242
*/
43-
repo_id: string;
43+
repo_id: number;
4444
}
4545

4646
export interface GetRequest {
4747
/**
4848
* The ID for the corresponding repo to access.
4949
*/
50-
repo_id: string;
50+
repo_id: number;
5151
}
5252

5353
/**
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/* eslint-disable @typescript-eslint/naming-convention */
2+
3+
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
4+
5+
import {ApiClient} from "../../api-client";
6+
import * as model from "./model";
7+
import Time from "../../retries/Time";
8+
import retry from "../../retries/retries";
9+
import {CancellationToken} from "../../types";
10+
import {ApiError, ApiRetriableError} from "../apiError";
11+
12+
export class WorkspaceConfRetriableError extends ApiRetriableError {
13+
constructor(method: string, message?: string) {
14+
super("WorkspaceConf", method, message);
15+
}
16+
}
17+
export class WorkspaceConfError extends ApiError {
18+
constructor(method: string, message?: string) {
19+
super("WorkspaceConf", method, message);
20+
}
21+
}
22+
23+
/**
24+
25+
*/
26+
export class WorkspaceConfService {
27+
constructor(readonly client: ApiClient) {}
28+
/**
29+
* Check configuration status
30+
*
31+
* Gets the configuration status for a workspace.
32+
*/
33+
async getStatus(
34+
request: model.GetStatusRequest,
35+
cancellationToken?: CancellationToken
36+
): Promise<model.WorkspaceConf> {
37+
const path = "/api/2.0/workspace-conf";
38+
return (await this.client.request(
39+
path,
40+
"GET",
41+
request,
42+
cancellationToken
43+
)) as model.WorkspaceConf;
44+
}
45+
46+
/**
47+
* Enable/disable features
48+
*
49+
* Sets the configuration status for a workspace, including enabling or
50+
* disabling it.
51+
*/
52+
async setStatus(
53+
request: model.WorkspaceConf,
54+
cancellationToken?: CancellationToken
55+
): Promise<model.SetStatusResponse> {
56+
const path = "/api/2.0/workspace-conf";
57+
return (await this.client.request(
58+
path,
59+
"PATCH",
60+
request,
61+
cancellationToken
62+
)) as model.SetStatusResponse;
63+
}
64+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./model";
2+
export * from "./api";
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable @typescript-eslint/naming-convention */
2+
3+
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
4+
5+
// all definitions in this file are in alphabetical order
6+
export interface GetStatusRequest {
7+
keys: string;
8+
}
9+
10+
export type WorkspaceConf = Record<string, string>;
11+
12+
export interface SetStatusResponse {}

0 commit comments

Comments
 (0)