All Products
Search
Document Center

CloudOps Orchestration Service:ACS::Approve

Last Updated:Aug 22, 2026

Aksi ACS::Approve digunakan untuk menyetujui tugas.

Description

Dalam operasi dan pemeliharaan (O&M) otomatis, beberapa operasi—seperti menghapus resource penting atau membeli instance berbiaya tinggi—harus dilakukan dengan hati-hati. Jika dijalankan secara otomatis, operasi tersebut berisiko menyebabkan hilangnya kendali atas resource atau melebihi ambang batas anggaran. Namun, jika tidak diotomatiskan, Anda harus melakukannya secara manual atau melalui metode non-otomatis lainnya. Aksi ACS::Approve membantu menyeimbangkan antara eksekusi otomatis dan operasi yang memerlukan perhatian khusus.

Saat aksi ACS::Approve dijalankan dalam templat, mesin eksekusi CloudOps Orchestration Service (OOS) akan menangguhkan eksekusi langkah berikutnya, mengubah status eksekusi menjadi Waiting, lalu mengirim notifikasi kepada administrator. Setelah menerima notifikasi, administrator dapat menyetujui atau menolak operasi tersebut berdasarkan kebutuhan bisnis. Jika disetujui, mesin eksekusi OOS akan melanjutkan langkah berikutnya. Jika ditolak, mesin eksekusi OOS akan menghentikan eksekusi dan mengubah statusnya menjadi Canceled.

Webhook syntax

Anda dapat mengonfigurasi webhook untuk mengirim notifikasi ke klien, seperti DingTalk.

  • Format YAML

Tasks:
  - Name: approvalTask
    Action: ACS::Approve
    Properties:
      AppendExecutionLink: 'true' # Menentukan apakah akan menambahkan tautan eksekusi. Nilai yang valid: true dan false. Nilai default: true. 
      Approvers: ["user1", "user2", "user3"] # Nama pengguna Resource Access Management (RAM) yang bertindak sebagai pemberi persetujuan. 
      MinRequiredApprovals: 2 # Jumlah minimum pemberi persetujuan yang diperlukan untuk menyetujui tugas. 
      NotifyType: WebHook
      WebHook:
        URI: url # Wajib diisi. URL webhook. Contoh: https://oapi.dingtalk.com/robot/send?access_token=xxxxxx.
        Headers: # Opsional. Header permintaan HTTP. Contoh: Content-Type.
          Content-Type: 'application/json; charset=utf-8'
        Content: # Wajib diisi. Konten notifikasi webhook. Atur nilainya sesuai persyaratan webhook. Untuk informasi tentang konten webhook DingTalk, kunjungi https://open-doc.dingtalk.com/docs/doc.htm?treeId=257&articleId=105735&docType=1. 
          msgtype: text
          text:
            content: 'the approve notify to user' # Wajib diisi. Konten notifikasi persetujuan. 
          at: # Pengguna yang di-@ dalam grup DingTalk.
            atMobiles: # Opsional. Pengguna yang di-@ dalam grup DingTalk. Tentukan pengguna menggunakan nomor ponsel yang mereka gunakan untuk membuat akun DingTalk. 
                        - 138albb1234
                        - 130albb1234
            isAtAll: 'false' # Opsional. Menentukan apakah akan @ semua pengguna dalam grup DingTalk. Nilai yang valid: true dan false. Nilai default: false.
  • Format JSON (Untuk informasi lebih lanjut, lihat deskripsi atribut pada format YAML.)

{
  "Tasks": [
    {
      "Name": "approvalTask",
      "Action": "ACS::Approve",
      "Properties": {
        "AppendExecutionLink": "true",
        "Approvers": [
          "user1",
          "user2",
          "user3"
        ],
        "MinRequiredApprovals": 2,
        "NotifyType": "WebHook",
        "WebHook": {
          "URI": "url",
          "Headers": {
            "Content-Type": "application/json; charset=utf-8"
          },
          "Content": {
            "msgtype": "text",
            "text": {
              "content": "the approve notify to user"
            },
            "at": {
              "atMobiles": [
                "138albb1234",
                "130albb1234"
              ],
              "isAtAll": "false"
            }
          }
        }
      }
    }
  ]
}

