All Products
Search
Document Center

Simple Application Server:DescribeCommandInvocations

Last Updated:Jun 10, 2026

Meng-query eksekusi dan status eksekusi dari perintah Cloud Assistant.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

swas-open:DescribeCommandInvocations

get

*All Resource

*

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

RegionId

string

Yes

ID region. Anda dapat memanggil operasi ListRegions untuk meng-query daftar region terbaru.

cn-hangzhou

InstanceId

string

No

ID dari simple application server.

ace0706b2ac4454d984295a94213****

CommandId

string

No

ID perintah. Anda dapat memanggil operasi DescribeCommands untuk meng-query semua ID perintah yang tersedia.

c-sh02yh0932w****

InvokeId

string

No

ID eksekusi dari perintah.

t-hz02p9545t6****

CommandName

string

No

Nama perintah. Jika baik CommandName maupun InstanceId ditentukan, CommandName tidak berlaku.

testName

InvocationStatus

string

No

Status eksekusi keseluruhan dari perintah. Nilai parameter ini bergantung pada status eksekusi perintah pada semua instance yang terlibat. Nilai yang valid:

  • Pending: Perintah sedang diverifikasi atau dikirim. Ketika status eksekusi pada setidaknya satu instance adalah Pending, status eksekusi keseluruhan adalah Pending.

  • Running: Perintah sedang dijalankan pada instance. Ketika status eksekusi pada setidaknya satu instance adalah Running, status eksekusi keseluruhan adalah Running.

  • Success: Ketika status eksekusi pada setidaknya satu instance adalah Success dan status eksekusi pada instance lain adalah Stopped atau Success, status eksekusi keseluruhan adalah Success.

    • Perintah yang diatur untuk dijalankan segera: Eksekusi perintah selesai, dan kode keluar adalah 0.

  • Failed: Ketika status eksekusi pada semua instance adalah Stopped atau Failed, status eksekusi keseluruhan adalah Failed. Ketika status eksekusi pada suatu instance adalah salah satu nilai berikut, Failed dikembalikan sebagai status eksekusi keseluruhan:

    • Invalid: Perintah tidak valid.

    • Aborted: Perintah gagal dikirim.

    • Failed: Eksekusi perintah selesai, dan kode keluar bukan 0.

    • Timeout: Eksekusi perintah habis waktu.

    • Error: Terjadi error saat perintah sedang dijalankan.

  • Stopping: Tugas perintah sedang dihentikan. Ketika status eksekusi pada setidaknya satu instance adalah Stopping, status eksekusi keseluruhan adalah Stopping.

  • Stopped: Tugas perintah dihentikan. Ketika status eksekusi pada semua instance adalah Stopped, status eksekusi keseluruhan adalah Stopped. Ketika status eksekusi pada suatu instance adalah salah satu nilai berikut, Stopped dikembalikan sebagai status eksekusi keseluruhan:

    • Cancelled: Tugas perintah dibatalkan.

    • Terminated: Tugas perintah dihentikan secara paksa.

  • PartialFailed: Eksekusi perintah berhasil pada beberapa instance dan gagal pada instance lain. Ketika status eksekusi pada beberapa instance adalah Success dan status eksekusi pada instance lain adalah Failed atau Stopped, status eksekusi keseluruhan adalah PartialFailed.

Catatan

Nilai parameter respons InvokeStatus mirip dengan nilai InvocationStatus. Kami merekomendasikan agar Anda mengabaikan InvokeStatus dan memeriksa nilai InvocationStatus.

Success

CommandType

string

No

Jenis perintah. Nilai yang valid:

  • RunBatScript: perintah batch, berlaku untuk instance Windows

  • RunPowerShellScript: perintah PowerShell, berlaku untuk instance Windows

  • RunShellScript: perintah shell, berlaku untuk instance Linux

RunPowerShellScript

PageNumber

string

No

Nomor halaman. Halaman dimulai dari 1. Nilai default: 1.

1

PageSize

string

No

Jumlah entri per halaman.

Nilai maksimum: 50.

Nilai default: 10.

10

Elemen respons

Element

Type

Description

Example

object

Skema Respons

RequestId

string

ID request.

30637AD6-D977-4833-A54C-CC89483E****

TotalCount

integer

Total jumlah entri.

10

PageNumber

integer

Nomor halaman.

1

PageSize

integer

Jumlah entri per halaman.

10

CommandInvocations

array<object>

Eksekusi perintah.

array<object>

InvokeId

string

ID eksekusi dari perintah.

t-hz0373jyzxt****

CreationTime

string

Waktu saat perintah dibuat.

2023-04-27T10:11:58

CommandId

string

ID perintah.

c-hy0338xh28r****

InvocationStatus

string

Status eksekusi keseluruhan dari perintah. Nilai yang valid:

  • Pending: Perintah sedang diverifikasi atau dikirim.

  • Invalid: Jenis perintah atau parameter yang ditentukan tidak valid.

  • Aborted: Perintah gagal dikirim ke instance. Untuk mengirim perintah ke instance, pastikan instance dalam keadaan Running dan perintah dikirim ke instance dalam waktu 1 menit.

  • Running: Perintah sedang dijalankan pada instance.

  • Success: Eksekusi perintah selesai, dan kode keluar adalah 0.

  • Failed: Eksekusi perintah selesai, dan kode keluar bukan 0.

  • Error: Eksekusi perintah tidak dapat dilanjutkan karena ada exception.

  • Timeout: Eksekusi perintah habis waktu.

  • Cancelled: Eksekusi perintah dibatalkan, dan perintah tidak dimulai.

  • Stopping: Perintah dalam keadaan Running sedang dihentikan.

  • Terminated: Perintah dihentikan secara paksa saat sedang dijalankan.

Success

CommandName

string

Nama perintah.

testCommandName

CommandType

string

Jenis perintah.

RunShellScript

CommandDescription

string

Deskripsi dari perintah.

testDescription

Username

string

Nama pengguna yang digunakan untuk menjalankan perintah.

root

WorkingDir

string

Direktori kerja dari perintah.

c:\wwwroot

Timeout

integer

Periode timeout. Satuan: detik.

60

CommandContent

string

Isi dari perintah.

echo 123

Parameters

string

Parameter kustom dalam perintah. Jika tidak ada parameter kustom dalam perintah, nilai defaultnya adalah {}.

{}

InvokeInstances

array<object>

Instance tempat perintah dijalankan.

object

InstanceId

string

The ID of the simple application server.

2445f4aecdac4b71ba2c7e3a7ccf****

StartTime

string

The beginning of the time range during which the command is run on the instance.

2023-05-09T03:32:24Z

FinishTime

string

The end of the time range during which the command is run on the instance.

2023-04-03T02:42:29Z

InvocationStatus

string

The execution state of the command on a single instance. Valid values:

  • Pending: The command is being verified or sent.

  • Invalid: The specified command type or parameter is invalid.

  • Aborted: The command failed to be sent to the instance. To send a command to an instance, make sure that the instance is in the Running state and the command is sent to the instance within 1 minute.

  • Running: The command is being run on the instance.

  • Success:

    • Command that is set to run only once: The command execution is complete, and the exit code is 0.

    • Command that is set to run on a schedule: The previous command execution is complete, the exit code is 0, and the specified cycle ends.

  • Failed:

    • Command that is set to run only once: The command execution is complete, and the exit code is not 0.

    • Command that is set to run on a schedule: The previous command execution is complete, the exit code is not 0, and the specified cycle is about to end.

  • Error: The command execution cannot proceed due to an exception.

  • Timeout: The command execution timed out.

  • Cancelled: The command execution is canceled, and the command is not started.

  • Stopping: The command task is being stopped.

  • Terminated: The command is terminated when it is being run.

Running

Output

string

The command output.

OutputMsg

