SaveWorkspaceCode
Saves workspace code. If the file does not exist, a new file is automatically created.
Operation description
发布工作空间的代码
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dms:SaveWorkspaceCode |
update |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| WorkspaceId |
string |
Yes |
The workspace ID (numeric ID). |
12345678 |
| Path |
string |
Yes |
The file path to save. |
{"repos":[{"repo":"git@xxxx.git", "branch":"master"}], "exclude":["/.dms", "/username"]} |
| Content |
string |
Yes |
The code content. |
Description: 'Example template, describe instances in some status'nFormatVersion: OOS-2019-06-01nTasks:n - Name: SleepTaskn Action: ACS::Sleepn Properties:n Duration: PT1Mn |
| Force |
boolean |
No |
Specifies whether to forcibly overwrite the file. If set to true, the file is overwritten regardless of whether it has been modified by others. |
True |
| Repo |
string |
No |
The repository information. Specify this parameter when creating a git repository directory during the save operation. |
computing/ecs |
| Mtime |
string |
No |
The file modification time. The GetWorkspaceCode operation returns this mtime value. When you call SaveWorkspaceCode, include this mtime value to check whether the file has been changed on the server. If the mtime values do not match, the save operation fails, which indicates that the server-side version has been modified. |
2026-01-01T10:11:12Z |
| Iac |
boolean |
No |
Specifies whether the file is an infrastructure as code template file. Set this parameter to true for YAML configuration files that are edited in the visual editor. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| Data |
string |
返回数据 |
1 |
| Message |
string |
错误信息,在接口失败时,返回具体错误信息,成功时则为空 |
Failed to publish,repo branch empty |
| RequestId |
string |
请求 ID |
67E910F2-4B62-5B0C-ACA3-7547695C**** |
| HttpStatusCode |
integer |
http 状态码 |
200 |
| ErrorCode |
string |
错误码 |
InvalidTid |
| Success |
boolean |
是否调用成功。
|
true |
Examples
Success response
JSON format
{
"Data": "1",
"Message": "Failed to publish,repo branch empty",
"RequestId": "67E910F2-4B62-5B0C-ACA3-7547695C****",
"HttpStatusCode": 200,
"ErrorCode": "InvalidTid",
"Success": true
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.