@databricks/sdk-storageconfigurations 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 ADDED
@@ -0,0 +1,28 @@
1
+ # @databricks/sdk-storageconfigurations
2
+
3
+ > [!WARNING]
4
+ >
5
+ > ## PREVIEW - NOT FOR PRODUCTION USE
6
+ >
7
+ > **This SDK is in preview and is subject to change without notice.**
8
+ >
9
+ > - **Do NOT use in production environments**
10
+ > - **Breaking changes may occur at any time**
11
+ > - **APIs are experimental and unstable**
12
+ > - **Use for development and testing only**
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @databricks/sdk-storageconfigurations
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```typescript
23
+ import {StorageConfigurationsClient} from '@databricks/sdk-storageconfigurations/v1';
24
+
25
+ const client = new StorageConfigurationsClient({});
26
+ ```
27
+
28
+ For a full getting-started guide, see the [root README](../../README.md).
@@ -2,12 +2,12 @@ import type { CallOptions } from '@databricks/sdk-options/call';
2
2
  import type { ClientOptions } from '@databricks/sdk-options/client';
3
3
  import type { CreateStorageConfigurationRequest, DeleteStorageConfigurationRequest, GetStorageConfigurationRequest, ListStorageConfigurationRequest, ListStorageConfigurationResponse, StorageConfiguration } from './model';
4
4
  export declare class StorageConfigurationsClient {
5
- private readonly host;
6
- private readonly accountId;
7
- private readonly httpClient;
5
+ private readonly options;
8
6
  private readonly logger;
9
7
  private readonly userAgent;
8
+ private config;
10
9
  constructor(options: ClientOptions);
10
+ private resolveConfig;
11
11
  /** Creates a <Databricks> storage configuration for an account. */
12
12
  createStorageConfigurationPublic(req: CreateStorageConfigurationRequest, options?: CallOptions): Promise<StorageConfiguration>;
13
13
  /** Deletes a <Databricks> storage configuration. You cannot delete a storage configuration that is associated with any workspace. */
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"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iCAAiC,EACjC,8BAA8B,EAC9B,+BAA+B,EAC/B,gCAAgC,EAChC,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAYjB,qBAAa,2BAA2B;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAIhC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAInC,OAAO,CAAC,MAAM,CAA4C;gBAE9C,OAAO,EAAE,aAAa;IAUlC,OAAO,CAAC,aAAa;IAKrB,mEAAmE;IAC7D,gCAAgC,CACpC,GAAG,EAAE,iCAAiC,EACtC,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,oBAAoB,CAAC;IA0BhC,qIAAqI;IAC/H,gCAAgC,CACpC,GAAG,EAAE,iCAAiC,EACtC,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,oBAAoB,CAAC;IAsBhC,sFAAsF;IAChF,6BAA6B,CACjC,GAAG,EAAE,8BAA8B,EACnC,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,oBAAoB,CAAC;IAsBhC,iFAAiF;IAC3E,8BAA8B,CAClC,GAAG,EAAE,+BAA+B,EACpC,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,gCAAgC,CAAC;CA0B7C"}
package/dist/v1/client.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { VERSION as AUTH_VERSION } from '@databricks/sdk-auth';
3
3
  import { createDefault } from '@databricks/sdk-core/clientinfo';
4
4
  import { NoOpLogger } from '@databricks/sdk-core/logger';
5
- import { newHttpClient } from './transport';
5
+ import { resolveClientConfig } from './transport';
6
6
  import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, } from './utils';
7
7
  import pkgJson from '../../package.json' with { type: 'json' };
8
8
  import { z } from 'zod';
@@ -13,33 +13,33 @@ const PACKAGE_SEGMENT = {
13
13
  value: pkgJson.version,
14
14
  };
