Updated on 2024-08-30 GMT+08:00

Editing Environment Permission

Function

This API is used to edit the environment permission.

Calling Method

For details, see Calling APIs.

URI

PUT /v2/applications/{application_id}/environments/{environment_id}/permissions

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

application_id

Yes

String

Application ID

environment_id

Yes

String

Environment ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format). Possible values:

  • application/json;charset=utf-8

  • application/json; charset=utf-8

  • application/json;charset=UTF-8

  • application/json; charset=UTF-8

  • application/json

  • application/octet-stream;charset=utf-8

  • application/octet-stream; charset=utf-8

  • text/html;charset=UTF-8

  • text/html; charset=UTF-8

X-Auth-Token

Yes

String

User token. It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

role_id

No

String

Role ID

permission_name

No

String

Permission name: can_view, can_edit, can_delete, can_deploy, and can_manage.

permission_value

No

Boolean

true: Authorized. false: Not authorized.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

status

String

Request success or failure status

result

DevUcEnvironmentPermission object

Updated environment permission information

Table 5 DevUcEnvironmentPermission

Parameter

Type

Description

id

Integer

Permission ID

role_id

String

Role ID

devuc_role_id_list

Array of strings

Role ID list

role_type

String

Role type. environment-creator: Environment creator. project: Project administrator. template-customized-inst: System roles.

template-project-customized and project-customized: Custom roles.

name

String

Role name

region

String

Region information

environment_id

String

Environment ID

can_view

Boolean

Whether you have the view permission

can_edit

Boolean

Whether you have the edit permission

can_delete

Boolean

Whether you have the delete permission

can_deploy

Boolean

Whether you have the deploy permission

can_manage

Boolean

Whether you can manage permissions

create_time

String

Creation time

update_time

String

Modification time

Example Requests

https://{endpoint}/v2/applications/8ddf0566c1784da29faac80516fa8425/environments/54e5b8b0d10148cc96142ac9d6c1c1f6/permissions

{
  "permission_name" : "can_deploy",
  "permission_value" : true,
  "role_id" : "e72b8cebe2c6499db2b23276b3820736"
}

Example Responses

Status code: 200

OK

{
  "status" : "success",
  "result" : {
    "region" : "region",
    "id" : null,
    "name" : null,
    "role_id" : "0",
    "devuc_role_id_list" : null,
    "environment_id" : "be3e9690d6f64b23b54e79cd02c4b156",
    "can_view" : true,
    "can_edit" : true,
    "can_delete" : true,
    "can_deploy" : true,
    "can_manage" : true,
    "create_time" : null,
    "update_time" : null,
    "role_type" : "environment-creator"
  }
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.