メインコンテンツへスキップ

update-role

dci update-role <id> [body]

Updates the name, description and/or permissions of a custom role. Only the fields present in the body change; permissions replaces the full list when present. Preset roles cannot be modified. A service account of a parent tenant can update a descendant tenant's role by setting X-Tenant-Id to that tenant's customer ID.

  • id — The unique ID of the role to update.

Pass the request body as name: value arguments or pipe JSON on stdin — see Command structure.

Request​

Content-Type: application/json

FieldTypeRequiredDescription
namestringThe new name of the role. Must be unique among the customer's roles, including preset roles.
descriptionstringThe new description of the role.
permissionsarray of stringPermission IDs that replace the role's current permissions, as returned in permissions by GET /iam/v1/roles. Duplicates are ignored.

Example body (JSON)​

{
"name": "FinOps Analyst",
"description": "Read-only access to cost reports and budgets",
"permissions": [
"oeuwhFPi8UTccU1nYjdl",
"8zXuFyohNSiiLy2ZQ6Xu"
]
}
Raw JSON schema
{
"type": "object",
"description": "Fields allowed when updating a custom role. At least one field is required.",
"minProperties": 1,
"properties": {
"name": {
"type": "string",
"description": "The new name of the role. Must be unique among the customer's roles, including preset roles."
},
"description": {
"type": "string",
"description": "The new description of the role."
},
"permissions": {
"type": "array",
"description": "Permission IDs that replace the role's current permissions, as returned in `permissions` by `GET /iam/v1/roles`. Duplicates are ignored.",
"items": {
"type": "string"
}
}
}
}

Output​

OK - Role updated.

By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.

FieldTypeDescription
roleobjectDefinition and permissions assigned to a role.
role.idstringThe unique ID of the role.
role.namestringThe name of the role.
role.typestringThe type of the role (preset or custom).
role.descriptionstringThe description of the role.
role.customerstringThe customer ID if this is a custom role.
role.permissionsarray of stringList of permission IDs assigned to the role.
role.childTenantEligiblebooleanWhether the owning tenant made this role available as a child tenant role.
Raw JSON schema
{
"type": "object",
"description": "Response returned after updating a role.",
"properties": {
"role": {
"type": "object",
"description": "Definition and permissions assigned to a role.",
"properties": {
"id": {
"type": "string",
"description": "The unique ID of the role."
},
"name": {
"type": "string",
"description": "The name of the role."
},
"type": {
"type": "string",
"description": "The type of the role (preset or custom)."
},
"description": {
"type": "string",
"description": "The description of the role."
},
"customer": {
"type": "string",
"description": "The customer ID if this is a custom role."
},
"permissions": {
"type": "array",
"description": "List of permission IDs assigned to the role.",
"items": {
"type": "string"
}
},
"childTenantEligible": {
"type": "boolean",
"description": "Whether the owning tenant made this role available as a child tenant role."
}
}
}
}
}

Errors​

On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.

HTTP status to exit code mapping
HTTP statusExit codeError codeMeaning
40030VALIDATION_ERRORThe arguments or request body were rejected. Review the command's flags and payload.
40110AUTHENTICATION_FAILEDNot signed in, or the API token is invalid. Run dci login or check DCI_API_KEY.
40311PERMISSION_DENIEDThe DoiT user or the active customer context does not have access.
40420RESOURCE_NOT_FOUNDThe requested resource does not exist. Check the identifier argument.
40921RESOURCE_CONFLICTThe operation conflicts with the resource's current state.
50040API_SERVER_ERRORThe API failed to process the request. Retryable; contact DoiT support if it persists.

Aliases: updaterole