@databricks/sdk-uc-grants 0.1.0-dev.2 → 0.1.0-dev.4
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/dist/v1/client.d.ts +4 -4
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +4 -4
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/index.d.ts +1 -1
- package/dist/v1/index.d.ts.map +1 -1
- package/dist/v1/model.d.ts +6 -6
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +3 -6
- package/dist/v1/model.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 +6 -6
- package/src/v1/client.ts +0 -199
- package/src/v1/index.ts +0 -16
- package/src/v1/model.ts +0 -235
- package/src/v1/transport.ts +0 -73
- package/src/v1/utils.ts +0 -156
package/dist/v1/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CallOptions } from '@databricks/sdk-options/call';
|
|
2
2
|
import type { ClientOptions } from '@databricks/sdk-options/client';
|
|
3
|
-
import type { GetEffectivePermissionsRequest,
|
|
3
|
+
import type { GetEffectivePermissionsRequest, GetEffectivePermissionsResponse, GetPermissionsRequest, GetPermissionsResponse, UpdatePermissionsRequest, UpdatePermissionsResponse } from './model';
|
|
4
4
|
export declare class GrantsClient {
|
|
5
5
|
private readonly host;
|
|
6
6
|
private readonly workspaceId;
|
|
@@ -16,7 +16,7 @@ export declare class GrantsClient {
|
|
|
16
16
|
* PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may contain zero results while still providing a next_page_token.
|
|
17
17
|
* Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
|
|
18
18
|
*/
|
|
19
|
-
getEffectivePermissions(req: GetEffectivePermissionsRequest, options?: CallOptions): Promise<
|
|
19
|
+
getEffectivePermissions(req: GetEffectivePermissionsRequest, options?: CallOptions): Promise<GetEffectivePermissionsResponse>;
|
|
20
20
|
/**
|
|
21
21
|
* Gets the permissions for a securable. Does not include inherited permissions.
|
|
22
22
|
*
|
|
@@ -25,8 +25,8 @@ export declare class GrantsClient {
|
|
|
25
25
|
* PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may contain zero results while still providing a next_page_token.
|
|
26
26
|
* Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
|
|
27
27
|
*/
|
|
28
|
-
getPermissions(req: GetPermissionsRequest, options?: CallOptions): Promise<
|
|
28
|
+
getPermissions(req: GetPermissionsRequest, options?: CallOptions): Promise<GetPermissionsResponse>;
|
|
29
29
|
/** Updates the permissions for a securable. */
|
|
30
|
-
updatePermissions(req: UpdatePermissionsRequest, options?: CallOptions): Promise<
|
|
30
|
+
updatePermissions(req: UpdatePermissionsRequest, options?: CallOptions): Promise<UpdatePermissionsResponse>;
|
|
31
31
|
}
|
|
32
32
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/v1/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAWlE,OAAO,KAAK,EACV,8BAA8B,EAC9B,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAWlE,OAAO,KAAK,EACV,8BAA8B,EAC9B,+BAA+B,EAC/B,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AAcjB,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAI9B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAIhC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,OAAO,EAAE,aAAa;IAelC;;;;;;;OAOG;IACG,uBAAuB,CAC3B,GAAG,EAAE,8BAA8B,EACnC,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,+BAA+B,CAAC;IAuC3C;;;;;;;OAOG;IACG,cAAc,CAClB,GAAG,EAAE,qBAAqB,EAC1B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,sBAAsB,CAAC;IAoClC,+CAA+C;IACzC,iBAAiB,CACrB,GAAG,EAAE,wBAAwB,EAC7B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,yBAAyB,CAAC;CAwBtC"}
|
package/dist/v1/client.js
CHANGED
|
@@ -5,7 +5,7 @@ import { NoOpLogger } from '@databricks/sdk-core/logger';
|
|
|
5
5
|
import { newHttpClient } from './transport';
|
|
6
6
|
import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, } from './utils';
|
|
7
7
|
import pkgJson from '../../package.json' with { type: 'json' };
|
|
8
|
-
import { marshalUpdatePermissionsRequestSchema,
|
|
8
|
+
import { marshalUpdatePermissionsRequestSchema, unmarshalGetEffectivePermissionsResponseSchema, unmarshalGetPermissionsResponseSchema, unmarshalUpdatePermissionsResponseSchema, } from './model';
|
|
9
9
|
// Package identity segment for this client to be used in the User-Agent header.
|
|
10
10
|
const PACKAGE_SEGMENT = {
|
|
11
11
|
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
@@ -72,7 +72,7 @@ export class GrantsClient {
|
|
|
72
72
|
httpClient: this.httpClient,
|
|
73
73
|
logger: this.logger,
|
|
74
74
|
});
|
|
75
|
-
resp = parseResponse(respBody,
|
|
75
|
+
resp = parseResponse(respBody, unmarshalGetEffectivePermissionsResponseSchema);
|
|
76
76
|
};
|
|
77
77
|
await executeCall(call, options);
|
|
78
78
|
if (resp === undefined) {
|
|
@@ -115,7 +115,7 @@ export class GrantsClient {
|
|
|
115
115
|
httpClient: this.httpClient,
|
|
116
116
|
logger: this.logger,
|
|
117
117
|
});
|
|
118
|
-
resp = parseResponse(respBody,
|
|
118
|
+
resp = parseResponse(respBody, unmarshalGetPermissionsResponseSchema);
|
|
119
119
|
};
|
|
120
120
|
await executeCall(call, options);
|
|
121
121
|
if (resp === undefined) {
|
|
@@ -140,7 +140,7 @@ export class GrantsClient {
|
|
|
140
140
|
httpClient: this.httpClient,
|
|
141
141
|
logger: this.logger,
|
|
142
142
|
});
|
|
143
|
-
resp = parseResponse(respBody,
|
|
143
|
+
resp = parseResponse(respBody, unmarshalUpdatePermissionsResponseSchema);
|
|
144
144
|
};
|
|
145
145
|
await executeCall(call, options);
|
|
146
146
|
if (resp === undefined) {
|
package/dist/v1/client.js.map
CHANGED
|
@@ -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;AAS7D,OAAO,EACL,qCAAqC,EACrC,
|
|
1
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CAAwC,CAAC,CAAC;QAC3E,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"}
|
package/dist/v1/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { GrantsClient } from './client';
|
|
2
|
-
export type { EffectivePrivilege, EffectivePrivilegeAssignment, GetEffectivePermissionsRequest,
|
|
2
|
+
export type { EffectivePrivilege, EffectivePrivilegeAssignment, GetEffectivePermissionsRequest, GetEffectivePermissionsResponse, GetPermissionsRequest, GetPermissionsResponse, PermissionsChange, PrivilegeAssignment, UpdatePermissionsRequest, UpdatePermissionsResponse, } from './model';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/v1/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAEtC,YAAY,EACV,kBAAkB,EAClB,4BAA4B,EAC5B,8BAA8B,EAC9B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAEtC,YAAY,EACV,kBAAkB,EAClB,4BAA4B,EAC5B,8BAA8B,EAC9B,+BAA+B,EAC/B,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,SAAS,CAAC"}
|
package/dist/v1/model.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export interface GetEffectivePermissionsRequest {
|
|
|
43
43
|
/** Opaque token for the next page of results (pagination). */
|
|
44
44
|
pageToken?: string | undefined;
|
|
45
45
|
}
|
|
46
|
-
export interface
|
|
46
|
+
export interface GetEffectivePermissionsResponse {
|
|
47
47
|
/**
|
|
48
48
|
* Opaque token to retrieve the next page of results. Absent if there are no more pages.
|
|
49
49
|
* __page_token__ should be set to this value for the next request (for the next page of results).
|
|
@@ -76,7 +76,7 @@ export interface GetPermissionsRequest {
|
|
|
76
76
|
/** Opaque pagination token to go to next page based on previous query. */
|
|
77
77
|
pageToken?: string | undefined;
|
|
78
78
|
}
|
|
79
|
-
export interface
|
|
79
|
+
export interface GetPermissionsResponse {
|
|
80
80
|
/**
|
|
81
81
|
* Opaque token to retrieve the next page of results. Absent if there are no more pages.
|
|
82
82
|
* __page_token__ should be set to this value for the next request (for the next page of results).
|
|
@@ -113,16 +113,16 @@ export interface UpdatePermissionsRequest {
|
|
|
113
113
|
/** Array of permissions change objects. */
|
|
114
114
|
changes?: PermissionsChange[] | undefined;
|
|
115
115
|
}
|
|
116
|
-
export interface
|
|
116
|
+
export interface UpdatePermissionsResponse {
|
|
117
117
|
/** The privileges assigned to each principal */
|
|
118
118
|
privilegeAssignments?: PrivilegeAssignment[] | undefined;
|
|
119
119
|
}
|
|
120
120
|
export declare const unmarshalEffectivePrivilegeSchema: z.ZodType<EffectivePrivilege>;
|
|
121
121
|
export declare const unmarshalEffectivePrivilegeAssignmentSchema: z.ZodType<EffectivePrivilegeAssignment>;
|
|
122
|
-
export declare const
|
|
123
|
-
export declare const
|
|
122
|
+
export declare const unmarshalGetEffectivePermissionsResponseSchema: z.ZodType<GetEffectivePermissionsResponse>;
|
|
123
|
+
export declare const unmarshalGetPermissionsResponseSchema: z.ZodType<GetPermissionsResponse>;
|
|
124
124
|
export declare const unmarshalPrivilegeAssignmentSchema: z.ZodType<PrivilegeAssignment>;
|
|
125
|
-
export declare const
|
|
125
|
+
export declare const unmarshalUpdatePermissionsResponseSchema: z.ZodType<UpdatePermissionsResponse>;
|
|
126
126
|
export declare const marshalPermissionsChangeSchema: z.ZodType;
|
|
127
127
|
export declare const marshalUpdatePermissionsRequestSchema: z.ZodType;
|
|
128
128
|
//# sourceMappingURL=model.d.ts.map
|
package/dist/v1/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED,MAAM,WAAW,4BAA4B;IAC3C,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,qFAAqF;IACrF,UAAU,CAAC,EAAE,kBAAkB,EAAE,GAAG,SAAS,CAAC;CAC/C;AAED,MAAM,WAAW,8BAA8B;IAC7C,yBAAyB;IACzB,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,8BAA8B;IAC9B,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,4GAA4G;IAC5G,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,S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AkC,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CASvE,CAAC;AAER,eAAO,MAAM,wCAAwC,EAAE,CAAC,CAAC,OAAO,CAAC,yBAAyB,CASnF,CAAC;AAER,eAAO,MAAM,8BAA8B,EAAE,CAAC,CAAC,OAU1C,CAAC;AAEN,eAAO,MAAM,qCAAqC,EAAE,CAAC,CAAC,OAUjD,CAAC"}
|
package/dist/v1/model.js
CHANGED
|
@@ -22,8 +22,7 @@ export const unmarshalEffectivePrivilegeAssignmentSchema = z
|
|
|
22
22
|
principal: d.principal,
|
|
23
23
|
privileges: d.privileges,
|
|
24
24
|
}));
|
|
25
|
-
|
|
26
|
-
export const unmarshalGetEffectivePermissionsRequest_ResponseSchema = z
|
|
25
|
+
export const unmarshalGetEffectivePermissionsResponseSchema = z
|
|
27
26
|
.object({
|
|
28
27
|
next_page_token: z.string().optional(),
|
|
29
28
|
privilege_assignments: z
|
|
@@ -34,8 +33,7 @@ export const unmarshalGetEffectivePermissionsRequest_ResponseSchema = z
|
|
|
34
33
|
nextPageToken: d.next_page_token,
|
|
35
34
|
privilegeAssignments: d.privilege_assignments,
|
|
36
35
|
}));
|
|
37
|
-
|
|
38
|
-
export const unmarshalGetPermissionsRequest_ResponseSchema = z
|
|
36
|
+
export const unmarshalGetPermissionsResponseSchema = z
|
|
39
37
|
.object({
|
|
40
38
|
next_page_token: z.string().optional(),
|
|
41
39
|
privilege_assignments: z
|
|
@@ -55,8 +53,7 @@ export const unmarshalPrivilegeAssignmentSchema = z
|
|
|
55
53
|
principal: d.principal,
|
|
56
54
|
privileges: d.privileges,
|
|
57
55
|
}));
|
|
58
|
-
|
|
59
|
-
export const unmarshalUpdatePermissionsRequest_ResponseSchema = z
|
|
56
|
+
export const unmarshalUpdatePermissionsResponseSchema = z
|
|
60
57
|
.object({
|
|
61
58
|
privilege_assignments: z
|
|
62
59
|
.array(z.lazy(() => unmarshalPrivilegeAssignmentSchema))
|
package/dist/v1/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAkItB,MAAM,CAAC,MAAM,iCAAiC,GAC5C,CAAC;KACE,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC;KACD,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACf,SAAS,EAAE,CAAC,CAAC,SAAS;IACtB,iBAAiB,EAAE,CAAC,CAAC,mBAAmB;IACxC,iBAAiB,EAAE,CAAC,CAAC,mBAAmB;CACzC,CAAC,CAAC,CAAC;AAER,MAAM,CAAC,MAAM,2CAA2C,GACtD,CAAC;KACE,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,UAAU,EAAE,CAAC;SACV,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,iCAAiC,CAAC,CAAC;SACtD,QAAQ,EAAE;CACd,CAAC;KACD,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACf,SAAS,EAAE,CAAC,CAAC,SAAS;IACtB,UAAU,EAAE,CAAC,CAAC,UAAU;CACzB,CAAC,CAAC,CAAC;AAER,MAAM,CAAC,MAAM,8CAA8C,GACzD,CAAC;KACE,MAAM,CAAC;IACN,eAAe,EAAE,CAAC,CAAC,MAA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version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/v1/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EAEZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAO3B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,EAC7C,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,IAAI,CAAC,CASf;AA2BD,wBAAsB,eAAe,CACnC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,UAAU,CAAC,CA2BrB;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,GACzC,WAAW,CASb;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/v1/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EAEZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAO3B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,EAC7C,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,IAAI,CAAC,CASf;AA2BD,wBAAsB,eAAe,CACnC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,UAAU,CAAC,CA2BrB;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,GACzC,WAAW,CASb;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAK1E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,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
|
-
|
|
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) {
|
package/dist/v1/utils.js.map
CHANGED
|
@@ -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,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,KAAK,UAAU,OAAO,CACpB,IAAuC;IAEvC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAA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,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,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@databricks/sdk-uc-grants",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./v1": {
|
|
8
8
|
"types": "./dist/v1/index.d.ts",
|
|
9
|
-
"import": "./dist/v1/index.js"
|
|
9
|
+
"import": "./dist/v1/index.js",
|
|
10
|
+
"default": "./dist/v1/index.js"
|
|
10
11
|
}
|
|
11
12
|
},
|
|
12
13
|
"files": [
|
|
13
14
|
"dist",
|
|
14
|
-
"src",
|
|
15
15
|
"LICENSE"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"author": "Databricks",
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@databricks/sdk-auth": ">=0.1.0-dev.
|
|
32
|
-
"@databricks/sdk-core": ">=0.1.0-dev.
|
|
33
|
-
"@databricks/sdk-options": ">=0.1.0-dev.
|
|
31
|
+
"@databricks/sdk-auth": ">=0.1.0-dev.5 <1.0.0",
|
|
32
|
+
"@databricks/sdk-core": ">=0.1.0-dev.6 <1.0.0",
|
|
33
|
+
"@databricks/sdk-options": ">=0.1.0-dev.5 <1.0.0",
|
|
34
34
|
"@js-temporal/polyfill": "^0.5.0",
|
|
35
35
|
"json-bigint": "^1.0.0",
|
|
36
36
|
"zod": "^4.3.6"
|
package/src/v1/client.ts
DELETED
|
@@ -1,199 +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
|
-
GetEffectivePermissionsRequest,
|
|
21
|
-
GetEffectivePermissionsRequest_Response,
|
|
22
|
-
GetPermissionsRequest,
|
|
23
|
-
GetPermissionsRequest_Response,
|
|
24
|
-
UpdatePermissionsRequest,
|
|
25
|
-
UpdatePermissionsRequest_Response,
|
|
26
|
-
} from './model';
|
|
27
|
-
import {
|
|
28
|
-
marshalUpdatePermissionsRequestSchema,
|
|
29
|
-
unmarshalGetEffectivePermissionsRequest_ResponseSchema,
|
|
30
|
-
unmarshalGetPermissionsRequest_ResponseSchema,
|
|
31
|
-
unmarshalUpdatePermissionsRequest_ResponseSchema,
|
|
32
|
-
} from './model';
|
|
33
|
-
|
|
34
|
-
// Package identity segment for this client to be used in the User-Agent header.
|
|
35
|
-
const PACKAGE_SEGMENT = {
|
|
36
|
-
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
37
|
-
value: pkgJson.version,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export class GrantsClient {
|
|
41
|
-
private readonly host: string;
|
|
42
|
-
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
43
|
-
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
44
|
-
// request.
|
|
45
|
-
private readonly workspaceId: string | undefined;
|
|
46
|
-
private readonly httpClient: HttpClient;
|
|
47
|
-
private readonly logger: Logger;
|
|
48
|
-
// User-Agent header value. Composed once at construction from
|
|
49
|
-
// createDefault() merged with this package's identity and the active
|
|
50
|
-
// credential's name.
|
|
51
|
-
private readonly userAgent: string;
|
|
52
|
-
|
|
53
|
-
constructor(options: ClientOptions) {
|
|
54
|
-
if (options.host === undefined) {
|
|
55
|
-
throw new Error('Host is required.');
|
|
56
|
-
}
|
|
57
|
-
this.host = options.host.replace(/\/$/, '');
|
|
58
|
-
this.workspaceId = options.workspaceId;
|
|
59
|
-
this.logger = options.logger ?? new NoOpLogger();
|
|
60
|
-
const info = createDefault()
|
|
61
|
-
.with(PACKAGE_SEGMENT)
|
|
62
|
-
.with({key: 'sdk-js-auth', value: AUTH_VERSION})
|
|
63
|
-
.with({key: 'auth', value: options.credentials?.name() ?? 'default'});
|
|
64
|
-
this.userAgent = info.toString();
|
|
65
|
-
this.httpClient = newHttpClient(options);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Gets the effective permissions for a securable. Includes inherited permissions from any parent securables.
|
|
70
|
-
*
|
|
71
|
-
* NOTE: we recommend using max_results=0 to use the paginated version of this API. Unpaginated calls will be deprecated soon.
|
|
72
|
-
*
|
|
73
|
-
* PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may contain zero results while still providing a next_page_token.
|
|
74
|
-
* Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
|
|
75
|
-
*/
|
|
76
|
-
async getEffectivePermissions(
|
|
77
|
-
req: GetEffectivePermissionsRequest,
|
|
78
|
-
options?: CallOptions
|
|
79
|
-
): Promise<GetEffectivePermissionsRequest_Response> {
|
|
80
|
-
const url = `${this.host}/api/2.1/unity-catalog/effective-permissions/${req.securableType ?? ''}/${req.securableFullName ?? ''}`;
|
|
81
|
-
const params = new URLSearchParams();
|
|
82
|
-
if (req.principal !== undefined) {
|
|
83
|
-
params.append('principal', req.principal);
|
|
84
|
-
}
|
|
85
|
-
if (req.maxResults !== undefined) {
|
|
86
|
-
params.append('max_results', String(req.maxResults));
|
|
87
|
-
}
|
|
88
|
-
if (req.pageToken !== undefined) {
|
|
89
|
-
params.append('page_token', req.pageToken);
|
|
90
|
-
}
|
|
91
|
-
const query = params.toString();
|
|
92
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
93
|
-
let resp: GetEffectivePermissionsRequest_Response | undefined;
|
|
94
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
95
|
-
const headers = new Headers();
|
|
96
|
-
if (this.workspaceId !== undefined) {
|
|
97
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
98
|
-
}
|
|
99
|
-
headers.set('User-Agent', this.userAgent);
|
|
100
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
101
|
-
const respBody = await executeHttpCall({
|
|
102
|
-
request: httpReq,
|
|
103
|
-
httpClient: this.httpClient,
|
|
104
|
-
logger: this.logger,
|
|
105
|
-
});
|
|
106
|
-
resp = parseResponse(
|
|
107
|
-
respBody,
|
|
108
|
-
unmarshalGetEffectivePermissionsRequest_ResponseSchema
|
|
109
|
-
);
|
|
110
|
-
};
|
|
111
|
-
await executeCall(call, options);
|
|
112
|
-
if (resp === undefined) {
|
|
113
|
-
throw new Error('operation completed without a result.');
|
|
114
|
-
}
|
|
115
|
-
return resp;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Gets the permissions for a securable. Does not include inherited permissions.
|
|
120
|
-
*
|
|
121
|
-
* NOTE: we recommend using max_results=0 to use the paginated version of this API. Unpaginated calls will be deprecated soon.
|
|
122
|
-
*
|
|
123
|
-
* PAGINATION BEHAVIOR: When using pagination (max_results >= 0), a page may contain zero results while still providing a next_page_token.
|
|
124
|
-
* Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.
|
|
125
|
-
*/
|
|
126
|
-
async getPermissions(
|
|
127
|
-
req: GetPermissionsRequest,
|
|
128
|
-
options?: CallOptions
|
|
129
|
-
): Promise<GetPermissionsRequest_Response> {
|
|
130
|
-
const url = `${this.host}/api/2.1/unity-catalog/permissions/${req.securableType ?? ''}/${req.securableFullName ?? ''}`;
|
|
131
|
-
const params = new URLSearchParams();
|
|
132
|
-
if (req.principal !== undefined) {
|
|
133
|
-
params.append('principal', req.principal);
|
|
134
|
-
}
|
|
135
|
-
if (req.maxResults !== undefined) {
|
|
136
|
-
params.append('max_results', String(req.maxResults));
|
|
137
|
-
}
|
|
138
|
-
if (req.pageToken !== undefined) {
|
|
139
|
-
params.append('page_token', req.pageToken);
|
|
140
|
-
}
|
|
141
|
-
const query = params.toString();
|
|
142
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
143
|
-
let resp: GetPermissionsRequest_Response | undefined;
|
|
144
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
145
|
-
const headers = new Headers();
|
|
146
|
-
if (this.workspaceId !== undefined) {
|
|
147
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
148
|
-
}
|
|
149
|
-
headers.set('User-Agent', this.userAgent);
|
|
150
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
151
|
-
const respBody = await executeHttpCall({
|
|
152
|
-
request: httpReq,
|
|
153
|
-
httpClient: this.httpClient,
|
|
154
|
-
logger: this.logger,
|
|
155
|
-
});
|
|
156
|
-
resp = parseResponse(
|
|
157
|
-
respBody,
|
|
158
|
-
unmarshalGetPermissionsRequest_ResponseSchema
|
|
159
|
-
);
|
|
160
|
-
};
|
|
161
|
-
await executeCall(call, options);
|
|
162
|
-
if (resp === undefined) {
|
|
163
|
-
throw new Error('operation completed without a result.');
|
|
164
|
-
}
|
|
165
|
-
return resp;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/** Updates the permissions for a securable. */
|
|
169
|
-
async updatePermissions(
|
|
170
|
-
req: UpdatePermissionsRequest,
|
|
171
|
-
options?: CallOptions
|
|
172
|
-
): Promise<UpdatePermissionsRequest_Response> {
|
|
173
|
-
const url = `${this.host}/api/2.1/unity-catalog/permissions/${req.securableType ?? ''}/${req.securableFullName ?? ''}`;
|
|
174
|
-
const body = marshalRequest(req, marshalUpdatePermissionsRequestSchema);
|
|
175
|
-
let resp: UpdatePermissionsRequest_Response | undefined;
|
|
176
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
177
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
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('PATCH', url, headers, callSignal, body);
|
|
183
|
-
const respBody = await executeHttpCall({
|
|
184
|
-
request: httpReq,
|
|
185
|
-
httpClient: this.httpClient,
|
|
186
|
-
logger: this.logger,
|
|
187
|
-
});
|
|
188
|
-
resp = parseResponse(
|
|
189
|
-
respBody,
|
|
190
|
-
unmarshalUpdatePermissionsRequest_ResponseSchema
|
|
191
|
-
);
|
|
192
|
-
};
|
|
193
|
-
await executeCall(call, options);
|
|
194
|
-
if (resp === undefined) {
|
|
195
|
-
throw new Error('operation completed without a result.');
|
|
196
|
-
}
|
|
197
|
-
return resp;
|
|
198
|
-
}
|
|
199
|
-
}
|
package/src/v1/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
export {GrantsClient} from './client';
|
|
4
|
-
|
|
5
|
-
export type {
|
|
6
|
-
EffectivePrivilege,
|
|
7
|
-
EffectivePrivilegeAssignment,
|
|
8
|
-
GetEffectivePermissionsRequest,
|
|
9
|
-
GetEffectivePermissionsRequest_Response,
|
|
10
|
-
GetPermissionsRequest,
|
|
11
|
-
GetPermissionsRequest_Response,
|
|
12
|
-
PermissionsChange,
|
|
13
|
-
PrivilegeAssignment,
|
|
14
|
-
UpdatePermissionsRequest,
|
|
15
|
-
UpdatePermissionsRequest_Response,
|
|
16
|
-
} from './model';
|
package/src/v1/model.ts
DELETED
|
@@ -1,235 +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 EffectivePrivilege {
|
|
6
|
-
/** The privilege assigned to the principal. */
|
|
7
|
-
privilege?: string | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* The type of the object that conveys this privilege via inheritance.
|
|
10
|
-
* This field is omitted when privilege is not inherited (it's assigned to the securable itself).
|
|
11
|
-
*/
|
|
12
|
-
inheritedFromType?: string | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* The full name of the object that conveys this privilege via inheritance.
|
|
15
|
-
* This field is omitted when privilege is not inherited (it's assigned to the securable itself).
|
|
16
|
-
*/
|
|
17
|
-
inheritedFromName?: string | undefined;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface EffectivePrivilegeAssignment {
|
|
21
|
-
/** The principal (user email address or group name). */
|
|
22
|
-
principal?: string | undefined;
|
|
23
|
-
/** The privileges conveyed to the principal (either directly or via inheritance). */
|
|
24
|
-
privileges?: EffectivePrivilege[] | undefined;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface GetEffectivePermissionsRequest {
|
|
28
|
-
/** Type of securable. */
|
|
29
|
-
securableType?: string | undefined;
|
|
30
|
-
/** Full name of securable. */
|
|
31
|
-
securableFullName?: string | undefined;
|
|
32
|
-
/** If provided, only the effective permissions for the specified principal (user or group) are returned. */
|
|
33
|
-
principal?: string | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* Specifies the maximum number of privileges to return (page length).
|
|
36
|
-
* Every EffectivePrivilegeAssignment present in a single page response is guaranteed to contain all the effective
|
|
37
|
-
* privileges granted on (or inherited by) the requested Securable for the respective principal.
|
|
38
|
-
*
|
|
39
|
-
* If not set, all the effective permissions are returned.
|
|
40
|
-
* If set to
|
|
41
|
-
* - lesser than 0: invalid parameter error
|
|
42
|
-
* - 0: page length is set to a server configured value
|
|
43
|
-
* - lesser than 150 but greater than 0: invalid parameter error (this is to ensure that server is able to return at
|
|
44
|
-
* least one complete EffectivePrivilegeAssignment in a single page response)
|
|
45
|
-
* - greater than (or equal to) 150: page length is the minimum of this value and a server configured value
|
|
46
|
-
*/
|
|
47
|
-
maxResults?: number | undefined;
|
|
48
|
-
/** Opaque token for the next page of results (pagination). */
|
|
49
|
-
pageToken?: string | undefined;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
|
|
53
|
-
export interface GetEffectivePermissionsRequest_Response {
|
|
54
|
-
/**
|
|
55
|
-
* Opaque token to retrieve the next page of results. Absent if there are no more pages.
|
|
56
|
-
* __page_token__ should be set to this value for the next request (for the next page of results).
|
|
57
|
-
*/
|
|
58
|
-
nextPageToken?: string | undefined;
|
|
59
|
-
/** The privileges conveyed to each principal (either directly or via inheritance) */
|
|
60
|
-
privilegeAssignments?: EffectivePrivilegeAssignment[] | undefined;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface GetPermissionsRequest {
|
|
64
|
-
/** Type of securable. */
|
|
65
|
-
securableType?: string | undefined;
|
|
66
|
-
/** Full name of securable. */
|
|
67
|
-
securableFullName?: string | undefined;
|
|
68
|
-
/** If provided, only the permissions for the specified principal (user or group) are returned. */
|
|
69
|
-
principal?: string | undefined;
|
|
70
|
-
/**
|
|
71
|
-
* Specifies the maximum number of privileges to return (page length).
|
|
72
|
-
* Every PrivilegeAssignment present in a single page response is guaranteed to contain all the privileges granted on
|
|
73
|
-
* the requested Securable for the respective principal.
|
|
74
|
-
*
|
|
75
|
-
* If not set, all the permissions are returned.
|
|
76
|
-
* If set to
|
|
77
|
-
* - lesser than 0: invalid parameter error
|
|
78
|
-
* - 0: page length is set to a server configured value
|
|
79
|
-
* - lesser than 150 but greater than 0: invalid parameter error (this is to ensure that server is able to return at
|
|
80
|
-
* least one complete PrivilegeAssignment in a single page response)
|
|
81
|
-
* - greater than (or equal to) 150: page length is the minimum of this value and a server configured value
|
|
82
|
-
*/
|
|
83
|
-
maxResults?: number | undefined;
|
|
84
|
-
/** Opaque pagination token to go to next page based on previous query. */
|
|
85
|
-
pageToken?: string | undefined;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
|
|
89
|
-
export interface GetPermissionsRequest_Response {
|
|
90
|
-
/**
|
|
91
|
-
* Opaque token to retrieve the next page of results. Absent if there are no more pages.
|
|
92
|
-
* __page_token__ should be set to this value for the next request (for the next page of results).
|
|
93
|
-
*/
|
|
94
|
-
nextPageToken?: string | undefined;
|
|
95
|
-
/** The privileges assigned to each principal */
|
|
96
|
-
privilegeAssignments?: PrivilegeAssignment[] | undefined;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface PermissionsChange {
|
|
100
|
-
/**
|
|
101
|
-
* The principal whose privileges we are changing.
|
|
102
|
-
* Only one of principal or principal_id should be specified, never both at the same time.
|
|
103
|
-
*/
|
|
104
|
-
principal?: string | undefined;
|
|
105
|
-
/** The set of privileges to add. */
|
|
106
|
-
add?: string[] | undefined;
|
|
107
|
-
/** The set of privileges to remove. */
|
|
108
|
-
remove?: string[] | undefined;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface PrivilegeAssignment {
|
|
112
|
-
/**
|
|
113
|
-
* The principal (user email address or group name).
|
|
114
|
-
* For deleted principals, `principal` is empty while `principal_id` is populated.
|
|
115
|
-
*/
|
|
116
|
-
principal?: string | undefined;
|
|
117
|
-
/** The privileges assigned to the principal. */
|
|
118
|
-
privileges?: string[] | undefined;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface UpdatePermissionsRequest {
|
|
122
|
-
/** Type of securable. */
|
|
123
|
-
securableType?: string | undefined;
|
|
124
|
-
/** Full name of securable. */
|
|
125
|
-
securableFullName?: string | undefined;
|
|
126
|
-
/** Array of permissions change objects. */
|
|
127
|
-
changes?: PermissionsChange[] | undefined;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
|
|
131
|
-
export interface UpdatePermissionsRequest_Response {
|
|
132
|
-
/** The privileges assigned to each principal */
|
|
133
|
-
privilegeAssignments?: PrivilegeAssignment[] | undefined;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export const unmarshalEffectivePrivilegeSchema: z.ZodType<EffectivePrivilege> =
|
|
137
|
-
z
|
|
138
|
-
.object({
|
|
139
|
-
privilege: z.string().optional(),
|
|
140
|
-
inherited_from_type: z.string().optional(),
|
|
141
|
-
inherited_from_name: z.string().optional(),
|
|
142
|
-
})
|
|
143
|
-
.transform(d => ({
|
|
144
|
-
privilege: d.privilege,
|
|
145
|
-
inheritedFromType: d.inherited_from_type,
|
|
146
|
-
inheritedFromName: d.inherited_from_name,
|
|
147
|
-
}));
|
|
148
|
-
|
|
149
|
-
export const unmarshalEffectivePrivilegeAssignmentSchema: z.ZodType<EffectivePrivilegeAssignment> =
|
|
150
|
-
z
|
|
151
|
-
.object({
|
|
152
|
-
principal: z.string().optional(),
|
|
153
|
-
privileges: z
|
|
154
|
-
.array(z.lazy(() => unmarshalEffectivePrivilegeSchema))
|
|
155
|
-
.optional(),
|
|
156
|
-
})
|
|
157
|
-
.transform(d => ({
|
|
158
|
-
principal: d.principal,
|
|
159
|
-
privileges: d.privileges,
|
|
160
|
-
}));
|
|
161
|
-
|
|
162
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
|
|
163
|
-
export const unmarshalGetEffectivePermissionsRequest_ResponseSchema: z.ZodType<GetEffectivePermissionsRequest_Response> =
|
|
164
|
-
z
|
|
165
|
-
.object({
|
|
166
|
-
next_page_token: z.string().optional(),
|
|
167
|
-
privilege_assignments: z
|
|
168
|
-
.array(z.lazy(() => unmarshalEffectivePrivilegeAssignmentSchema))
|
|
169
|
-
.optional(),
|
|
170
|
-
})
|
|
171
|
-
.transform(d => ({
|
|
172
|
-
nextPageToken: d.next_page_token,
|
|
173
|
-
privilegeAssignments: d.privilege_assignments,
|
|
174
|
-
}));
|
|
175
|
-
|
|
176
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
|
|
177
|
-
export const unmarshalGetPermissionsRequest_ResponseSchema: z.ZodType<GetPermissionsRequest_Response> =
|
|
178
|
-
z
|
|
179
|
-
.object({
|
|
180
|
-
next_page_token: z.string().optional(),
|
|
181
|
-
privilege_assignments: z
|
|
182
|
-
.array(z.lazy(() => unmarshalPrivilegeAssignmentSchema))
|
|
183
|
-
.optional(),
|
|
184
|
-
})
|
|
185
|
-
.transform(d => ({
|
|
186
|
-
nextPageToken: d.next_page_token,
|
|
187
|
-
privilegeAssignments: d.privilege_assignments,
|
|
188
|
-
}));
|
|
189
|
-
|
|
190
|
-
export const unmarshalPrivilegeAssignmentSchema: z.ZodType<PrivilegeAssignment> =
|
|
191
|
-
z
|
|
192
|
-
.object({
|
|
193
|
-
principal: z.string().optional(),
|
|
194
|
-
privileges: z.array(z.string()).optional(),
|
|
195
|
-
})
|
|
196
|
-
.transform(d => ({
|
|
197
|
-
principal: d.principal,
|
|
198
|
-
privileges: d.privileges,
|
|
199
|
-
}));
|
|
200
|
-
|
|
201
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
|
|
202
|
-
export const unmarshalUpdatePermissionsRequest_ResponseSchema: z.ZodType<UpdatePermissionsRequest_Response> =
|
|
203
|
-
z
|
|
204
|
-
.object({
|
|
205
|
-
privilege_assignments: z
|
|
206
|
-
.array(z.lazy(() => unmarshalPrivilegeAssignmentSchema))
|
|
207
|
-
.optional(),
|
|
208
|
-
})
|
|
209
|
-
.transform(d => ({
|
|
210
|
-
privilegeAssignments: d.privilege_assignments,
|
|
211
|
-
}));
|
|
212
|
-
|
|
213
|
-
export const marshalPermissionsChangeSchema: z.ZodType = z
|
|
214
|
-
.object({
|
|
215
|
-
principal: z.string().optional(),
|
|
216
|
-
add: z.array(z.string()).optional(),
|
|
217
|
-
remove: z.array(z.string()).optional(),
|
|
218
|
-
})
|
|
219
|
-
.transform(d => ({
|
|
220
|
-
principal: d.principal,
|
|
221
|
-
add: d.add,
|
|
222
|
-
remove: d.remove,
|
|
223
|
-
}));
|
|
224
|
-
|
|
225
|
-
export const marshalUpdatePermissionsRequestSchema: z.ZodType = z
|
|
226
|
-
.object({
|
|
227
|
-
securableType: z.string().optional(),
|
|
228
|
-
securableFullName: z.string().optional(),
|
|
229
|
-
changes: z.array(z.lazy(() => marshalPermissionsChangeSchema)).optional(),
|
|
230
|
-
})
|
|
231
|
-
.transform(d => ({
|
|
232
|
-
securable_type: d.securableType,
|
|
233
|
-
securable_full_name: d.securableFullName,
|
|
234
|
-
changes: d.changes,
|
|
235
|
-
}));
|
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
|
-
}
|