createOrganizationRole method
Create an organization role
Creates a new organization role with the given name and permissions for an instance. The key must be unique for the instance and start with the 'org:' prefix, followed by lowercase alphanumeric characters and underscores only. You can optionally provide a description for the role and specify whether it should be included in the initial role set. Organization roles support permissions that can be assigned to control access within the organization.
Parameters:
- CreateOrganizationRoleRequest createOrganizationRoleRequest (required):
Implementation
Future<Role?> createOrganizationRole(
CreateOrganizationRoleRequest createOrganizationRoleRequest,
) async {
final response = await createOrganizationRoleWithHttpInfo(
createOrganizationRoleRequest,
);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty &&
response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'Role',
) as Role;
}
return null;
}