Overview
The update_organization_role function updates an existing organization role.
Function Signature
pub async fn update_organization_role(
organization_id: &str,
role_id: &str,
request: UpdateRoleRequest
) -> Result<OrganizationRole>
Parameters
The unique identifier of the organization
The unique identifier of the role to update
request
UpdateRoleRequest
required
The role fields to update (all optional):
name: Role name
description: Role description
permissions: List of permissions
Return Value
Returns Result<OrganizationRole> containing the updated role details.
Basic Usage
use wacht::api::organizations::*;
let update = UpdateRoleRequest {
description: Some("Updated role description".to_string()),
permissions: Some(vec![
"read:organization".to_string(),
"write:organization".to_string(),
"delete:organization".to_string(),
]),
..Default::default()
};
let updated_role = update_organization_role("org_123", "role_456", update).await?;
println!("Updated role: {}", updated_role.name);
Error Handling
match update_organization_role("org_123", "role_456", request).await {
Ok(role) => {
println!("Successfully updated role: {}", role.name);
println!("New permissions: {:?}", role.permissions);
println!("Updated at: {}", role.updated_at);
}
Err(Error::Api { status, message, .. }) => {
match status.as_u16() {
404 => println!("Organization or role not found"),
403 => println!("Access denied: {}", message),
409 => println!("Role name already exists: {}", message),
_ => println!("API error {}: {}", status, message),
}
}
Err(e) => println!("Request failed: {}", e),
}
Rate Limits
- Update operations: 100 requests per minute
- Burst limit: 10 requests per second