Modifiying Scripts
Function
This APl is used to modify scripts.
Constraints
Constraints:
-
Script name: The script name must be unique under the same tenant. The value can contain a maximum of 64 characters, including letters, digits, and underscores (_).
-
The script content can contain a maximum of 4096 characters.
-
The name of a single parameter contains 64 characters, including only letters, digits, and underscores (_).
-
The value of a parameter can contain a maximum of 1024 characters. The regular expression is ^((?!.{2,})[a-zA-Z0-9_-/.\x20?:",=+@[{]}])$.
-
If the modified script has a reviewer, you need to select reviewers again after the modification.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
coc:document:update
Write
document *
-
-
-
URI
PUT /v1/job/scripts/{script_uuid}
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
script_uuid |
Yes |
String |
Definition: Script UUID. Constraints: N/A. Value range: N/A. Default value: N/A. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Definition: Tenant token. Constraints: Tenant token obtained from IAM. Value range: N/A. Default value: N/A. |
|
X-Language |
No |
String |
Definition: Internationalization tag. zh-cn indicates Chinese, and en-us or no value indicates English. Constraints: zh-cn indicates Chinese, and en-us or no value indicates English. Value range: zh-cn and en-us Default value: N/A. |
|
x-project-id |
No |
String |
Definition: The project ID. Constraints: Project ID corresponding to the region. Value range: N/A. Default value: N/A. |
|
x-user-profile |
No |
String |
Definition: IAM 5.0 user information. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
description |
Yes |
String |
Definition: Script description. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
content |
Yes |
String |
Definition: Script content. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
properties |
No |
ScriptPropertiesModel object |
Definition: Script attribute. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
script_params |
No |
Array of ScriptParamDefine objects |
Definition: Input parameters of the script. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
risk_level |
Yes |
String |
Definition: Risk level. Constraints: Value range: LOW, MEDIUM, or HIGH. Default value: N/A. |
|
version |
Yes |
String |
Definition: Script version. Constraints: Format: 1.0.0 Value range: N/A. Default value: N/A. |
|
reviewers |
No |
Array of ReviewerInfo objects |
Definition: Reviewer. If this parameter is not specified, review is not required. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
protocol |
No |
String |
Definition: Review message notification protocol, which is used to notify the reviewer. Constraints: EMAIL, DING_TALK, WE_LINK, WECHAT, CALLNOTIFY, and NOT_TO_NOTIFY. Value range: DEFAULT, SMS, EMAIL, DING_TALK, WE_LINK, WECHAT, CALLNOTIFY, or NOT_TO_NOTIFY. Default value: N/A. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
reviewer_name |
Yes |
String |
Definition: Reviewer name (IAM username). Constraints: IAM username. Value range: N/A. Default value: N/A. |
|
reviewer_id |
Yes |
String |
Definition: Reviewer ID (IAM user ID). Constraints: IAM user ID. Value range: N/A. Default value: N/A. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
param_name |
Yes |
String |
Definition: Parameter name. Constraints: The parameter name can contain only letters, digits, and underscores (_). Value range: N/A. Default value: N/A. |
|
param_value |
Yes |
String |
Definition: Parameter value. Constraints: The parameter value contains 1 to 4096 characters. The value can contain uppercase letters, lowercase letters, digits, and special characters (_-/.*?:",=+@#[{]}). Consecutive periods (.) are not allowed. Value range: N/A. Default value: N/A. |
|
param_description |
Yes |
String |
Definition: Parameter description. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
param_order |
Yes |
Integer |
Definition: Parameter sequence. This parameter has been discarded and does not take effect when it is configured. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
sensitive |
Yes |
Boolean |
Definition: Whether a parameter is sensitive. Constraints: The value can be true or false. Value range: The value can be true or false. Default value: N/A. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
data |
String |
Definition: UUID of the script to be modified. Value range: N/A. |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition: Error code. Value range: See the error code section. |
|
error_msg |
String |
Definition: Error description. Value range: See the error code section. |
Example Requests
Modify the example of the request body of the SHELL script.
PUT https://{Endpoint}/v1/job/scripts/SC2023110211155901a700000
{
"type" : "SHELL",
"content" : "echo ${a}",
"name" : "019101112",
"description" : "Modifying",
"properties" : {
"risk_level" : "HIGH",
"version" : "1.1.1",
"reviewers" : [ ]
},
"script_params" : [ {
"param_name" : "a",
"param_value" : "string",
"param_description" : "string",
"param_order" : 1,
"sensitive" : true
} ]
}
Example Responses
Status code: 200
The script UUID is returned.
For more status codes, see Status Codes.
{
"data" : "SC2023110211155901axxxxxx"
}
Status code: 400
The server failed to process the request.
For more status codes, see Status Codes.
{
"error_code" : "COC.00040701",
"error_msg" : "error_msg"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
The script UUID is returned. For more status codes, see Status Codes. |
|
400 |
The server failed to process the request. For more status codes, see Status Codes. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot