Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
676 changes: 338 additions & 338 deletions package-lock.json

Large diffs are not rendered by default.

66 changes: 32 additions & 34 deletions packages/accessmanagement/src/v1/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,25 @@ export interface Actor {
}

export interface CheckPolicyRequest {
actor?: Actor | undefined;
permission?: string | undefined;
actor: Actor;
permission: string;
/**
* Ex: (servicePrincipal/use, accounts/<account-id>/servicePrincipals/<sp-id>)
* Ex: (servicePrincipal.ruleSet/update, accounts/<account-id>/servicePrincipals/<sp-id>/ruleSets/default)
*/
resource?: string | undefined;
consistencyToken?: ConsistencyToken | undefined;
authzIdentity?: RequestAuthzIdentity | undefined;
resource: string;
consistencyToken: ConsistencyToken;
authzIdentity: RequestAuthzIdentity;
resourceInfo?: ResourceInfo | undefined;
}

export interface CheckPolicyResponse {
isPermitted?: boolean | undefined;
consistencyToken?: ConsistencyToken | undefined;
consistencyToken: ConsistencyToken;
}

export interface ConsistencyToken {
value?: string | undefined;
value: string;
}

/** Removes all permission assignments for a workspace given a principal. */
Expand Down Expand Up @@ -164,7 +164,7 @@ export interface GetRuleSetRequest {
* `name=accounts/<ACCOUNT_ID>/servicePrincipals/<SERVICE_PRINCIPAL_APPLICATION_ID>/ruleSets/default` | A name for a rule set on the service principal.
* `name=accounts/<ACCOUNT_ID>/tagPolicies/<TAG_POLICY_ID>/ruleSets/default` | A name for a rule set on the tag policy.
*/
name?: string | undefined;
name: string;
/**
* Etag used for versioning. The response is at least as fresh as the eTag provided. Etag is used for optimistic
* concurrency control as a way to help prevent simultaneous updates of a rule set from overwriting each other. It is
Expand All @@ -177,7 +177,7 @@ export interface GetRuleSetRequest {
* `etag=` | An empty etag can only be used in GET to indicate no freshness requirements.
* `etag=RENUAAABhSweA4NvVmmUYdiU717H3Tgy0UJdor3gE4a+mq/oj9NjAf8ZsQ==` | An etag encoded a specific version of the rule set to get or to be updated.
*/
etag?: string | undefined;
etag: string;
}

