tencent cloud

文档反馈

ModifyCommand

最后更新时间:2023-03-14 16:55:45

1. API Description

Domain name for API request: tat.tencentcloudapi.com.

This API is used to modify a command.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: ModifyCommand.
Version Yes String Common Params. The value used for this API: 2020-10-28.
Region No String Common Params. This parameter is not required for this API.
CommandId Yes String Command ID.
CommandName No String Command name. The name can be up to 60 bytes, and contain [a-z], [A-Z], [0-9] and [_-.].
Description No String Command description. The maximum length is 120 characters.
Content No String Base64-encoded command. The maximum length is 64 KB.
CommandType No String Command type. SHELL and POWERSHELL are supported.
WorkingDirectory No String Command execution path.
Timeout No Integer Command timeout period. Value range: [1, 86400].
DefaultParameters No String The default value of the custom parameter value when it is enabled. The field type is JSON encoded string. For example, {"varA": "222"}.
All parameters are overwritten. All default values are required for modification.
Modification is only allowed when EnableParameter is true.
key is the name of the custom parameter and value is the default value. Both key and value are strings.
Up to 20 custom parameters are supported.
The name of the custom parameter cannot exceed 64 characters and can contain [a-z], [A-Z], [0-9] and [-_].
Username No String The username used to execute the command on the CVM or Lighthouse instance.
The principle of least privilege is the best practice for permission management. We recommend you execute TAT commands as a general user.
OutputCOSBucketUrl No String The COS bucket URL for uploading logs. The URL must start with https, such as https://BucketName-123454321.cos.ap-beijing.myqcloud.com.
OutputCOSKeyPrefix No String The COS bucket directory where the logs are saved. Check below for the rules of the directory name.
1. It must be a combination of number, letters, and visible characters. Up to 60 characters are allowed.
2. Use a slash (/) to create a subdirectory.
3. ".." can not be used as the folder name. It cannot start with a slash (/), and cannot contain consecutive slashes.

3. Output Parameters

Parameter Name Type Description
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Modifying a command

Input Example

POST / HTTP/1.1
Host: tat.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyCommand
<Common request parameters>

{
    "CommandName": "second-command",
    "Description": "hello world!",
    "Content": "cHM=",
    "CommandType": "SHELL",
    "WorkingDirectory": "/",
    "Timeout": 600,
    "CommandId": "cmd-63usjhmq"
}

Output Example

{
    "Response": {
        "RequestId": "9bea970a-0bab-495f-b0dd-de5eedfdf611"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError Internal error.
InvalidParameter Invalid parameter.
InvalidParameterValue Invalid parameter value.
InvalidParameterValue.CommandContentInvalid Invalid command content.
InvalidParameterValue.CommandNameDuplicated Duplicate command name.
InvalidParameterValue.InvalidCommandId Invalid CommandId.
InvalidParameterValue.InvalidCommandName Invalid command name.
InvalidParameterValue.InvalidOutputCOSBucketUrl Invalid OutputCOSBucketUrl.
InvalidParameterValue.InvalidOutputCOSKeyPrefix Invalid OutputCOSKeyPrefix.
InvalidParameterValue.ParameterInvalidJsonFormat The parameter is not a valid JSON string.
InvalidParameterValue.ParameterKeyContainsInvalidChar The parameter key contains invalid characters.
InvalidParameterValue.ParameterKeyDuplicated Duplicate parameter keys.
InvalidParameterValue.ParameterKeyLenExceeded The parameter key is too long.
InvalidParameterValue.ParameterNumberExceeded Too many parameters.
InvalidParameterValue.ParameterValueNotString The parameter value is not a string.
InvalidParameterValue.Range The parameter value is not in the valid range.
InvalidParameterValue.SupportParametersOnlyIfEnableParameter The custom parameter feature is not enabled.
InvalidParameterValue.TooLong Length limit exceeded.
ResourceNotFound.CommandNotFound The command does not exist.
UnauthorizedOperation.CamAuthFailed CAM authentication failed.
UnauthorizedOperation.InvalidToken Invalid token.
UnauthorizedOperation.MFAExpired The Multi-factor authentication (MFA) code expired.
UnauthorizedOperation.MFANotFound Multi-factor authentication (MFA) does not exist.
联系我们

联系我们,为您的业务提供专属服务。

技术支持

如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

7x24 电话支持