Modifying a Script
Function
This API is used to modify a custom job script. Constraints: The script name must be unique under the same tenant. The script name can contain a maximum of 64 characters, including letters, digits, and underscores (_). The script content can contain a maximum of 4096 characters. A maximum of 20 script parameters are supported. Script Description: Enter a maximum of 256 characters. The name of a single parameter contains 64 characters, including only letters, digits, and underscores (_). The value of a single 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.
URI
PUT /v1/job/scripts/{script_uuid}
|
Parameter |
Mandatory or Not |
Type |
Description |
|---|---|---|---|
|
script_uuid |
Yes |
String |
Script UUID. Minimum length: 1 character Maximum length: 25 characters |
Request Parameters
|
Parameter |
Mandatory or Not |
Type |
Description |
|---|---|---|---|
|
description |
Yes |
String |
Script description Minimum length: 1 character Maximum length: 256 characters |
|
content |
Yes |
String |
Script content Minimum length: 1 character Maximum length: 4096 characters |
|
properties |
No |
ScriptPropertiesModel object |
Risk Level: The value can be LOW, HIGH, or MEDIUM. The reviewer can only modify the risk level. |
|
script_params |
No |
Array of ScriptParamDefine objects |
Input parameter Array length: 0 to 5 characters |
|
Parameter |
Mandatory or Not |
Type |
Description |
|---|---|---|---|
|
risk_level |
Yes |
String |
Risk level. LOW: low risk; MEDIUM: medium risk; HIGH: high risk The value can be:
|
|
version |
Yes |
String |
Script version number Minimum length: 1 character Maximum length: 10 characters |
|
reviewers |
No |
Array of ReviewerInfo objects |
Approver. If this parameter is not specified, review is not required. Array length: 0 to 5 characters |
|
protocol |
No |
String |
Review message notification protocol, which is used to notify reviewers. DEFAULT: default; SMS: SMS; EMAIL: email; DING_TALK: DingTalk; WE_LINK: WeLink; WECHAT: WeChat; CALLNOTIFY: language; NOT_TO_NOTIFY: no notification The value can be:
|
|
Parameter |
Mandatory or Not |
Type |
Description |
|---|---|---|---|
|
reviewer_name |
Yes |
String |
Reviewer name (IAM username) Minimum length: 1 character Maximum length: 64 characters |
|
reviewer_id |
Yes |
String |
Reviewer ID (IAM user ID) Minimum length: 0 character Maximum length: 32 characters |
|
Parameter |
Mandatory or Not |
Type |
Description |
|---|---|---|---|
|
param_name |
Yes |
String |
The parameter name can contain only letters, digits, and underscores (_). Minimum length: 1 character Maximum length: 64 characters |
|
param_value |
Yes |
String |
Default value. Minimum length: 0 character Maximum length: 1,024 characters |
|
param_description |
Yes |
String |
Description of the parameter. Minimum length: 0 character Maximum length: 256 characters |
|
param_order |
Yes |
Integer |
Parameter sequence. The value starts from 1 and must be consecutive. Minimum value: 1 Maximum value: 20 |
|
sensitive |
Yes |
Boolean |
Whether a parameter is sensitive. |
Response Parameters
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code Minimum length: 8 characters Maximum length: 36 characters |
|
error_msg |
String |
Error description Minimum length: 2 characters Maximum length: 512 characters |
Request Example
https://coc.myhuaweicloud.com/v1/job/scripts/SC2023110211155901a700000
{
"type" : "SHELL",
"content" : "echo ${a}",
"name" : "019101112",
"description": "modification",
"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
} ]
}
Response Example
Status code: 200
Script UUID.
{
"data" : "SC2023110211155901a787af4"
}
Status code: 400
{
"error_code" : "COC.00040701",
"error_msg" : "error_msg"
}
Status Code
|
Status Code |
Description |
|---|---|
|
200 |
Script UUID. |
|
400 |
Contains error information. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.