@databricks/sdk-accessmanagement 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/src/v1/model.ts DELETED
@@ -1,741 +0,0 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
-
3
- import {z} from 'zod';
4
-
5
- /** Permission level */
6
- export enum PermissionLevel {
7
- CAN_MANAGE = 'CAN_MANAGE',
8
- CAN_RESTART = 'CAN_RESTART',
9
- CAN_ATTACH_TO = 'CAN_ATTACH_TO',
10
- IS_OWNER = 'IS_OWNER',
11
- CAN_MANAGE_RUN = 'CAN_MANAGE_RUN',
12
- CAN_VIEW = 'CAN_VIEW',
13
- CAN_READ = 'CAN_READ',
14
- CAN_RUN = 'CAN_RUN',
15
- CAN_EDIT = 'CAN_EDIT',
16
- CAN_USE = 'CAN_USE',
17
- CAN_MANAGE_STAGING_VERSIONS = 'CAN_MANAGE_STAGING_VERSIONS',
18
- CAN_MANAGE_PRODUCTION_VERSIONS = 'CAN_MANAGE_PRODUCTION_VERSIONS',
19
- CAN_EDIT_METADATA = 'CAN_EDIT_METADATA',
20
- CAN_VIEW_METADATA = 'CAN_VIEW_METADATA',
21
- CAN_BIND = 'CAN_BIND',
22
- CAN_QUERY = 'CAN_QUERY',
23
- CAN_MONITOR = 'CAN_MONITOR',
24
- CAN_CREATE = 'CAN_CREATE',
25
- CAN_MONITOR_ONLY = 'CAN_MONITOR_ONLY',
26
- CAN_CREATE_APP = 'CAN_CREATE_APP',
27
- }
28
-
29
- /**
30
- * Defines the identity to be used for authZ of the request on the server side. See one pager for
31
- * for more information: http://go/acl/service-identity
32
- */
33
- export enum RequestAuthzIdentity {
34
- REQUEST_AUTHZ_IDENTITY_UNSPECIFIED = 'REQUEST_AUTHZ_IDENTITY_UNSPECIFIED',
35
- REQUEST_AUTHZ_IDENTITY_USER_CONTEXT = 'REQUEST_AUTHZ_IDENTITY_USER_CONTEXT',
36
- REQUEST_AUTHZ_IDENTITY_SERVICE_IDENTITY = 'REQUEST_AUTHZ_IDENTITY_SERVICE_IDENTITY',
37
- }
38
-
39
- export enum WorkspacePermission {
40
- UNKNOWN = 'UNKNOWN',
41
- /** The most basic workspace permission */
42
- USER = 'USER',
43
- ADMIN = 'ADMIN',
44
- }
45
-
46
- export interface AccessControlRequest {
47
- principalName?:
48
- | {
49
- $case: 'userName';
50
- /** name of the user */
51
- userName: string;
52
- }
53
- | {
54
- $case: 'groupName';
55
- /** name of the group */
56
- groupName: string;
57
- }
58
- | {
59
- $case: 'servicePrincipalName';
60
- /** application ID of a service principal */
61
- servicePrincipalName: string;
62
- }
63
- | undefined;
64
- permissionLevel?: PermissionLevel | undefined;
65
- }
66
-
67
- export interface AccessControlResponse {
68
- principalName?:
69
- | {
70
- $case: 'userName';
71
- /** name of the user */
72
- userName: string;
73
- }
74
- | {
75
- $case: 'groupName';
76
- /** name of the group */
77
- groupName: string;
78
- }
79
- | {
80
- $case: 'servicePrincipalName';
81
- /** Name of the service principal. */
82
- servicePrincipalName: string;
83
- }
84
- | undefined;
85
- /** Display name of the user or service principal. */
86
- displayName?: string | undefined;
87
- /** All permissions. */
88
- allPermissions?: Permission[] | undefined;
89
- }
90
-
91
- /**
92
- * represents an identity trying to access a resource - user or a service principal
93
- * group can be a principal of a permission set assignment but an actor is always a user or a service principal
94
- */
95
- export interface Actor {
96
- kind?: {$case: 'actorId'; actorId: bigint} | undefined;
97
- }
98
-
99
- export interface CheckPolicyRequest {
100
- actor?: Actor | undefined;
101
- permission?: string | undefined;
102
- /**
103
- * Ex: (servicePrincipal/use, accounts/<account-id>/servicePrincipals/<sp-id>)
104
- * Ex: (servicePrincipal.ruleSet/update, accounts/<account-id>/servicePrincipals/<sp-id>/ruleSets/default)
105
- */
106
- resource?: string | undefined;
107
- consistencyToken?: ConsistencyToken | undefined;
108
- authzIdentity?: RequestAuthzIdentity | undefined;
109
- resourceInfo?: ResourceInfo | undefined;
110
- }
111
-
112
- export interface CheckPolicyResponse {
113
- isPermitted?: boolean | undefined;
114
- consistencyToken?: ConsistencyToken | undefined;
115
- }
116
-
117
- export interface ConsistencyToken {
118
- value?: string | undefined;
119
- }
120
-
121
- /** Removes all permission assignments for a workspace given a principal. */
122
- export interface DeleteWorkspacePermissionAssignmentRequest {
123
- /** The account ID. */
124
- accountId?: string | undefined;
125
- /** The workspace ID for the account. */
126
- workspaceId?: bigint | undefined;
127
- /** The ID of the user, service principal, or group. */
128
- principalId?: bigint | undefined;
129
- }
130
-
131
- // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-object-type -- Proto-style nested message name.
132
- export interface DeleteWorkspacePermissionAssignmentRequest_Response {}
133
-
134
- export interface GetObjectPermissionsRequest {
135
- /** The type of the request object. Can be one of the following: alerts, alertsv2, authorization, clusters, cluster-policies, dashboards, database-projects, dbsql-dashboards, directories, experiments, files, genie, instance-pools, jobs, knowledge-assistants, notebooks, pipelines, queries, registered-models, repos, serving-endpoints, supervisor-agents, vector-search-endpoints, or warehouses. */
136
- requestObjectType?: string | undefined;
137
- /** The id of the request object. */
138
- requestObjectId?: string | undefined;
139
- }
140
-
141
- export interface GetRuleSetRequest {
142
- /** <Databricks> account ID. */
143
- accountId?: string | undefined;
144
- /**
145
- * The ruleset name associated with the request.
146
- *
147
- * Examples | Summary
148
- * :--- | :---
149
- * `name=accounts/<ACCOUNT_ID>/ruleSets/default` | A name for a rule set on the account.
150
- * `name=accounts/<ACCOUNT_ID>/groups/<GROUP_ID>/ruleSets/default` | A name for a rule set on the group.
151
- * `name=accounts/<ACCOUNT_ID>/servicePrincipals/<SERVICE_PRINCIPAL_APPLICATION_ID>/ruleSets/default` | A name for a rule set on the service principal.
152
- * `name=accounts/<ACCOUNT_ID>/tagPolicies/<TAG_POLICY_ID>/ruleSets/default` | A name for a rule set on the tag policy.
153
- */
154
- name?: string | undefined;
155
- /**
156
- * Etag used for versioning. The response is at least as fresh as the eTag provided. Etag is used for optimistic
157
- * concurrency control as a way to help prevent simultaneous updates of a rule set from overwriting each other. It is
158
- * strongly suggested that systems make use of the etag in the read -> modify -> write pattern to perform rule set
159
- * updates in order to avoid race conditions that is get an etag from a GET rule set request, and pass it with the
160
- * PUT update request to identify the rule set version you are updating.
161
- *
162
- * Examples | Summary
163
- * :--- | :---
164
- * `etag=` | An empty etag can only be used in GET to indicate no freshness requirements.
165
- * `etag=RENUAAABhSweA4NvVmmUYdiU717H3Tgy0UJdor3gE4a+mq/oj9NjAf8ZsQ==` | An etag encoded a specific version of the rule set to get or to be updated.
166
- */
167
- etag?: string | undefined;
168
- }
169
-
170
- export interface GrantRule {
171
- /**
172
- * Principals this grant rule applies to.
173
- * A principal can be a user (for end users), a service principal (for applications and
174
- * compute workloads), or an account group. Each principal has its own identifier format:
175
- * * users/<USERNAME>
176
- * * groups/<GROUP_NAME>
177
- * * servicePrincipals/<SERVICE_PRINCIPAL_APPLICATION_ID>
178
- */
179
- principals?: string[] | undefined;
180
- /** Role that is assigned to the list of principals. */
181
- role?: string | undefined;
182
- }
183
-
184
- export interface ListAssignableRolesForResourceRequest {
185
- /** <Databricks> account ID. */
186
- accountId?: string | undefined;
187
- /**
188
- * The resource name for which assignable roles will be listed.
189
- *
190
- * Examples | Summary
191
- * :--- | :---
192
- * `resource=accounts/<ACCOUNT_ID>` | A resource name for the account.
193
- * `resource=accounts/<ACCOUNT_ID>/groups/<GROUP_ID>` | A resource name for the group.
194
- * `resource=accounts/<ACCOUNT_ID>/servicePrincipals/<SP_ID>` | A resource name for the service principal.
195
- * `resource=accounts/<ACCOUNT_ID>/tagPolicies/<TAG_POLICY_ID>` | A resource name for the tag policy.
196
- */
197
- resource?: string | undefined;
198
- }
199
-
200
- export interface ListAssignableRolesForResourceResponse {
201
- roles?: Role[] | undefined;
202
- }
203
-
204
- export interface ListPermissionLevelsRequest {
205
- /** The type of the request object. Can be one of the following: alerts, alertsv2, authorization, clusters, cluster-policies, dashboards, database-projects, dbsql-dashboards, directories, experiments, files, genie, instance-pools, jobs, knowledge-assistants, notebooks, pipelines, queries, registered-models, repos, serving-endpoints, supervisor-agents, vector-search-endpoints, or warehouses. */
206
- requestObjectType?: string | undefined;
207
- requestObjectId?: string | undefined;
208
- }
209
-
210
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
211
- export interface ListPermissionLevelsRequest_Response {
212
- /** Specific permission levels */
213
- permissionLevels?: PermissionsDescription[] | undefined;
214
- }
215
-
216
- /** Gets all the permission assignments for a workspace, given an account and a workspace. */
217
- export interface ListWorkspacePermissionAssignmentsRequest {
218
- /** The account ID. */
219
- accountId?: string | undefined;
220
- /** The workspace ID for the account. */
221
- workspaceId?: bigint | undefined;
222
- }
223
-
224
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
225
- export interface ListWorkspacePermissionAssignmentsRequest_Response {
226
- /** Array of permissions assignments defined for a workspace. */
227
- permissionAssignments?: WorkspacePermissionAssignmentOutput[] | undefined;
228
- }
229
-
230
- /** List permissions for a workspace, given an account and a workspace. */
231
- export interface ListWorkspacePermissionsRequest {
232
- /** The account ID. */
233
- accountId?: string | undefined;
234
- /** The workspace ID. */
235
- workspaceId?: bigint | undefined;
236
- }
237
-
238
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
239
- export interface ListWorkspacePermissionsRequest_Response {
240
- /** Array of permissions defined for a workspace. */
241
- permissions?: PermissionOutput[] | undefined;
242
- }
243
-
244
- export interface Permission {
245
- permissionLevel?: PermissionLevel | undefined;
246
- inherited?: boolean | undefined;
247
- inheritedFromObject?: string[] | undefined;
248
- }
249
-
250
- export interface PermissionOutput {
251
- permissionLevel?: WorkspacePermission | undefined;
252
- /** The results of a permissions query. */
253
- description?: string | undefined;
254
- }
255
-
256
- export interface PermissionsDescription {
257
- permissionLevel?: PermissionLevel | undefined;
258
- description?: string | undefined;
259
- }
260
-
261
- export interface PermissionsResponse {
262
- objectId?: string | undefined;
263
- objectType?: string | undefined;
264
- accessControlList?: AccessControlResponse[] | undefined;
265
- }
266
-
267
- /** Information about the principal assigned to the workspace. */
268
- export interface PrincipalOutput {
269
- principalName?:
270
- | {
271
- $case: 'userName';
272
- /** The username of the user. Present only if the principal is a user. */
273
- userName: string;
274
- }
275
- | {
276
- $case: 'groupName';
277
- /** The group name of the group. Present only if the principal is a group. */
278
- groupName: string;
279
- }
280
- | {
281
- $case: 'servicePrincipalName';
282
- /** The name of the service principal. Present only if the principal is a service principal. */
283
- servicePrincipalName: string;
284
- }
285
- | undefined;
286
- /** The unique, opaque id of the principal. */
287
- principalId?: bigint | undefined;
288
- /** The display name of the principal. */
289
- displayName?: string | undefined;
290
- }
291
-
292
- export interface ResourceInfo {
293
- /** Id of the current resource. */
294
- id?: string | undefined;
295
- /** Parent resource info for the current resource. The parent may have another parent. */
296
- parentResourceInfo?: ResourceInfo | undefined;
297
- /** The legacy acl path of the current resource. */
298
- legacyAclPath?: string | undefined;
299
- }
300
-
301
- export interface Role {
302
- /** Role to assign to a principal or a list of principals on a resource. */
303
- name?: string | undefined;
304
- }
305
-
306
- export interface RuleSet {
307
- /** Name of the rule set. */
308
- name?: string | undefined;
309
- /**
310
- * Identifies the version of the rule set returned.
311
- * Etag used for versioning. The response is at least as fresh as the eTag provided.
312
- * Etag is used for optimistic concurrency control as a way to help prevent simultaneous
313
- * updates of a rule set from overwriting each other. It is strongly suggested that systems
314
- * make use of the etag in the read -> modify -> write pattern to perform rule set updates in
315
- * order to avoid race conditions that is get an etag from a GET rule set request, and pass it
316
- * with the PUT update request to identify the rule set version you are updating.
317
- */
318
- etag?: string | undefined;
319
- grantRules?: GrantRule[] | undefined;
320
- }
321
-
322
- export interface RuleSetUpdateRequest {
323
- /** Name of the rule set. */
324
- name?: string | undefined;
325
- /**
326
- * Identifies the version of the rule set returned.
327
- * Etag used for versioning. The response is at least as fresh as the eTag provided.
328
- * Etag is used for optimistic concurrency control as a way to help prevent simultaneous
329
- * updates of a rule set from overwriting each other. It is strongly suggested that systems
330
- * make use of the etag in the read -> modify -> write pattern to perform rule set updates in
331
- * order to avoid race conditions that is get an etag from a GET rule set request, and pass it
332
- * with the PUT update request to identify the rule set version you are updating.
333
- */
334
- etag?: string | undefined;
335
- grantRules?: GrantRule[] | undefined;
336
- }
337
-
338
- export interface SetObjectPermissionsRequest {
339
- /** The type of the request object. Can be one of the following: alerts, alertsv2, authorization, clusters, cluster-policies, dashboards, database-projects, dbsql-dashboards, directories, experiments, files, genie, instance-pools, jobs, knowledge-assistants, notebooks, pipelines, queries, registered-models, repos, serving-endpoints, supervisor-agents, vector-search-endpoints, or warehouses. */
340
- requestObjectType?: string | undefined;
341
- /** The id of the request object. */
342
- requestObjectId?: string | undefined;
343
- accessControlList?: AccessControlRequest[] | undefined;
344
- }
345
-
346
- export interface UpdateObjectPermissionsRequest {
347
- /** The type of the request object. Can be one of the following: alerts, alertsv2, authorization, clusters, cluster-policies, dashboards, database-projects, dbsql-dashboards, directories, experiments, files, genie, instance-pools, jobs, knowledge-assistants, notebooks, pipelines, queries, registered-models, repos, serving-endpoints, supervisor-agents, vector-search-endpoints, or warehouses. */
348
- requestObjectType?: string | undefined;
349
- /** The id of the request object. */
350
- requestObjectId?: string | undefined;
351
- accessControlList?: AccessControlRequest[] | undefined;
352
- }
353
-
354
- export interface UpdateRuleSetRequest {
355
- /** <Databricks> account ID. */
356
- accountId?: string | undefined;
357
- /** Name of the rule set. */
358
- name?: string | undefined;
359
- ruleSet?: RuleSetUpdateRequest | undefined;
360
- }
361
-
362
- export interface UpdateWorkspacePermissionAssignmentRequest {
363
- /** The account ID. */
364
- accountId?: string | undefined;
365
- /** The workspace ID. */
366
- workspaceId?: bigint | undefined;
367
- /** The ID of the user, service principal, or group. */
368
- principalId?: bigint | undefined;
369
- /**
370
- * Array of permissions assignments to update on the workspace.
371
- * Valid values are "USER" and "ADMIN" (case-sensitive).
372
- * If both "USER" and "ADMIN" are provided, "ADMIN" takes precedence.
373
- * Other values will be ignored.
374
- * Note that excluding this field, or providing unsupported values, will have the same effect as providing an empty list, which will result in the deletion of all permissions for the principal.
375
- */
376
- permissions?: WorkspacePermission[] | undefined;
377
- }
378
-
379
- /**
380
- * The output format for existing workspace PermissionAssignment records, which contains some info for
381
- * user consumption.
382
- */
383
- export interface WorkspacePermissionAssignmentOutput {
384
- /** Information about the principal assigned to the workspace. */
385
- principal?: PrincipalOutput | undefined;
386
- /** The permissions level of the principal. */
387
- permissions?: WorkspacePermission[] | undefined;
388
- /** Error response associated with a workspace permission assignment, if any. */
389
- error?: string | undefined;
390
- }
391
-
392
- export const unmarshalAccessControlResponseSchema: z.ZodType<AccessControlResponse> =
393
- z
394
- .object({
395
- user_name: z.string().optional(),
396
- group_name: z.string().optional(),
397
- service_principal_name: z.string().optional(),
398
- display_name: z.string().optional(),
399
- all_permissions: z
400
- .array(z.lazy(() => unmarshalPermissionSchema))
401
- .optional(),
402
- })
403
- .transform(d => ({
404
- principalName:
405
- d.user_name !== undefined
406
- ? {$case: 'userName' as const, userName: d.user_name}
407
- : d.group_name !== undefined
408
- ? {$case: 'groupName' as const, groupName: d.group_name}
409
- : d.service_principal_name !== undefined
410
- ? {
411
- $case: 'servicePrincipalName' as const,
412
- servicePrincipalName: d.service_principal_name,
413
- }
414
- : undefined,
415
- displayName: d.display_name,
416
- allPermissions: d.all_permissions,
417
- }));
418
-
419
- export const unmarshalCheckPolicyResponseSchema: z.ZodType<CheckPolicyResponse> =
420
- z
421
- .object({
422
- is_permitted: z.boolean().optional(),
423
- consistency_token: z
424
- .lazy(() => unmarshalConsistencyTokenSchema)
425
- .optional(),
426
- })
427
- .transform(d => ({
428
- isPermitted: d.is_permitted,
429
- consistencyToken: d.consistency_token,
430
- }));
431
-
432
- export const unmarshalConsistencyTokenSchema: z.ZodType<ConsistencyToken> = z
433
- .object({
434
- value: z.string().optional(),
435
- })
436
- .transform(d => ({
437
- value: d.value,
438
- }));
439
-
440
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
441
- export const unmarshalDeleteWorkspacePermissionAssignmentRequest_ResponseSchema: z.ZodType<DeleteWorkspacePermissionAssignmentRequest_Response> =
442
- z.object({});
443
-
444
- export const unmarshalGrantRuleSchema: z.ZodType<GrantRule> = z
445
- .object({
446
- principals: z.array(z.string()).optional(),
447
- role: z.string().optional(),
448
- })
449
- .transform(d => ({
450
- principals: d.principals,
451
- role: d.role,
452
- }));
453
-
454
- export const unmarshalListAssignableRolesForResourceResponseSchema: z.ZodType<ListAssignableRolesForResourceResponse> =
455
- z
456
- .object({
457
- roles: z.array(z.lazy(() => unmarshalRoleSchema)).optional(),
458
- })
459
- .transform(d => ({
460
- roles: d.roles,
461
- }));
462
-
463
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
464
- export const unmarshalListPermissionLevelsRequest_ResponseSchema: z.ZodType<ListPermissionLevelsRequest_Response> =
465
- z
466
- .object({
467
- permission_levels: z
468
- .array(z.lazy(() => unmarshalPermissionsDescriptionSchema))
469
- .optional(),
470
- })
471
- .transform(d => ({
472
- permissionLevels: d.permission_levels,
473
- }));
474
-
475
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
476
- export const unmarshalListWorkspacePermissionAssignmentsRequest_ResponseSchema: z.ZodType<ListWorkspacePermissionAssignmentsRequest_Response> =
477
- z
478
- .object({
479
- permission_assignments: z
480
- .array(z.lazy(() => unmarshalWorkspacePermissionAssignmentOutputSchema))
481
- .optional(),
482
- })
483
- .transform(d => ({
484
- permissionAssignments: d.permission_assignments,
485
- }));
486
-
487
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
488
- export const unmarshalListWorkspacePermissionsRequest_ResponseSchema: z.ZodType<ListWorkspacePermissionsRequest_Response> =
489
- z
490
- .object({
491
- permissions: z
492
- .array(z.lazy(() => unmarshalPermissionOutputSchema))
493
- .optional(),
494
- })
495
- .transform(d => ({
496
- permissions: d.permissions,
497
- }));
498
-
499
- export const unmarshalPermissionSchema: z.ZodType<Permission> = z
500
- .object({
501
- permission_level: z.enum(PermissionLevel).optional(),
502
- inherited: z.boolean().optional(),
503
- inherited_from_object: z.array(z.string()).optional(),
504
- })
505
- .transform(d => ({
506
- permissionLevel: d.permission_level,
507
- inherited: d.inherited,
508
- inheritedFromObject: d.inherited_from_object,
509
- }));
510
-
511
- export const unmarshalPermissionOutputSchema: z.ZodType<PermissionOutput> = z
512
- .object({
513
- permission_level: z.enum(WorkspacePermission).optional(),
514
- description: z.string().optional(),
515
- })
516
- .transform(d => ({
517
- permissionLevel: d.permission_level,
518
- description: d.description,
519
- }));
520
-
521
- export const unmarshalPermissionsDescriptionSchema: z.ZodType<PermissionsDescription> =
522
- z
523
- .object({
524
- permission_level: z.enum(PermissionLevel).optional(),
525
- description: z.string().optional(),
526
- })
527
- .transform(d => ({
528
- permissionLevel: d.permission_level,
529
- description: d.description,
530
- }));
531
-
532
- export const unmarshalPermissionsResponseSchema: z.ZodType<PermissionsResponse> =
533
- z
534
- .object({
535
- object_id: z.string().optional(),
536
- object_type: z.string().optional(),
537
- access_control_list: z
538
- .array(z.lazy(() => unmarshalAccessControlResponseSchema))
539
- .optional(),
540
- })
541
- .transform(d => ({
542
- objectId: d.object_id,
543
- objectType: d.object_type,
544
- accessControlList: d.access_control_list,
545
- }));
546
-
547
- export const unmarshalPrincipalOutputSchema: z.ZodType<PrincipalOutput> = z
548
- .object({
549
- user_name: z.string().optional(),
550
- group_name: z.string().optional(),
551
- service_principal_name: z.string().optional(),
552
- principal_id: z
553
- .union([z.number(), z.bigint()])
554
- .transform(v => BigInt(v))
555
- .optional(),
556
- display_name: z.string().optional(),
557
- })
558
- .transform(d => ({
559
- principalName:
560
- d.user_name !== undefined
561
- ? {$case: 'userName' as const, userName: d.user_name}
562
- : d.group_name !== undefined
563
- ? {$case: 'groupName' as const, groupName: d.group_name}
564
- : d.service_principal_name !== undefined
565
- ? {
566
- $case: 'servicePrincipalName' as const,
567
- servicePrincipalName: d.service_principal_name,
568
- }
569
- : undefined,
570
- principalId: d.principal_id,
571
- displayName: d.display_name,
572
- }));
573
-
574
- export const unmarshalRoleSchema: z.ZodType<Role> = z
575
- .object({
576
- name: z.string().optional(),
577
- })
578
- .transform(d => ({
579
- name: d.name,
580
- }));
581
-
582
- export const unmarshalRuleSetSchema: z.ZodType<RuleSet> = z
583
- .object({
584
- name: z.string().optional(),
585
- etag: z.string().optional(),
586
- grant_rules: z.array(z.lazy(() => unmarshalGrantRuleSchema)).optional(),
587
- })
588
- .transform(d => ({
589
- name: d.name,
590
- etag: d.etag,
591
- grantRules: d.grant_rules,
592
- }));
593
-
594
- export const unmarshalWorkspacePermissionAssignmentOutputSchema: z.ZodType<WorkspacePermissionAssignmentOutput> =
595
- z
596
- .object({
597
- principal: z.lazy(() => unmarshalPrincipalOutputSchema).optional(),
598
- permissions: z.array(z.enum(WorkspacePermission)).optional(),
599
- error: z.string().optional(),
600
- })
601
- .transform(d => ({
602
- principal: d.principal,
603
- permissions: d.permissions,
604
- error: d.error,
605
- }));
606
-
607
- export const marshalAccessControlRequestSchema: z.ZodType = z
608
- .object({
609
- principalName: z
610
- .discriminatedUnion('$case', [
611
- z.object({$case: z.literal('userName'), userName: z.string()}),
612
- z.object({$case: z.literal('groupName'), groupName: z.string()}),
613
- z.object({
614
- $case: z.literal('servicePrincipalName'),
615
- servicePrincipalName: z.string(),
616
- }),
617
- ])
618
- .optional(),
619
- permissionLevel: z.enum(PermissionLevel).optional(),
620
- })
621
- .transform(d => ({
622
- ...(d.principalName?.$case === 'userName' && {
623
- user_name: d.principalName.userName,
624
- }),
625
- ...(d.principalName?.$case === 'groupName' && {
626
- group_name: d.principalName.groupName,
627
- }),
628
- ...(d.principalName?.$case === 'servicePrincipalName' && {
629
- service_principal_name: d.principalName.servicePrincipalName,
630
- }),
631
- permission_level: d.permissionLevel,
632
- }));
633
-
634
- export const marshalActorSchema: z.ZodType = z
635
- .object({
636
- kind: z
637
- .discriminatedUnion('$case', [
638
- z.object({$case: z.literal('actorId'), actorId: z.bigint()}),
639
- ])
640
- .optional(),
641
- })
642
- .transform(d => ({
643
- ...(d.kind?.$case === 'actorId' && {actor_id: d.kind.actorId}),
644
- }));
645
-
646
- export const marshalConsistencyTokenSchema: z.ZodType = z
647
- .object({
648
- value: z.string().optional(),
649
- })
650
- .transform(d => ({
651
- value: d.value,
652
- }));
653
-
654
- export const marshalGrantRuleSchema: z.ZodType = z
655
- .object({
656
- principals: z.array(z.string()).optional(),
657
- role: z.string().optional(),
658
- })
659
- .transform(d => ({
660
- principals: d.principals,
661
- role: d.role,
662
- }));
663
-
664
- export const marshalResourceInfoSchema: z.ZodType = z
665
- .object({
666
- id: z.string().optional(),
667
- parentResourceInfo: z.lazy(() => marshalResourceInfoSchema).optional(),
668
- legacyAclPath: z.string().optional(),
669
- })
670
- .transform(d => ({
671
- id: d.id,
672
- parent_resource_info: d.parentResourceInfo,
673
- legacy_acl_path: d.legacyAclPath,
674
- }));
675
-
676
- export const marshalRuleSetUpdateRequestSchema: z.ZodType = z
677
- .object({
678
- name: z.string().optional(),
679
- etag: z.string().optional(),
680
- grantRules: z.array(z.lazy(() => marshalGrantRuleSchema)).optional(),
681
- })
682
- .transform(d => ({
683
- name: d.name,
684
- etag: d.etag,
685
- grant_rules: d.grantRules,
686
- }));
687
-
688
- export const marshalSetObjectPermissionsRequestSchema: z.ZodType = z
689
- .object({
690
- requestObjectType: z.string().optional(),
691
- requestObjectId: z.string().optional(),
692
- accessControlList: z
693
- .array(z.lazy(() => marshalAccessControlRequestSchema))
694
- .optional(),
695
- })
696
- .transform(d => ({
697
- request_object_type: d.requestObjectType,
698
- request_object_id: d.requestObjectId,
699
- access_control_list: d.accessControlList,
700
- }));
701
-
702
- export const marshalUpdateObjectPermissionsRequestSchema: z.ZodType = z
703
- .object({
704
- requestObjectType: z.string().optional(),
705
- requestObjectId: z.string().optional(),
706
- accessControlList: z
707
- .array(z.lazy(() => marshalAccessControlRequestSchema))
708
- .optional(),
709
- })
710
- .transform(d => ({
711
- request_object_type: d.requestObjectType,
712
- request_object_id: d.requestObjectId,
713
- access_control_list: d.accessControlList,
714
- }));
715
-
716
- export const marshalUpdateRuleSetRequestSchema: z.ZodType = z
717
- .object({
718
- accountId: z.string().optional(),
719
- name: z.string().optional(),
720
- ruleSet: z.lazy(() => marshalRuleSetUpdateRequestSchema).optional(),
721
- })
722
- .transform(d => ({
723
- account_id: d.accountId,
724
- name: d.name,
725
- rule_set: d.ruleSet,
726
- }));
727
-
728
- export const marshalUpdateWorkspacePermissionAssignmentRequestSchema: z.ZodType =
729
- z
730
- .object({
731
- accountId: z.string().optional(),
732
- workspaceId: z.bigint().optional(),
733
- principalId: z.bigint().optional(),
734
- permissions: z.array(z.enum(WorkspacePermission)).optional(),
735
- })
736
- .transform(d => ({
737
- account_id: d.accountId,
738
- workspace_id: d.workspaceId,
739
- principal_id: d.principalId,
740
- permissions: d.permissions,
741
- }));