export interface GrantRule {
Expand All @@ -191,7 +191,7 @@ export interface GrantRule {
*/
principals?: string[] | undefined;
/** Role that is assigned to the list of principals. */
role?: string | undefined;
role: string;
}

export interface ListAssignableRolesForResourceRequest {
Expand All @@ -207,7 +207,7 @@ export interface ListAssignableRolesForResourceRequest {
* `resource=accounts/<ACCOUNT_ID>/servicePrincipals/<SP_ID>` | A resource name for the service principal.
* `resource=accounts/<ACCOUNT_ID>/tagPolicies/<TAG_POLICY_ID>` | A resource name for the tag policy.
*/
resource?: string | undefined;
resource: string;
}

export interface ListAssignableRolesForResourceResponse {
Expand Down Expand Up @@ -301,7 +301,7 @@ export interface PrincipalOutput {

export interface ResourceInfo {
/** Id of the current resource. */
id?: string | undefined;
id: string;
/** Parent resource info for the current resource. The parent may have another parent. */
parentResourceInfo?: ResourceInfo | undefined;
/** The legacy acl path of the current resource. */
Expand All @@ -310,12 +310,12 @@ export interface ResourceInfo {

export interface Role {
/** Role to assign to a principal or a list of principals on a resource. */
name?: string | undefined;
name: string;
}

export interface RuleSet {
/** Name of the rule set. */
name?: string | undefined;
name: string;
/**
* Identifies the version of the rule set returned.
* Etag used for versioning. The response is at least as fresh as the eTag provided.
Expand All @@ -325,13 +325,13 @@ export interface RuleSet {
* order to avoid race conditions that is get an etag from a GET rule set request, and pass it
* with the PUT update request to identify the rule set version you are updating.
*/
etag?: string | undefined;
etag: string;
grantRules?: GrantRule[] | undefined;
}

export interface RuleSetUpdateRequest {
/** Name of the rule set. */
name?: string | undefined;
name: string;
/**
* Identifies the version of the rule set returned.
* Etag used for versioning. The response is at least as fresh as the eTag provided.
Expand All @@ -341,7 +341,7 @@ export interface RuleSetUpdateRequest {
* order to avoid race conditions that is get an etag from a GET rule set request, and pass it
* with the PUT update request to identify the rule set version you are updating.
*/
etag?: string | undefined;
etag: string;
grantRules?: GrantRule[] | undefined;
}

Expand All @@ -365,8 +365,8 @@ export interface UpdateRuleSetRequest {
/** <Databricks> account ID. */
accountId?: string | undefined;
/** Name of the rule set. */
name?: string | undefined;
ruleSet?: RuleSetUpdateRequest | undefined;
name: string;
ruleSet: RuleSetUpdateRequest;
}

export interface UpdateWorkspacePermissionAssignmentRequest {
Expand Down Expand Up @@ -430,9 +430,7 @@ export const unmarshalCheckPolicyResponseSchema: z.ZodType<CheckPolicyResponse>
z
.object({
is_permitted: z.boolean().optional(),
consistency_token: z
.lazy(() => unmarshalConsistencyTokenSchema)
.optional(),
consistency_token: z.lazy(() => unmarshalConsistencyTokenSchema),
})
.transform(d => ({
isPermitted: d.is_permitted,
Expand All @@ -441,7 +439,7 @@ export const unmarshalCheckPolicyResponseSchema: z.ZodType<CheckPolicyResponse>

export const unmarshalConsistencyTokenSchema: z.ZodType<ConsistencyToken> = z
.object({
value: z.string().optional(),
value: z.string(),
})
.transform(d => ({
value: d.value,
Expand All @@ -453,7 +451,7 @@ export const unmarshalDeleteWorkspacePermissionAssignmentResponseSchema: z.ZodTy
export const unmarshalGrantRuleSchema: z.ZodType<GrantRule> = z
.object({
principals: z.array(z.string()).optional(),
role: z.string().optional(),
role: z.string(),
})
.transform(d => ({
principals: d.principals,
Expand Down Expand Up @@ -579,16 +577,16 @@ export const unmarshalPrincipalOutputSchema: z.ZodType<PrincipalOutput> = z

export const unmarshalRoleSchema: z.ZodType<Role> = z
.object({
name: z.string().optional(),
name: z.string(),
})
.transform(d => ({
name: d.name,
}));

export const unmarshalRuleSetSchema: z.ZodType<RuleSet> = z
.object({
name: z.string().optional(),
etag: z.string().optional(),
name: z.string(),
etag: z.string(),
grant_rules: z.array(z.lazy(() => unmarshalGrantRuleSchema)).optional(),
})
.transform(d => ({
Expand Down Expand Up @@ -651,7 +649,7 @@ export const marshalActorSchema: z.ZodType = z

export const marshalConsistencyTokenSchema: z.ZodType = z
.object({
value: z.string().optional(),
value: z.string(),
})
.transform(d => ({
value: d.value,
Expand All @@ -660,7 +658,7 @@ export const marshalConsistencyTokenSchema: z.ZodType = z
export const marshalGrantRuleSchema: z.ZodType = z
.object({
principals: z.array(z.string()).optional(),
role: z.string().optional(),
role: z.string(),
})
.transform(d => ({
principals: d.principals,
Expand All @@ -669,7 +667,7 @@ export const marshalGrantRuleSchema: z.ZodType = z

export const marshalResourceInfoSchema: z.ZodType = z
.object({
id: z.string().optional(),
id: z.string(),
parentResourceInfo: z.lazy(() => marshalResourceInfoSchema).optional(),
legacyAclPath: z.string().optional(),
})
Expand All @@ -681,8 +679,8 @@ export const marshalResourceInfoSchema: z.ZodType = z

export const marshalRuleSetUpdateRequestSchema: z.ZodType = z
.object({
name: z.string().optional(),
etag: z.string().optional(),
name: z.string(),
etag: z.string(),
grantRules: z.array(z.lazy(() => marshalGrantRuleSchema)).optional(),
})
.transform(d => ({
Expand Down Expand Up @@ -722,8 +720,8 @@ export const marshalUpdateObjectPermissionsRequestSchema: z.ZodType = z
export const marshalUpdateRuleSetRequestSchema: z.ZodType = z
.object({
accountId: z.string().optional(),
name: z.string().optional(),
ruleSet: z.lazy(() => marshalRuleSetUpdateRequestSchema).optional(),
name: z.string(),
ruleSet: z.lazy(() => marshalRuleSetUpdateRequestSchema),
})
.transform(d => ({
account_id: d.accountId,
Expand Down
30 changes: 24 additions & 6 deletions packages/aigateway/src/v1/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,10 @@ export class AiGatewayClient {
const url = `${host}/api/2.1/unity-catalog/${req.name ?? ''}`;
const params = new URLSearchParams();
if (req.etag !== undefined) {
params.append('etag', String(req.etag));
params.append(
'etag',
btoa(Array.from(req.etag, b => String.fromCharCode(b)).join(''))
);
}
const query = params.toString();
const fullUrl = query !== '' ? `${url}?${query}` : url;
Expand Down Expand Up @@ -304,7 +307,10 @@ export class AiGatewayClient {
const url = `${host}/api/2.1/unity-catalog/${req.name ?? ''}`;
const params = new URLSearchParams();
if (req.etag !== undefined) {
params.append('etag', String(req.etag));
params.append(
'etag',
btoa(Array.from(req.etag, b => String.fromCharCode(b)).join(''))
);
}
const query = params.toString();
const fullUrl = query !== '' ? `${url}?${query}` : url;
Expand Down Expand Up @@ -340,7 +346,10 @@ export class AiGatewayClient {
const url = `${host}/api/2.1/unity-catalog/${req.name ?? ''}`;
const params = new URLSearchParams();
if (req.etag !== undefined) {
params.append('etag', String(req.etag));
params.append(
'etag',
btoa(Array.from(req.etag, b => String.fromCharCode(b)).join(''))
);
}
const query = params.toString();
const fullUrl = query !== '' ? `${url}?${query}` : url;
Expand Down Expand Up @@ -695,7 +704,10 @@ export class AiGatewayClient {
params.append('update_mask', req.updateMask.toString());
}
if (req.etag !== undefined) {
params.append('etag', String(req.etag));
params.append(
'etag',
btoa(Array.from(req.etag, b => String.fromCharCode(b)).join(''))
);
}
const query = params.toString();
const fullUrl = query !== '' ? `${url}?${query}` : url;
Expand Down Expand Up @@ -749,7 +761,10 @@ export class AiGatewayClient {
params.append('update_mask', req.updateMask.toString());
}
if (req.etag !== undefined) {
params.append('etag', String(req.etag));
params.append(
'etag',
btoa(Array.from(req.etag, b => String.fromCharCode(b)).join(''))
);
}
const query = params.toString();
const fullUrl = query !== '' ? `${url}?${query}` : url;
Expand Down Expand Up @@ -805,7 +820,10 @@ export class AiGatewayClient {
params.append('update_mask', req.updateMask.toString());
}
if (req.etag !== undefined) {
params.append('etag', String(req.etag));
params.append(
'etag',
btoa(Array.from(req.etag, b => String.fromCharCode(b)).join(''))
);
}
const query = params.toString();
const fullUrl = query !== '' ? `${url}?${query}` : url;
Expand Down
Loading
Loading