Contoh webhook

Templat berikut digunakan untuk menghapus instance Elastic Compute Service (ECS) setelah mendapat persetujuan.

  • Format YAML

---
FormatVersion: OOS-2019-06-01
Description:
  en: Bulky restarts the ECS instances with Approval.
  name-en: BulkyRebootInstancesWithApproval
Parameters:
  targets:
    Type: Json
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
  rateControl:
    Description:
      en: Concurrency ratio of task execution.
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 100%
  webHookUrl:
    Description:
      en: >-
        The webHook url of dingtalk group assistant,
        e.g.https://oapi.dingtalk.com/robot/send?access_token=1234zxcvaksdq31414.
    Type: String
  atMobiles:
    Description:
      en: >-
        The telephone numbers of member in dingtalk group assistant @, when
        notify comes.
    Type: List
    Default:
      - '1390000****'
  atAll:
    Description:
      en: 'assistant @ all members in dingtalk group or not, when notify comes.'
    Type: String
    Default: 'false'
  OOSAssumeRole:
    Description:
      en: The RAM role to be assumed by OOS.
    Type: String
    Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: getInstance
    Description:
      en: Views the ECS instances.
    Action: 'ACS::SelectTargets'
    Properties:
      ResourceType: 'ALIYUN::ECS::Instance'
      Filters:
        - '{{ targets }}'
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: 'Instances.Instance[].InstanceId'
      instanceNames:
        Type: List
        ValueSelector: 'Instances.Instance[].InstanceName'
  - Name: approveRestart
    Action: 'ACS::Approve'
    Properties:
      NotifyType: WebHook
      WebHook:
        URI: '{{webhookUrl}}'
        Headers:
          Content-Type: application/json
        Content:
          msgtype: text
          text:
            content: >-
              Notify: please approve instances restart, instance names to
              approve  are {{getInstance.instanceNames}}, sent by
              {{ACS::RegionId}} oos {{ACS::ExecutionId}}.
          at:
            atMobiles: '{{atMobiles}}'
            isAtAll: '{{atAll}}'
  - Name: rebootInstance
    Action: 'ACS::ECS::RebootInstance'
    Description:
      en: Restarts the ECS instances.
    Properties:
      instanceId: '{{ ACS::TaskLoopItem }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ getInstance.instanceIds }}'
Outputs:
  instanceIds:
    Type: List
    Value: '{{ getInstance.instanceIds }}'
  • Format JSON

