Skip to main content
Platform O&M/Automated O&M/Script Library
POSTScript LibrarySince 5.2.0SynchronousAuth Required

CreateGuestVmScript

CreateGuestVmScript

Execution Availability

Try It Out

Submit a mock request using the current auth context and example-driven inputs.

Request Inputs

Body Fields

  • paramsObjectRequired

    Request body parameter object.

    • nameStringRequired

      The resource name.

    • descriptionString

      Optional. Optional. The detailed description of the resource.

    • scriptContentStringRequired

      The script content.

    • renderParamsString

      Optional. The custom parameters.

    • platformStringRequired

      The platform.

    • scriptTypeStringRequired

      The script type.

    • scriptTimeoutint

      Optional. The timeout period.

    • resourceUuidString

      Optional. The resource UUID.

    • tagUuidsList

      Optional. The tag UUID list.

  • systemTagsList

    Optional. The system tags.

  • userTagsList

    Optional. The user tags.

Responses

200 OK

On success, this API returns the following response structure.

  • successbooleanRequired

    操作是否成功。

  • errorErrorCodeRequired

    The error code. If not null, the operation fails, or vice versa. For more information, see error

    • codeStringRequired

      The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001.

    • descriptionStringRequired

      The brief description of the error.

    • detailsStringRequired

      The details about the error.

    • elaborationStringRequired

      The reserved field. Default value: null.

    • opaqueLinkedHashMapRequired

      The reserved field. Default value: null.

    • causeErrorCodeRequired

      The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null.

  • inventoryGuestVmScriptInventoryRequired

    See inventory

    • uuidStringRequired

      The resource UUID.

    • nameStringRequired

      The resource name.

    • descriptionString

      Optional. The detailed description of the resource.

    • scriptContentStringRequired

      The script content.

    • renderParamsStringRequired

      The custom parameters.

    • platformStringRequired

      The platform

    • scriptTypeStringRequired

      The script type.

    • scriptTimeoutIntegerRequired

      The timeout period.

    • createDateTimestampRequired

      The creation time.

    • lastOpDateTimestampRequired

      The last operation time.

Endpoint

POST/zstack/v1/scripts

/zstack/v1/scripts

Operation ID

CreateGuestVmScript

Permalink

Request Example

curl -X POST 'http://{host}/zstack/v1/scripts' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"params":{"name":"<name>","description":"<description>","scriptContent":"<scriptContent>","renderParams":"<renderParams>","platform":"<platform>","scriptType":"<scriptType>","scriptTimeout":1,"resourceUuid":"<resourceUuid>","tagUuids":["<tagUuids>"]},"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'

Response Example

200
{ "inventory": { "uuid": "a90f02b86916371a87bb5f2716dbfc0c", "name": "script1", "description": "this is a script", "scriptContent": "echo helloworld", "renderParams": "[{\"key\":\"key\",\"value\":\"value\",\"description\":\"description\"}]", "platform": "Linux", "scriptType": "Shell", "scriptTimeout": 30, "createDate": "Sep 23, 2024 11:53:59 AM", "lastOpDate": "Sep 23, 2024 11:53:59 AM" } }

Change History

This API has no change history records yet.

View all change history