ExitCode

integer

The exit code of the command.

  • For Linux instances, the exit code is the exit code of the shell command.

  • For Windows instances, the exit code is the exit code of the batch or PowerShell command.

0

ErrorInfo

string

The error message returned if the command failed to be sent or run. Valid values:

  • null: The command is run as expected.

  • the specified instance does not exists: The specified instance does not exist or is released.

  • the instance has released when create task: The instance is released when the command is being run.

  • the instance is not running when create task: The instance is not in the Running state when the command is being run.

  • the command is not applicable: The command is not applicable to the specified instance.

  • the specified account does not exists: The specified account does not exist.

  • the specified directory does not exists: The specified directory does not exist.

  • the cron job expression is invalid: The specified CRON expression for the execution schedule is invalid.

  • the aliyun service is not running on the instance: Cloud Assistant Agent is not running.

  • the aliyun service in the instance does not response: Cloud Assistant Agent does not respond to your request.

  • the aliyun service in the instance is upgrading now: Cloud Assistant Agent is being updated.

  • the aliyun service in the instance need upgrade: Cloud Assistant Agent needs to be updated.

  • the command delivery has been timeout: The request to send the command timed out.

  • the command execution has been timeout: The command execution timed out.

  • the command execution got an exception: An exception occurred when the command was being run.

  • the command execution has been interrupted: The command execution is interrupted.

  • the command execution exit code is not zero: The command execution is complete, and the exit code is not 0.

the specified instance does not exists

ErrorCode

string

The error code returned if the command failed to be sent or run.

  • null: The command is run as expected.

  • InstanceNotExists: The specified instance does not exist or is released.

  • InstanceReleased: The instance is released when the command is being run.

  • InstanceNotRunning: The instance is not in the Running state when the command is being run.

  • CommandNotApplicable: The command is not applicable to the specified instance.

  • AccountNotExists: The specified account does not exist.

  • DirectoryNotExists: The specified directory does not exist.

  • BadCronExpression: The specified CRON expression for the execution schedule is invalid.

  • ClientNotRunning: Cloud Assistant Agent is not running.

  • ClientNotResponse: Cloud Assistant Agent does not respond to your request.

  • ClientIsUpgrading: Cloud Assistant Agent is being updated.

  • ClientNeedUpgrade: Cloud Assistant Agent needs to be updated.

  • DeliveryTimeout: The request to send the command timed out.

  • ExecutionTimeout: The command execution timed out.

  • ExecutionException: An exception occurred when the command was being run.

  • ExecutionInterrupted: The command execution is interrupted.

  • ExitCodeNonzero: The command execution is complete, and the exit code is not 0.

InstanceNotExists

Contoh

Respons sukses

JSONformat

{
  "RequestId": "30637AD6-D977-4833-A54C-CC89483E****",
  "TotalCount": 10,
  "PageNumber": 1,
  "PageSize": 10,
  "CommandInvocations": [
    {
      "InvokeId": "t-hz0373jyzxt****",
      "CreationTime": "2023-04-27T10:11:58",
      "CommandId": "c-hy0338xh28r****",
      "InvocationStatus": "Success",
      "CommandName": "testCommandName",
      "CommandType": "RunShellScript",
      "CommandDescription": "testDescription",
      "Username": "root",
      "WorkingDir": "c:\\wwwroot",
      "Timeout": 60,
      "CommandContent": "echo 123",
      "Parameters": "{}",
      "InvokeInstances": [
        {
          "InstanceId": "2445f4aecdac4b71ba2c7e3a7ccf****",
          "StartTime": "2023-05-09T03:32:24Z",
          "FinishTime": "2023-04-03T02:42:29Z",
          "InvocationStatus": "Running",
          "Output": "OutputMsg",
          "ExitCode": 0,
          "ErrorInfo": "the specified instance does not exists",
          "ErrorCode": "InstanceNotExists"
        }
      ]
    }
  ]
}

Kode kesalahan

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.