@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
53 lines (47 loc) • 1.71 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
export type V2KeysSetRolesRequestBody = {
/**
* Specifies which key gets the complete role replacement using the database identifier returned from createKey.
*
* @remarks
* Do not confuse this with the actual API key string that users include in requests.
* This is a wholesale replacement operation that removes all existing roles not included in the request.
* Role changes take effect immediately but may take up to 30 seconds to propagate across all regions.
*/
keyId: string;
/**
* Replaces all existing role assignments with this complete list of roles.
*
* @remarks
* This is a wholesale replacement operation, not an incremental update like add/remove operations.
*
* Providing an empty array removes all direct role assignments from the key.
* All roles must already exist in the workspace - roles cannot be created automatically.
* Invalid role references cause the entire operation to fail atomically, ensuring consistent state.
*/
roles: Array<string>;
};
/** @internal */
export type V2KeysSetRolesRequestBody$Outbound = {
keyId: string;
roles: Array<string>;
};
/** @internal */
export const V2KeysSetRolesRequestBody$outboundSchema: z.ZodType<
V2KeysSetRolesRequestBody$Outbound,
z.ZodTypeDef,
V2KeysSetRolesRequestBody
> = z.object({
keyId: z.string(),
roles: z.array(z.string()),
});
export function v2KeysSetRolesRequestBodyToJSON(
v2KeysSetRolesRequestBody: V2KeysSetRolesRequestBody,
): string {
return JSON.stringify(
V2KeysSetRolesRequestBody$outboundSchema.parse(v2KeysSetRolesRequestBody),
);
}