//native
type Cockroachdb = {
token: string;
};
/**
* Update a group by supplying all values of the user object
* Can be used by the following roles assigned at the organization scope:
- ORG_ADMIN
*/
export async function main(
auth: Cockroachdb,
id: string,
body: {
displayName: string;
externalId?: string;
members?: {
display?: string;
ref?: string;
type?: string;
value?: string;
}[];
schemas: string[];
},
) {
const url = new URL(`https://cockroachlabs.cloud/api/scim/v2/Groups/${id}`);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago