Skip to main content

update-resource-permission

dci update-resource-permission <resourceType> <resourceId> [body]

Updates the permissions associated with the specified Cloud Analytics resource. Supports Allocations, Alerts, Budgets, and Reports.

  • resourceType — Resource type.
  • resourceId — Resource ID. See Resource IDs.

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

Treated as destructive

Changing permissions can revoke someone's access, so the CLI gates this command like a delete-*: interactive terminals ask for confirmation, scripts pass --yes, and --dry-run previews locally. See the CLI guide's "Destructive commands".

Examples

# Set a report's per-user roles (`owner`, `editor`, or `viewer`, keyed by email).
dci update-resource-permission reports <report-id> permissions: [{role: owner, user: "[email protected]"}, {role: viewer, user: "[email protected]"}]
# Give everyone in the organization viewer access to a budget.
dci update-resource-permission budgets <budget-id> public: viewer
# Preview the change without sending a request.
dci update-resource-permission reports <report-id> public: editor --dry-run
A local preview of the operation; the permissions are unchanged.
# Apply without the confirmation prompt, for scripts.
dci update-resource-permission reports <report-id> public: viewer --yes
The updated permission set is returned; `dci get-resource-permission reports <report-id>` shows the same.

Request

Content-Type: application/json

FieldTypeRequiredDescription
permissionsarray of object
permissions[].userstringThe email address of the user to whom the role is assigned.
permissions[].rolestringThe role assigned to the user, defining their level of access to the resource. One of: "owner", "editor", "viewer".
publicstringThe type of permissions granted to all users in the organization for this resource. One of: "editor", "viewer".
Raw JSON schema
{
"type": "object",
"properties": {
"permissions": {
"type": "array",
"items": {
"type": "object",
"description": "A single user's permission entry for a resource.",
"properties": {
"user": {
"type": "string",
"description": "The email address of the user to whom the role is assigned."
},
"role": {
"type": "string",
"description": "The role assigned to the user, defining their level of access to the resource.",
"enum": [
"owner",
"editor",
"viewer"
]
}
}
}
},
"public": {
"type": "string",
"description": "The type of permissions granted to all users in the organization for this resource.",
"enum": [
"editor",
"viewer"
],
"nullable": true
}
}
}

Output

OK - Resource permissions configuration updated.

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

FieldTypeDescription
idstringResource ID.
namestringResource name.
descriptionstringResource description.
createTimeinteger (int64)The time when this resource was created, in milliseconds since the epoch.
updateTimeinteger (int64)The time when this resource was last updated, in milliseconds since the epoch.
permissionsarray of object
permissions[].userstringThe email address of the user to whom the role is assigned.
permissions[].rolestringThe role assigned to the user, defining their level of access to the resource. One of: "owner", "editor", "viewer".
publicstringType of permissions users in the entire organization have for this resource One of: "editor", "viewer".
Raw JSON schema
{
"type": "object",
"description": "Permissions and metadata for a resource returned by the sharing API.",
"properties": {
"id": {
"type": "string",
"description": "Resource ID."
},
"name": {
"type": "string",
"description": "Resource name."
},
"description": {
"type": "string",
"description": "Resource description."
},
"createTime": {
"type": "integer",
"description": "The time when this resource was created, in milliseconds since the epoch.",
"format": "int64"
},
"updateTime": {
"type": "integer",
"description": "The time when this resource was last updated, in milliseconds since the epoch.",
"format": "int64"
},
"permissions": {
"type": "array",
"items": {
"type": "object",
"description": "A single user's permission entry for a resource.",
"properties": {
"user": {
"type": "string",
"description": "The email address of the user to whom the role is assigned."
},
"role": {
"type": "string",
"description": "The role assigned to the user, defining their level of access to the resource.",
"enum": [
"owner",
"editor",
"viewer"
]
}
}
}
},
"public": {
"type": "string",
"description": "Type of permissions users in the entire organization have for this resource",
"enum": [
"editor",
"viewer"
],
"nullable": true
}
}
}

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.
50040API_SERVER_ERRORThe API failed to process the request. Retryable; contact DoiT support if it persists.

Aliases: updateresourcepermission