{
  "FormatVersion": "OOS-2019-06-01",
  "Description": {
    "en": "Bulky restarts the ECS instances with Approval.",
    "name-en": "BulkyRebootInstancesWithApproval"
  },
  "Parameters": {
    "targets": {
      "Type": "Json",
      "AssociationProperty": "Targets",
      "AssociationPropertyMetadata": {
        "ResourceType": "ALIYUN::ECS::Instance"
      }
    },
    "rateControl": {
      "Description": {
        "en": "Concurrency ratio of task execution."
      },
      "Type": "Json",
      "AssociationProperty": "RateControl",
      "Default": {
        "Mode": "Concurrency",
        "MaxErrors": 0,
        "Concurrency": "100%"
      }
    },
    "webHookUrl": {
      "Description": {
        "en": "The webHook url of dingtalk group assistant, e.g.https://oapi.dingtalk.com/robot/send?access_token=1234zxcvaksdq31414."
      },
      "Type": "String"
    },
    "atMobiles": {
      "Description": {
        "en": "The telephone numbers of member in dingtalk group assistant @, when notify comes."
      },
      "Type": "List",
      "Default": [
        "1390000****"
      ]
    },
    "atAll": {
      "Description": {
        "en": "assistant @ all members in dingtalk group or not, when notify comes."
      },
      "Type": "String",
      "Default": "false"
    },
    "OOSAssumeRole": {
      "Description": {
        "en": "The RAM role to be assumed by OOS."
      },
      "Type": "String",
      "Default": "OOSServiceRole"
    }
  },
  "RamRole": "{{ OOSAssumeRole }}",
  "Tasks": [
    {
      "Name": "getInstance",
      "Description": {
        "en": "Views the ECS instances."
      },
      "Action": "ACS::SelectTargets",
      "Properties": {
        "ResourceType": "ALIYUN::ECS::Instance",
        "Filters": [
          "{{ targets }}"
        ]
      },
      "Outputs": {
        "instanceIds": {
          "Type": "List",
          "ValueSelector": "Instances.Instance[].InstanceId"
        },
        "instanceNames": {
          "Type": "List",
          "ValueSelector": "Instances.Instance[].InstanceName"
        }
      }
    },
    {
      "Name": "approveRestart",
      "Action": "ACS::Approve",
      "Properties": {
        "NotifyType": "WebHook",
        "WebHook": {
          "URI": "{{webhookUrl}}",
          "Headers": {
            "Content-Type": "application/json"
          },
          "Content": {
            "msgtype": "text",
            "text": {
              "content": "Notify: please approve instances restart, instance names to approve  are {{getInstance.instanceNames}}, sent by {{ACS::RegionId}} oos {{ACS::ExecutionId}}."
            },
            "at": {
              "atMobiles": "{{atMobiles}}",
              "isAtAll": "{{atAll}}"
            }
          }
        }
      }
    },
    {
      "Name": "rebootInstance",
      "Action": "ACS::ECS::RebootInstance",
      "Description": {
        "en": "Restarts the ECS instances."
      },
      "Properties": {
        "instanceId": "{{ ACS::TaskLoopItem }}"
      },
      "Loop": {
        "RateControl": "{{ rateControl }}",
        "Items": "{{ getInstance.instanceIds }}"
      }
    }
  ],
  "Outputs": {
    "instanceIds": {
      "Type": "List",
      "Value": "{{ getInstance.instanceIds }}"
    }
  }
}

Mail syntax

  • Format YAML

Tasks:
  - Action: ACS::Approve
    Name: ApproveByMail
    Properties:
      NotifyType: Mail
      Mail:
      	Host: SMTPHostAddress # Alamat server Simple Mail Transfer Protocol (SMTP). Contoh: smtp.example1.com.
        Port: SMTPPort # Nomor port server SMTP. Contoh: 465.
        Username: sender  # Akun email yang digunakan untuk mengirim notifikasi. Contoh: usr001@example1.com.
        Password: senderPassword # Kode otorisasi layanan Internet Message Access Protocol (IMAP) atau SMTP, bukan password akun email.
        Subject: mailSubject # Subjek notifikasi email. Contoh: hello world.
        Body: mailBody # Isi notifikasi email. Contoh: hello world ! ! !. 
        From: senderAddress # Alamat email pengirim. Contoh: usr001@example1.com.
        To: # Alamat email penerima. Contoh: usr1234@example2.com,usr123@example2.com.
        	- usr123@example2.com
          - usr1234@example2.com
  • Format JSON (Untuk informasi lebih lanjut, lihat deskripsi atribut pada format YAML.)

{
  "Tasks": [
    {
      "Action": "ACS::Approve",
      "Name": "ApproveByMail",
      "Properties": {
        "NotifyType": "Mail",
        "Mail": {
          "Host": "SMTPHostAddress",
          "Port": "SMTPPort",
          "Username": "sender",
          "Password": "senderPassword",
          "Subject": "mailSubject",
          "Body": "mailBody",
          "From": "senderAddress",
          "To": [
            "usr123@example2.com,usr1234@example2.com"
          ]
        }
      }
    }
  ]
}