15
15
  export class StorageConfigurationsClient {
16
- host;
17
- // Fallback for endpoints whose path contains {account_id}. If the request
18
- // already carries an accountId, that value wins.
19
- accountId;
20
- httpClient;
16
+ options;
21
17
  logger;
22
18
  // User-Agent header value. Composed once at construction from
23
19
  // createDefault() merged with this package's identity and the active
24
20
  // credential's name.
25
21
  userAgent;
22
+ // Memoized configuration. The profile is resolved once, lazily, on the first
23
+ // request, then reused; host, workspaceId/accountId, and credentials are
24
+ // filled from it when not set explicitly on the options.
25
+ config;
26
26
  constructor(options) {
27
- if (options.host === undefined) {
28
- throw new Error('Host is required.');
29
- }
30
- this.host = options.host.replace(/\/$/, '');
31
- this.accountId = options.accountId;
27
+ this.options = options;
32
28
  this.logger = options.logger ?? new NoOpLogger();
33
29
  const info = createDefault()
34
30
  .with(PACKAGE_SEGMENT)
35
31
  .with({ key: 'sdk-js-auth', value: AUTH_VERSION })
36
32
  .with({ key: 'auth', value: options.credentials?.name() ?? 'default' });
37
33
  this.userAgent = info.toString();
38
- this.httpClient = newHttpClient(options);
34
+ }
35
+ resolveConfig() {
36
+ this.config ??= resolveClientConfig(this.options);
37
+ return this.config;
39
38
  }
40
39
  /** Creates a <Databricks> storage configuration for an account. */
41
40
  async createStorageConfigurationPublic(req, options) {
42
- const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/storage-configurations`;
41
+ const { host, accountId, httpClient } = await this.resolveConfig();
42
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/storage-configurations`;
43
43
  const body = marshalRequest(req, marshalCreateStorageConfigurationRequestSchema);
44
44
  let resp;
45
45
  const call = async (callSignal) => {
@@ -48,7 +48,7 @@ export class StorageConfigurationsClient {
48
48
  const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
49
49
  const respBody = await executeHttpCall({
50
50
  request: httpReq,
51
- httpClient: this.httpClient,
51
+ httpClient,
52
52
  logger: this.logger,
53
53
  });
54
54
  resp = parseResponse(respBody, unmarshalStorageConfigurationSchema);
@@ -61,7 +61,8 @@ export class StorageConfigurationsClient {
61
61
  }
62
62
  /** Deletes a <Databricks> storage configuration. You cannot delete a storage configuration that is associated with any workspace. */
63
63
  async deleteStorageConfigurationPublic(req, options) {
64
- const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/storage-configurations/${req.storageConfigurationId ?? ''}`;
64
+ const { host, accountId, httpClient } = await this.resolveConfig();
65
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/storage-configurations/${req.storageConfigurationId ?? ''}`;
65
66
  let resp;
66
67
  const call = async (callSignal) => {
67
68
  const headers = new Headers();
@@ -69,7 +70,7 @@ export class StorageConfigurationsClient {
69
70
  const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
70
71
  const respBody = await executeHttpCall({
71
72
  request: httpReq,
72
- httpClient: this.httpClient,
73
+ httpClient,
73
74
  logger: this.logger,
74
75
  });
75
76
  resp = parseResponse(respBody, unmarshalStorageConfigurationSchema);
@@ -82,7 +83,8 @@ export class StorageConfigurationsClient {
82
83
  }
83
84
  /** Gets a <Databricks> storage configuration for an account, both specified by ID. */
84
85
  async getStorageConfigurationPublic(req, options) {
85
- const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/storage-configurations/${req.storageConfigurationId ?? ''}`;
86
+ const { host, accountId, httpClient } = await this.resolveConfig();
87
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/storage-configurations/${req.storageConfigurationId ?? ''}`;
86
88
  let resp;
87
89
  const call = async (callSignal) => {
88
90
  const headers = new Headers();
@@ -90,7 +92,7 @@ export class StorageConfigurationsClient {
90
92
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
91
93
  const respBody = await executeHttpCall({
92
94
  request: httpReq,
93
- httpClient: this.httpClient,
95
+ httpClient,
94
96
  logger: this.logger,
95
97
  });
96
98
  resp = parseResponse(respBody, unmarshalStorageConfigurationSchema);
@@ -103,7 +105,8 @@ export class StorageConfigurationsClient {
103
105
  }
104
106
  /** Lists <Databricks> storage configurations for an account, specified by ID. */
105
107
  async listStorageConfigurationPublic(req, options) {
106
- const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/storage-configurations`;
108
+ const { host, accountId, httpClient } = await this.resolveConfig();
109
+ const url = `${host}/api/2.0/accounts/${req.accountId ?? accountId ?? ''}/storage-configurations`;
107
110
  let resp;
108
111
  const call = async (callSignal) => {
109
112
  const headers = new Headers();
@@ -111,7 +114,7 @@ export class StorageConfigurationsClient {
111
114
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
112
115
  const respBody = await executeHttpCall({
113
116
  request: httpReq,
114
- httpClient: this.httpClient,
117
+ httpClient,
115
118
  logger: this.logger,
116
119
  });
117
120
  resp = {
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAIvD,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,cAAc,EACd,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,OAAO,MAAM,oBAAoB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AAC7D,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAStB,OAAO,EACL,8CAA8C,EAC9C,mCAAmC,GACpC,MAAM,SAAS,CAAC;AAEjB,gFAAgF;AAChF,MAAM,eAAe,GAAG;IACtB,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;IAC1D,KAAK,EAAE,OAAO,CAAC,OAAO;CACvB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AG,GAAG,IAAI,qBAAqB,GAAG,CAAC,SAAS,IAAI,SAAS,IAAI,EAAE,yBAAyB,CAAC;QAClG,IAAI,IAAkD,CAAC;QACvD,MAAM,IAAI,GAAG,KAAK,EAAE,UAAwB,EAAiB,EAAE;YAC7D,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1C,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YAClE,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC;gBACrC,OAAO,EAAE,OAAO;gBAChB,UAAU;gBACV,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB,CAAC,CAAC;YACH,IAAI,GAAG;gBACL,qBAAqB,EAAE,aAAa,CAClC,QAAQ,EACR,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,mCAAmC,CAAC,CAAC,CAC3D;aACF,CAAC;QACJ,CAAC,CAAC;QACF,MAAM,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACjC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -1,5 +1,33 @@
1
1
  import type { HttpClient } from '@databricks/sdk-core/http';
2
2
  import type { ClientOptions } from '@databricks/sdk-options/client';
3
- /** Creates a new HTTP client with the given options. */
4
- export declare function newHttpClient(options?: ClientOptions): HttpClient;
3
+ /**
4
+ * The configuration a client needs to issue requests, resolved from
5
+ * {@link ClientOptions} and a configuration profile.
6
+ */
7
+ export interface ResolvedClientConfig {
8
+ /** Host with any trailing slash removed. */
9
+ host: string;
10
+ /**
11
+ * Default account ID for account-level paths that contain an account_id
12
+ * segment. A request's own accountId still wins.
13
+ */
14
+ accountId?: string;
15
+ /**
16
+ * Workspace ID used to route workspace-level calls on unified hosts (SPOG).
17
+ */
18
+ workspaceId?: string;
19
+ /** HTTP client with authentication, and any configured timeout, applied. */
20
+ httpClient: HttpClient;
21
+ }
22
+ /**
23
+ * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
24
+ *
25
+ * A configuration profile is always resolved from the config file and
26
+ * environment variables (per options.profileOptions); it supplies host,
27
+ * accountId, workspaceId, and credentials wherever the caller did not set them
28
+ * explicitly. Explicit options always take precedence.
29
+ *
30
+ * @throws if host is neither provided nor present in the resolved profile.
31
+ */
32
+ export declare function resolveClientConfig(options: ClientOptions): Promise<ResolvedClientConfig>;
5
33
  //# sourceMappingURL=transport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/v1/transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,UAAU,EAGX,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAElE,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,UAAU,CAwBjE"}
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/v1/transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,UAAU,EAGX,MAAM,2BAA2B,CAAC;AAInC,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,4EAA4E;IAC5E,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,oBAAoB,CAAC,CA4B/B"}
@@ -1,24 +1,41 @@
1
1
  // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
2
  import { defaultCredentials } from '@databricks/sdk-auth/credentials';
3
3
  import { newFetchHttpClient } from '@databricks/sdk-core/http';
4
- /** Creates a new HTTP client with the given options. */
5
- export function newHttpClient(options) {
6
- const opts = options ?? {};
7
- // If an HTTP client is provided, use it as-is. Throw if other options are
8
- // also set, since they would be silently ignored.
9
- if (opts.httpClient !== undefined) {
10
- if (opts.credentials !== undefined || opts.timeout !== undefined) {
11
- throw new Error('httpClient cannot be combined with credentials or timeout');
12
- }
13
- return opts.httpClient;
4
+ import { resolve } from '@databricks/sdk-core/profiles';
5
+ /**
6
+ * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
7
+ *
8
+ * A configuration profile is always resolved from the config file and
9
+ * environment variables (per options.profileOptions); it supplies host,
10
+ * accountId, workspaceId, and credentials wherever the caller did not set them
11
+ * explicitly. Explicit options always take precedence.
12
+ *
13
+ * @throws if host is neither provided nor present in the resolved profile.
14
+ */
15
+ export async function resolveClientConfig(options) {
16
+ const profile = await resolve(options.profileOptions);
17
+ const host = options.host ?? profile.host;
18
+ if (host === undefined) {
19
+ throw new Error('Host is required.');
14
20
  }
15
- const credentials = opts.credentials ?? defaultCredentials();
16
- const base = newFetchHttpClient();
17
- let client = new AuthHttpClient(base, credentials);
18
- if (opts.timeout !== undefined) {
19
- client = new TimeoutHttpClient(client, opts.timeout);
21
+ // The provided httpClient (or the default fetch client) is the base wire;
22
+ // authentication and the optional timeout are layered on top of it. The
23
+ // default credential chain reuses the profile resolved above so that the
24
+ // same profileOptions govern host and authentication alike.
25
+ const base = options.httpClient ?? newFetchHttpClient();
26
+ const credentials = options.credentials ?? defaultCredentials({ profile });
27
+ let httpClient = new AuthHttpClient(base, credentials);
28
+ if (options.timeout !== undefined) {
29
+ httpClient = new TimeoutHttpClient(httpClient, options.timeout);
20
30
  }
21
- return client;
31
+ const accountId = options.accountId ?? profile.accountId;
32
+ const workspaceId = options.workspaceId ?? profile.workspaceId;
33
+ return {
34
+ host: host.replace(/\/$/, ''),
35
+ httpClient,
36
+ ...(accountId !== undefined && { accountId }),
37
+ ...(workspaceId !== undefined && { workspaceId }),
38
+ };
22
39
  }
23
40
  /** Wraps an HttpClient and adds authentication headers to requests. */
24
41
  class AuthHttpClient {
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/v1/transport.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AAMpE,OAAO,EAAC,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAG7D,wDAAwD;AACxD,MAAM,UAAU,aAAa,CAAC,OAAuB;IACnD,MAAM,IAAI,GAAG,OAAO,IAAI,EAAE,CAAC;IAE3B,0EAA0E;IAC1E,kDAAkD;IAClD,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YACjE,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,kBAAkB,EAAE,CAAC;IAE7D,MAAM,IAAI,GAAG,kBAAkB,EAAE,CAAC;IAClC,IAAI,MAAM,GAAe,IAAI,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAE/D,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,GAAG,IAAI,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAA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C,CAAC,OAAO,GAAG,MAAM,CAEvE;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,eAAe,GACtB,IAAI,CAuBN"}
package/dist/v1/utils.js CHANGED
@@ -79,7 +79,8 @@ export function buildHttpRequest(method, url, headers, signal, body) {
79
79
  }
80
80
  export function parseResponse(body, schema) {
81
81
  const text = new TextDecoder().decode(body);
82
- const parsed = jsonBigint.parse(text);
82
+ // 204 responses return an empty body; treat as `{}`.
83
+ const parsed = text === '' ? {} : jsonBigint.parse(text);
83
84
  return schema.parse(parsed);
84
85
  }
85
86
  export function marshalRequest(data, schema) {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/v1/utils.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAC,QAAQ,EAAC,MAAM,+BAA+B,CAAC;AAQvD,OAAO,OAAO,MAAM,aAAa,CAAC;AAGlC,0EAA0E;AAC1E,6EAA6E;AAC7E,gEAAgE;AAChE,MAAM,UAAU,GAAG,OAAO,CAAC,EAAC,eAAe,EAAE,IAAI,EAAC,CAAC,CAAC;AAQpD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAA6C,EAC7C,OAAqB;IAErB,MAAM,IAAI,GAAY;QACpB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,IAAI,EAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAC,CAAC;QACjE,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,SAAS,IAAI;YACxC,WAAW,EAAE,OAAO,CAAC,WAAW;SACjC,CAAC;QACF,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,IAAI,EAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAC,CAAC;KAClE,CAAC;IACF,OAAO,OAAO,CAAC,O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QAC1C,OAAO;IACT,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,0CAA0C;QAC1C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrC,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;YAC1E,kBAAkB,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;SAAM,IACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,OAAO,KAAK,KAAK,QAAQ,EACzB,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,qCAAqC,OAAO,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databricks/sdk-storageconfigurations",
3
- "version": "0.1.0-dev.3",
3
+ "version": "0.1.0-dev.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -12,7 +12,6 @@
12
12
  },
13
13
  "files": [
14
14
  "dist",
15
- "src",
16
15
  "LICENSE"
17
16
  ],
18
17
  "scripts": {
@@ -28,10 +27,15 @@
28
27
  },
29
28
  "author": "Databricks",
30
29
  "license": "Apache-2.0",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/databricks/sdk-js.git",
33
+ "directory": "packages/storageconfigurations"
34
+ },
31
35
  "dependencies": {
32
- "@databricks/sdk-auth": ">=0.1.0-dev.4 <1.0.0",
33
- "@databricks/sdk-core": ">=0.1.0-dev.5 <1.0.0",
34
- "@databricks/sdk-options": ">=0.1.0-dev.4 <1.0.0",
36
+ "@databricks/sdk-auth": ">=0.1.0-dev.6 <1.0.0",
37
+ "@databricks/sdk-core": ">=0.1.0-dev.7 <1.0.0",
38
+ "@databricks/sdk-options": ">=0.1.0-dev.6 <1.0.0",
35
39
  "@js-temporal/polyfill": "^0.5.0",
36
40
  "json-bigint": "^1.0.0",
37
41
  "zod": "^4.3.6"
package/src/v1/client.ts DELETED
@@ -1,174 +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 {z} from 'zod';
20
- import type {
21
- CreateStorageConfigurationRequest,
22
- DeleteStorageConfigurationRequest,
23
- GetStorageConfigurationRequest,
24
- ListStorageConfigurationRequest,
25
- ListStorageConfigurationResponse,
26
- StorageConfiguration,
27
- } from './model';
28
- import {
29
- marshalCreateStorageConfigurationRequestSchema,
30
- unmarshalStorageConfigurationSchema,
31
- } from './model';
32
-
33
- // Package identity segment for this client to be used in the User-Agent header.
34
- const PACKAGE_SEGMENT = {
35
- key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
36
- value: pkgJson.version,
37
- };
38
-
39
- export class StorageConfigurationsClient {
40
- private readonly host: string;
41
- // Fallback for endpoints whose path contains {account_id}. If the request
42
- // already carries an accountId, that value wins.
43
- private readonly accountId: string | undefined;
44
- private readonly httpClient: HttpClient;
45
- private readonly logger: Logger;
46
- // User-Agent header value. Composed once at construction from
47
- // createDefault() merged with this package's identity and the active
48
- // credential's name.
49
- private readonly userAgent: string;
50
-
51
- constructor(options: ClientOptions) {
52
- if (options.host === undefined) {
53
- throw new Error('Host is required.');
54
- }
55
- this.host = options.host.replace(/\/$/, '');
56
- this.accountId = options.accountId;
57
- this.logger = options.logger ?? new NoOpLogger();
58
- const info = createDefault()
59
- .with(PACKAGE_SEGMENT)
60
- .with({key: 'sdk-js-auth', value: AUTH_VERSION})
61
- .with({key: 'auth', value: options.credentials?.name() ?? 'default'});
62
- this.userAgent = info.toString();
63
- this.httpClient = newHttpClient(options);
64
- }
65
-
66
- /** Creates a <Databricks> storage configuration for an account. */
67
- async createStorageConfigurationPublic(
68
- req: CreateStorageConfigurationRequest,
69
- options?: CallOptions
70
- ): Promise<StorageConfiguration> {
71
- const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/storage-configurations`;
72
- const body = marshalRequest(
73
- req,
74
- marshalCreateStorageConfigurationRequestSchema
75
- );
76
- let resp: StorageConfiguration | undefined;
77
- const call = async (callSignal?: AbortSignal): Promise<void> => {
78
- const headers = new Headers({'Content-Type': 'application/json'});
79
- headers.set('User-Agent', this.userAgent);
80
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
81
- const respBody = await executeHttpCall({
82
- request: httpReq,
83
- httpClient: this.httpClient,
84
- logger: this.logger,
85
- });
86
- resp = parseResponse(respBody, unmarshalStorageConfigurationSchema);
87
- };
88
- await executeCall(call, options);
89
- if (resp === undefined) {
90
- throw new Error('operation completed without a result.');
91
- }
92
- return resp;
93
- }
94
-
95
- /** Deletes a <Databricks> storage configuration. You cannot delete a storage configuration that is associated with any workspace. */
96
- async deleteStorageConfigurationPublic(
97
- req: DeleteStorageConfigurationRequest,
98
- options?: CallOptions
99
- ): Promise<StorageConfiguration> {
100
- const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/storage-configurations/${req.storageConfigurationId ?? ''}`;
101
- let resp: StorageConfiguration | undefined;
102
- const call = async (callSignal?: AbortSignal): Promise<void> => {
103
- const headers = new Headers();
104
- headers.set('User-Agent', this.userAgent);
105
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
106
- const respBody = await executeHttpCall({
107
- request: httpReq,
108
- httpClient: this.httpClient,
109
- logger: this.logger,
110
- });
111
- resp = parseResponse(respBody, unmarshalStorageConfigurationSchema);
112
- };
113
- await executeCall(call, options);
114
- if (resp === undefined) {
115
- throw new Error('operation completed without a result.');
116
- }
117
- return resp;
118
- }
119
-
120
- /** Gets a <Databricks> storage configuration for an account, both specified by ID. */
121
- async getStorageConfigurationPublic(
122
- req: GetStorageConfigurationRequest,
123
- options?: CallOptions
124
- ): Promise<StorageConfiguration> {
125
- const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/storage-configurations/${req.storageConfigurationId ?? ''}`;
126
- let resp: StorageConfiguration | undefined;
127
- const call = async (callSignal?: AbortSignal): Promise<void> => {
128
- const headers = new Headers();
129
- headers.set('User-Agent', this.userAgent);
130
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
131
- const respBody = await executeHttpCall({
132
- request: httpReq,
133
- httpClient: this.httpClient,
134
- logger: this.logger,
135
- });
136
- resp = parseResponse(respBody, unmarshalStorageConfigurationSchema);
137
- };
138
- await executeCall(call, options);
139
- if (resp === undefined) {
140
- throw new Error('operation completed without a result.');
141
- }
142
- return resp;
143
- }
144
-
145
- /** Lists <Databricks> storage configurations for an account, specified by ID. */
146
- async listStorageConfigurationPublic(
147
- req: ListStorageConfigurationRequest,
148
- options?: CallOptions
149
- ): Promise<ListStorageConfigurationResponse> {
150
- const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/storage-configurations`;
151
- let resp: ListStorageConfigurationResponse | undefined;
152
- const call = async (callSignal?: AbortSignal): Promise<void> => {
153
- const headers = new Headers();
154
- headers.set('User-Agent', this.userAgent);
155
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
156
- const respBody = await executeHttpCall({
157
- request: httpReq,
158
- httpClient: this.httpClient,
159
- logger: this.logger,
160
- });
161
- resp = {
162
- storageConfigurations: parseResponse(
163
- respBody,
164
- z.array(z.lazy(() => unmarshalStorageConfigurationSchema))
165
- ),
166
- };
167
- };
168
- await executeCall(call, options);
169
- if (resp === undefined) {
170
- throw new Error('operation completed without a result.');
171
- }
172
- return resp;
173
- }
174
- }
package/src/v1/index.ts DELETED
@@ -1,13 +0,0 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
-
3
- export {StorageConfigurationsClient} from './client';
4
-
5
- export type {
6
- CreateStorageConfigurationRequest,
7
- DeleteStorageConfigurationRequest,
8
- GetStorageConfigurationRequest,
9
- ListStorageConfigurationRequest,
10
- ListStorageConfigurationResponse,
11
- RootBucketInfo,
12
- StorageConfiguration,
13
- } from './model';
package/src/v1/model.ts DELETED
@@ -1,113 +0,0 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
-
3
- import {z} from 'zod';
4
-
5
- export interface CreateStorageConfigurationRequest {
6
- accountId?: string | undefined;
7
- /** The human-readable name of the storage configuration. */
8
- storageConfigurationName?: string | undefined;
9
- /** Root S3 bucket information. */
10
- rootBucketInfo?: RootBucketInfo | undefined;
11
- /**
12
- * Optional IAM role that is used to access the workspace catalog which is created during workspace creation
13
- * for UC by Default. If a storage configuration with this field populated is used to create a workspace,
14
- * then a workspace catalog is created together with the workspace. The workspace catalog shares the root
15
- * bucket with internal workspace storage (including DBFS root) but uses a dedicated bucket path prefix.
16
- */
17
- roleArn?: string | undefined;
18
- }
19
-
20
- export interface DeleteStorageConfigurationRequest {
21
- storageConfigurationId?: string | undefined;
22
- accountId?: string | undefined;
23
- }
24
-
25
- export interface GetStorageConfigurationRequest {
26
- storageConfigurationId?: string | undefined;
27
- accountId?: string | undefined;
28
- }
29
-
30
- export interface ListStorageConfigurationRequest {
31
- accountId?: string | undefined;
32
- }
33
-
34
- export interface ListStorageConfigurationResponse {
35
- storageConfigurations?: StorageConfiguration[] | undefined;
36
- }
37
-
38
- export interface RootBucketInfo {
39
- /** Name of the S3 bucket */
40
- bucketName?: string | undefined;
41
- }
42
-
43
- export interface StorageConfiguration {
44
- /** <Databricks> storage configuration ID. */
45
- storageConfigurationId?: string | undefined;
46
- /** The <Databricks> account ID associated with this storage configuration. */
47
- accountId?: string | undefined;
48
- /** The root bucket information for the storage configuration. */
49
- rootBucketInfo?: RootBucketInfo | undefined;
50
- /** The human-readable name of the storage configuration. */
51
- storageConfigurationName?: string | undefined;
52
- /** Time in epoch milliseconds when the storage configuration was created. */
53
- creationTime?: bigint | undefined;
54
- /**
55
- * Optional IAM role that is used to access the workspace catalog which is created during workspace creation
56
- * for UC by Default. If a storage configuration with this field populated is used to create a workspace,
57
- * then a workspace catalog is created together with the workspace. The workspace catalog shares the root
58
- * bucket with internal workspace storage (including DBFS root) but uses a dedicated bucket path prefix.
59
- */
60
- roleArn?: string | undefined;
61
- }
62
-
63
- export const unmarshalRootBucketInfoSchema: z.ZodType<RootBucketInfo> = z
64
- .object({
65
- bucket_name: z.string().optional(),
66
- })
67
- .transform(d => ({
68
- bucketName: d.bucket_name,
69
- }));
70
-
71
- export const unmarshalStorageConfigurationSchema: z.ZodType<StorageConfiguration> =
72
- z
73
- .object({
74
- storage_configuration_id: z.string().optional(),
75
- account_id: z.string().optional(),
76
- root_bucket_info: z.lazy(() => unmarshalRootBucketInfoSchema).optional(),
77
- storage_configuration_name: z.string().optional(),
78
- creation_time: z
79
- .union([z.number(), z.bigint()])
80
- .transform(v => BigInt(v))
81
- .optional(),
82
- role_arn: z.string().optional(),
83
- })
84
- .transform(d => ({
85
- storageConfigurationId: d.storage_configuration_id,
86
- accountId: d.account_id,
87
- rootBucketInfo: d.root_bucket_info,
88
- storageConfigurationName: d.storage_configuration_name,
89
- creationTime: d.creation_time,
90
- roleArn: d.role_arn,
91
- }));
92
-
93
- export const marshalCreateStorageConfigurationRequestSchema: z.ZodType = z
94
- .object({
95
- accountId: z.string().optional(),
96
- storageConfigurationName: z.string().optional(),
97
- rootBucketInfo: z.lazy(() => marshalRootBucketInfoSchema).optional(),
98
- roleArn: z.string().optional(),
99
- })
100
- .transform(d => ({
101
- account_id: d.accountId,
102
- storage_configuration_name: d.storageConfigurationName,
103
- root_bucket_info: d.rootBucketInfo,
104
- role_arn: d.roleArn,
105
- }));
106
-
107
- export const marshalRootBucketInfoSchema: z.ZodType = z
108
- .object({
109
- bucketName: z.string().optional(),
110
- })
111
- .transform(d => ({
112
- bucket_name: d.bucketName,
113
- }));
@@ -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
- }