@databricks/sdk-instancepools 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/v2/client.d.ts +3 -3
- package/dist/v2/client.d.ts.map +1 -1
- package/dist/v2/client.js +36 -33
- package/dist/v2/client.js.map +1 -1
- package/dist/v2/index.d.ts +1 -1
- package/dist/v2/index.d.ts.map +1 -1
- package/dist/v2/model.d.ts +34 -112
- package/dist/v2/model.d.ts.map +1 -1
- package/dist/v2/model.js +46 -46
- package/dist/v2/model.js.map +1 -1
- package/dist/v2/transport.d.ts +30 -2
- package/dist/v2/transport.d.ts.map +1 -1
- package/dist/v2/transport.js +33 -16
- package/dist/v2/transport.js.map +1 -1
- package/dist/v2/utils.d.ts.map +1 -1
- package/dist/v2/utils.js +2 -1
- package/dist/v2/utils.js.map +1 -1
- package/package.json +9 -5
- package/src/v2/client.ts +0 -224
- package/src/v2/index.ts +0 -43
- package/src/v2/model.ts +0 -1250
- package/src/v2/transport.ts +0 -73
- package/src/v2/utils.ts +0 -156
package/src/v2/client.ts
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
|
|
4
|
-
import {createDefault} from '@databricks/sdk-core/clientinfo';
|
|
5
|
-
import type {Logger} from '@databricks/sdk-core/logger';
|
|
6
|
-
import {NoOpLogger} from '@databricks/sdk-core/logger';
|
|
7
|
-
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
8
|
-
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
9
|
-
import type {HttpClient} from '@databricks/sdk-core/http';
|
|
10
|
-
import {newHttpClient} from './transport';
|
|
11
|
-
import {
|
|
12
|
-
buildHttpRequest,
|
|
13
|
-
executeCall,
|
|
14
|
-
executeHttpCall,
|
|
15
|
-
marshalRequest,
|
|
16
|
-
parseResponse,
|
|
17
|
-
} from './utils';
|
|
18
|
-
import pkgJson from '../../package.json' with {type: 'json'};
|
|
19
|
-
import type {
|
|
20
|
-
CreateInstancePoolRequest,
|
|
21
|
-
CreateInstancePoolResponse,
|
|
22
|
-
DeleteInstancePoolRequest,
|
|
23
|
-
DeleteInstancePoolResponse,
|
|
24
|
-
EditInstancePoolRequest,
|
|
25
|
-
EditInstancePoolResponse,
|
|
26
|
-
GetInstancePoolRequest,
|
|
27
|
-
GetInstancePoolResponse,
|
|
28
|
-
ListInstancePoolsRequest,
|
|
29
|
-
ListInstancePoolsResponse,
|
|
30
|
-
} from './model';
|
|
31
|
-
import {
|
|
32
|
-
marshalCreateInstancePoolRequestSchema,
|
|
33
|
-
marshalDeleteInstancePoolRequestSchema,
|
|
34
|
-
marshalEditInstancePoolRequestSchema,
|
|
35
|
-
unmarshalCreateInstancePoolResponseSchema,
|
|
36
|
-
unmarshalDeleteInstancePoolResponseSchema,
|
|
37
|
-
unmarshalEditInstancePoolResponseSchema,
|
|
38
|
-
unmarshalGetInstancePoolResponseSchema,
|
|
39
|
-
unmarshalListInstancePoolsResponseSchema,
|
|
40
|
-
} from './model';
|
|
41
|
-
|
|
42
|
-
// Package identity segment for this client to be used in the User-Agent header.
|
|
43
|
-
const PACKAGE_SEGMENT = {
|
|
44
|
-
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
45
|
-
value: pkgJson.version,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export class InstancePoolsClient {
|
|
49
|
-
private readonly host: string;
|
|
50
|
-
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
51
|
-
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
52
|
-
// request.
|
|
53
|
-
private readonly workspaceId: string | undefined;
|
|
54
|
-
private readonly httpClient: HttpClient;
|
|
55
|
-
private readonly logger: Logger;
|
|
56
|
-
// User-Agent header value. Composed once at construction from
|
|
57
|
-
// createDefault() merged with this package's identity and the active
|
|
58
|
-
// credential's name.
|
|
59
|
-
private readonly userAgent: string;
|
|
60
|
-
|
|
61
|
-
constructor(options: ClientOptions) {
|
|
62
|
-
if (options.host === undefined) {
|
|
63
|
-
throw new Error('Host is required.');
|
|
64
|
-
}
|
|
65
|
-
this.host = options.host.replace(/\/$/, '');
|
|
66
|
-
this.workspaceId = options.workspaceId;
|
|
67
|
-
this.logger = options.logger ?? new NoOpLogger();
|
|
68
|
-
const info = createDefault()
|
|
69
|
-
.with(PACKAGE_SEGMENT)
|
|
70
|
-
.with({key: 'sdk-js-auth', value: AUTH_VERSION})
|
|
71
|
-
.with({key: 'auth', value: options.credentials?.name() ?? 'default'});
|
|
72
|
-
this.userAgent = info.toString();
|
|
73
|
-
this.httpClient = newHttpClient(options);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** Creates a new instance pool using idle and ready-to-use cloud instances. */
|
|
77
|
-
async createInstancePool(
|
|
78
|
-
req: CreateInstancePoolRequest,
|
|
79
|
-
options?: CallOptions
|
|
80
|
-
): Promise<CreateInstancePoolResponse> {
|
|
81
|
-
const url = `${this.host}/api/2.0/instance-pools/create`;
|
|
82
|
-
const body = marshalRequest(req, marshalCreateInstancePoolRequestSchema);
|
|
83
|
-
let resp: CreateInstancePoolResponse | undefined;
|
|
84
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
85
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
86
|
-
if (this.workspaceId !== undefined) {
|
|
87
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
88
|
-
}
|
|
89
|
-
headers.set('User-Agent', this.userAgent);
|
|
90
|
-
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
91
|
-
const respBody = await executeHttpCall({
|
|
92
|
-
request: httpReq,
|
|
93
|
-
httpClient: this.httpClient,
|
|
94
|
-
logger: this.logger,
|
|
95
|
-
});
|
|
96
|
-
resp = parseResponse(respBody, unmarshalCreateInstancePoolResponseSchema);
|
|
97
|
-
};
|
|
98
|
-
await executeCall(call, options);
|
|
99
|
-
if (resp === undefined) {
|
|
100
|
-
throw new Error('operation completed without a result.');
|
|
101
|
-
}
|
|
102
|
-
return resp;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/** Deletes the instance pool permanently. The idle instances in the pool are terminated asynchronously. */
|
|
106
|
-
async deleteInstancePool(
|
|
107
|
-
req: DeleteInstancePoolRequest,
|
|
108
|
-
options?: CallOptions
|
|
109
|
-
): Promise<DeleteInstancePoolResponse> {
|
|
110
|
-
const url = `${this.host}/api/2.0/instance-pools/delete`;
|
|
111
|
-
const body = marshalRequest(req, marshalDeleteInstancePoolRequestSchema);
|
|
112
|
-
let resp: DeleteInstancePoolResponse | undefined;
|
|
113
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
114
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
115
|
-
if (this.workspaceId !== undefined) {
|
|
116
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
117
|
-
}
|
|
118
|
-
headers.set('User-Agent', this.userAgent);
|
|
119
|
-
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
120
|
-
const respBody = await executeHttpCall({
|
|
121
|
-
request: httpReq,
|
|
122
|
-
httpClient: this.httpClient,
|
|
123
|
-
logger: this.logger,
|
|
124
|
-
});
|
|
125
|
-
resp = parseResponse(respBody, unmarshalDeleteInstancePoolResponseSchema);
|
|
126
|
-
};
|
|
127
|
-
await executeCall(call, options);
|
|
128
|
-
if (resp === undefined) {
|
|
129
|
-
throw new Error('operation completed without a result.');
|
|
130
|
-
}
|
|
131
|
-
return resp;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/** Modifies the configuration of an existing instance pool. */
|
|
135
|
-
async editInstancePool(
|
|
136
|
-
req: EditInstancePoolRequest,
|
|
137
|
-
options?: CallOptions
|
|
138
|
-
): Promise<EditInstancePoolResponse> {
|
|
139
|
-
const url = `${this.host}/api/2.0/instance-pools/edit`;
|
|
140
|
-
const body = marshalRequest(req, marshalEditInstancePoolRequestSchema);
|
|
141
|
-
let resp: EditInstancePoolResponse | undefined;
|
|
142
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
143
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
144
|
-
if (this.workspaceId !== undefined) {
|
|
145
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
146
|
-
}
|
|
147
|
-
headers.set('User-Agent', this.userAgent);
|
|
148
|
-
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
149
|
-
const respBody = await executeHttpCall({
|
|
150
|
-
request: httpReq,
|
|
151
|
-
httpClient: this.httpClient,
|
|
152
|
-
logger: this.logger,
|
|
153
|
-
});
|
|
154
|
-
resp = parseResponse(respBody, unmarshalEditInstancePoolResponseSchema);
|
|
155
|
-
};
|
|
156
|
-
await executeCall(call, options);
|
|
157
|
-
if (resp === undefined) {
|
|
158
|
-
throw new Error('operation completed without a result.');
|
|
159
|
-
}
|
|
160
|
-
return resp;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/** Retrieve the information for an instance pool based on its identifier. */
|
|
164
|
-
async getInstancePool(
|
|
165
|
-
req: GetInstancePoolRequest,
|
|
166
|
-
options?: CallOptions
|
|
167
|
-
): Promise<GetInstancePoolResponse> {
|
|
168
|
-
const url = `${this.host}/api/2.0/instance-pools/get`;
|
|
169
|
-
const params = new URLSearchParams();
|
|
170
|
-
if (req.instancePoolId !== undefined) {
|
|
171
|
-
params.append('instance_pool_id', req.instancePoolId);
|
|
172
|
-
}
|
|
173
|
-
const query = params.toString();
|
|
174
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
175
|
-
let resp: GetInstancePoolResponse | undefined;
|
|
176
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
177
|
-
const headers = new Headers();
|
|
178
|
-
if (this.workspaceId !== undefined) {
|
|
179
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
180
|
-
}
|
|
181
|
-
headers.set('User-Agent', this.userAgent);
|
|
182
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
183
|
-
const respBody = await executeHttpCall({
|
|
184
|
-
request: httpReq,
|
|
185
|
-
httpClient: this.httpClient,
|
|
186
|
-
logger: this.logger,
|
|
187
|
-
});
|
|
188
|
-
resp = parseResponse(respBody, unmarshalGetInstancePoolResponseSchema);
|
|
189
|
-
};
|
|
190
|
-
await executeCall(call, options);
|
|
191
|
-
if (resp === undefined) {
|
|
192
|
-
throw new Error('operation completed without a result.');
|
|
193
|
-
}
|
|
194
|
-
return resp;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/** Gets a list of instance pools with their statistics. */
|
|
198
|
-
async listInstancePools(
|
|
199
|
-
_req: ListInstancePoolsRequest,
|
|
200
|
-
options?: CallOptions
|
|
201
|
-
): Promise<ListInstancePoolsResponse> {
|
|
202
|
-
const url = `${this.host}/api/2.0/instance-pools/list`;
|
|
203
|
-
let resp: ListInstancePoolsResponse | undefined;
|
|
204
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
205
|
-
const headers = new Headers();
|
|
206
|
-
if (this.workspaceId !== undefined) {
|
|
207
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
208
|
-
}
|
|
209
|
-
headers.set('User-Agent', this.userAgent);
|
|
210
|
-
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
211
|
-
const respBody = await executeHttpCall({
|
|
212
|
-
request: httpReq,
|
|
213
|
-
httpClient: this.httpClient,
|
|
214
|
-
logger: this.logger,
|
|
215
|
-
});
|
|
216
|
-
resp = parseResponse(respBody, unmarshalListInstancePoolsResponseSchema);
|
|
217
|
-
};
|
|
218
|
-
await executeCall(call, options);
|
|
219
|
-
if (resp === undefined) {
|
|
220
|
-
throw new Error('operation completed without a result.');
|
|
221
|
-
}
|
|
222
|
-
return resp;
|
|
223
|
-
}
|
|
224
|
-
}
|
package/src/v2/index.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
export {InstancePoolsClient} from './client';
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
AwsAvailability,
|
|
7
|
-
AzureAvailability,
|
|
8
|
-
AzureDiskVolumeType,
|
|
9
|
-
EbsVolumeType,
|
|
10
|
-
GcpAvailability,
|
|
11
|
-
InstancePoolState,
|
|
12
|
-
} from './model';
|
|
13
|
-
|
|
14
|
-
export type {
|
|
15
|
-
CreateInstancePoolRequest,
|
|
16
|
-
CreateInstancePoolRequest_CustomTagsEntry,
|
|
17
|
-
CreateInstancePoolResponse,
|
|
18
|
-
DeleteInstancePoolRequest,
|
|
19
|
-
DeleteInstancePoolResponse,
|
|
20
|
-
DiskSpec,
|
|
21
|
-
DiskType,
|
|
22
|
-
DockerBasicAuth,
|
|
23
|
-
DockerImage,
|
|
24
|
-
EditInstancePoolRequest,
|
|
25
|
-
EditInstancePoolRequest_CustomTagsEntry,
|
|
26
|
-
EditInstancePoolResponse,
|
|
27
|
-
GetInstancePoolRequest,
|
|
28
|
-
GetInstancePoolResponse,
|
|
29
|
-
GetInstancePoolResponse_CustomTagsEntry,
|
|
30
|
-
GetInstancePoolResponse_DefaultTagsEntry,
|
|
31
|
-
InstancePoolAndStats,
|
|
32
|
-
InstancePoolAndStats_CustomTagsEntry,
|
|
33
|
-
InstancePoolAndStats_DefaultTagsEntry,
|
|
34
|
-
InstancePoolAwsAttributes,
|
|
35
|
-
InstancePoolAzureAttributes,
|
|
36
|
-
InstancePoolGcpAttributes,
|
|
37
|
-
InstancePoolStats,
|
|
38
|
-
InstancePoolStatus,
|
|
39
|
-
ListInstancePoolsRequest,
|
|
40
|
-
ListInstancePoolsResponse,
|
|
41
|
-
NodeTypeFlexibility,
|
|
42
|
-
PendingInstanceError,
|
|
43
|
-
} from './model';
|