全部產品
Search
文件中心

:ALIYUN::OOS::Execution

更新時間:Oct 25, 2024

ALIYUN::OOS::Execution類型用於啟動一個執行。

文法

{
  "Type": "ALIYUN::OOS::Execution",
  "Properties": {
    "ResourceOptions": Map,
    "Parameters": Map,
    "Tags": Map,
    "TemplateName": String,
    "ParentExecutionId": String,
    "SafetyCheck": String,
    "Mode": String,
    "TemplateVersion": String,
    "ResourceGroupId": String,
    "LoopMode": String,
    "Description": String,
    "TemplateContent": String,
    "TemplateURL": String
  }
}

屬性

屬性名稱

類型

必須

允許更新

描述

約束

ResourceOptions

Map

ROS使用的資源選項。

更多資訊,請參見ResourceOptions屬性

Parameters

Map

由參數集合組成的JSON字串。

樣本值:{"Status": "Running"}

預設值:{}。

Tags

Map

標籤,由索引值對組成。例如:{“k1”:”v1”, ”k2”:”v2”}。

最多支援20個標籤。

TemplateName

String

模板名稱。

最長為200個字元,不能以ALIYUN、ACS、ALIBABA開頭。可包含英文字母、數字、短劃線(-)和底線(_)。

ParentExecutionId

String

父執行ID。

SafetyCheck

String

安全檢查模式。

取值:

  • Skip:表示客戶瞭解風險,無需確認即可執行任何Action,無論什麼風險等級。當Mode取值為Automatic時有效。

  • ConfirmEveryHighRiskAction(預設值):要求客戶確認每一個高風險的Action。客戶通過調用NotifyExecution介面進行確認或取消。

Mode

String

執行模式。

取值:

  • Debug

  • Automatic(預設值)

TemplateVersion

String

版本號碼。

如果不填預設為最新的版本號碼。

ResourceGroupId

String

資源群組ID。

LoopMode

String

迴圈模式。

Description

String

要給執行添加的描述資訊。

TemplateContent

String

模板內容。

JSON 或 YAML 格式(同 CreateTemplate API 請求參數中的 Content 欄位)。使用者傳入此欄位可直接執行 TemplateContent 中的任務,而無需提前建立模板再建立執行任務(當使用者選擇已有的 Template 建立執行任務時不需傳入此欄位)。

TemplateURL

String

阿里雲Object Storage Service 中存放 OOS 模板內容的 URL(只支援公用讀取的 URL)。

使用者傳入此欄位可直接根據行 TemplateURL 中儲存的模板內容建立執行任務,無需提前建立模板再建立執行任務(當使用者選擇已有的 Template 建立執行任務時不需傳入此欄位)。

ResourceOptions文法

"ResourceOptions": {
  "SuccessStatuses": List,
  "Timeout": Number,
  "CancelOnDelete": Boolean,
  "FailureStatuses": List
}

ResourceOptions屬性

屬性名稱

類型

必須

允許更新

描述

約束

SuccessStatuses

List

ROS使用該屬性判斷資源是否建立成功。

取值:

  • Started

  • Queued

  • Running

  • Waiting

  • Success(預設值)

  • Failed

  • Cancelled

如果Execution的狀態在FailureStatuses中,則判定為失敗。如果Execution的狀態在SuccessStatuses中,則判定為成功。如果上述條件不符合,則一直等待,直到逾時(Timeout)。

Timeout

Number

逾時時間。

單位:秒。

預設值:1800。

CancelOnDelete

Boolean

刪除資源時,如果執行未完成是否取消執行。

取值:

  • true:取消執行。

  • false(預設值):不取消執行。

FailureStatuses

List

ROS使用該屬性判斷資源是否建立失敗。FailureStatuses優先順序高於SuccessStatuses。

取值:

  • Started

  • Queued

  • Running

  • Waiting

  • Success

  • Failed

  • Cancelled

預設值:["Failed", "Cancelled"]

傳回值

Fn::GetAtt

  • Status:執行狀態。

  • WindowsCurlCli:為Windows提供curl CLI命令首碼,可用於發出處理完成或失敗的訊號。更多資訊,請參見NotifyExecution

  • PowerShellCurlCli:為PowerShell提供curl CLI命令首碼,可用於發出訊號處理完成或失敗。

  • Outputs:執行輸出結果。

  • ExecutionId:執行的唯一標識。

  • CurlCli:curl命令。

  • StatusMessage:狀態資訊。

  • Counters:執行數。

樣本

YAML

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  TemplateName:
    Type: String
    Description: Template name. Content is limited to letters, numbers, underlined, underline, the length of 200 characters, and can not begin to ALIYUN, ACS, ALIBABA.
    Label: Template Name
    ConstraintDescription: '[2, 128] English or Chinese characters'
    MinLength: 2
    MaxLength: 128
    Default: mytest
Resources:
  Execution:
    Type: ALIYUN::OOS::Execution
    Properties:
      Parameters: {}
      TemplateName:
        Ref: TemplateName
      ResourceOptions:
        SuccessStatuses:
          - Running
          - Success
          - Queued
          - Waiting
        CancelOnDelete: true
Outputs:
  Status:
    Description: Execution status.
    Value:
      Fn::GetAtt:
        - Execution
        - Status
  WindowsCurlCli:
    Description: 'Convenience attribute, provides curl CLI command prefix for Windows, which can be used to notify oos execution instead of OOS API NotifyExecution. You can notify approve to oos execution by adding --data-binary "{\"data\": {\"NotifyType\": \"Approve\"}}" You can also notify execution via ROS API SignalResource. API parameters Status and UniqueId are ignored. Use API parameter Data to pass data.'
    Value:
      Fn::GetAtt:
        - Execution
        - WindowsCurlCli
  PowerShellCurlCli:
    Description: 'Convenience attribute, provides curl CLI command prefix for PowerShell, which can be used to notify oos execution instead of OOS API NotifyExecution. You can notify approve to oos execution by adding -Body ''{"data": {"NotifyType": "Approve"}}'' You can also notify execution via ROS API SignalResource. API parameters Status and UniqueId are ignored. Use API parameter Data to pass data.'
    Value:
      Fn::GetAtt:
        - Execution
        - PowerShellCurlCli
  Outputs:
    Description: Execution output.
    Value:
      Fn::GetAtt:
        - Execution
        - Outputs
  ExecutionId:
    Description: Execution ID.
    Value:
      Fn::GetAtt:
        - Execution
        - ExecutionId
  CurlCli:
    Description: 'Convenience attribute, provides curl CLI command prefix, which can be used to notify oos execution instead of OOS API NotifyExecution. You can notify approve to oos execution by adding --data-binary ''{"data": {"NotifyType": "Approve"}}''  You can also notify execution via ROS API SignalResource. API parameters Status and UniqueId are ignored. Use API parameter Data to pass data.'
    Value:
      Fn::GetAtt:
        - Execution
        - CurlCli
  StatusMessage:
    Description: Execution status information.
    Value:
      Fn::GetAtt:
        - Execution
        - StatusMessage
  Counters:
    Description: 'Task statistics: FailedTasks, SuccessTasks, TotalTasks.'
    Value:
      Fn::GetAtt:
        - Execution
        - Counters

JSON

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "TemplateName": {
      "Type": "String",
      "Description": "Template name. Content is limited to letters, numbers, underlined, underline, the length of 200 characters, and can not begin to ALIYUN, ACS, ALIBABA.",
      "Label": "Template Name",
      "ConstraintDescription": "[2, 128] English or Chinese characters",
      "MinLength": 2,
      "MaxLength": 128,
      "Default": "mytest"
    }
  },
  "Resources": {
    "Execution": {
      "Type": "ALIYUN::OOS::Execution",
      "Properties": {
        "Parameters": {
        },
        "TemplateName": {
          "Ref": "TemplateName"
        },
        "ResourceOptions": {
          "SuccessStatuses": [
            "Running",
            "Success",
            "Queued",
            "Waiting"
          ],
          "CancelOnDelete": true
        }
      }
    }
  },
  "Outputs": {
    "Status": {
      "Description": "Execution status.",
      "Value": {
        "Fn::GetAtt": [
          "Execution",
          "Status"
        ]
      }
    },
    "WindowsCurlCli": {
      "Description": "Convenience attribute, provides curl CLI command prefix for Windows, which can be used to notify oos execution instead of OOS API NotifyExecution. You can notify approve to oos execution by adding --data-binary \"{\\\"data\\\": {\\\"NotifyType\\\": \\\"Approve\\\"}}\" You can also notify execution via ROS API SignalResource. API parameters Status and UniqueId are ignored. Use API parameter Data to pass data.",
      "Value": {
        "Fn::GetAtt": [
          "Execution",
          "WindowsCurlCli"
        ]
      }
    },
    "PowerShellCurlCli": {
      "Description": "Convenience attribute, provides curl CLI command prefix for PowerShell, which can be used to notify oos execution instead of OOS API NotifyExecution. You can notify approve to oos execution by adding -Body '{\"data\": {\"NotifyType\": \"Approve\"}}' You can also notify execution via ROS API SignalResource. API parameters Status and UniqueId are ignored. Use API parameter Data to pass data.",
      "Value": {
        "Fn::GetAtt": [
          "Execution",
          "PowerShellCurlCli"
        ]
      }
    },
    "Outputs": {
      "Description": "Execution output.",
      "Value": {
        "Fn::GetAtt": [
          "Execution",
          "Outputs"
        ]
      }
    },
    "ExecutionId": {
      "Description": "Execution ID.",
      "Value": {
        "Fn::GetAtt": [
          "Execution",
          "ExecutionId"
        ]
      }
    },
    "CurlCli": {
      "Description": "Convenience attribute, provides curl CLI command prefix, which can be used to notify oos execution instead of OOS API NotifyExecution. You can notify approve to oos execution by adding --data-binary '{\"data\": {\"NotifyType\": \"Approve\"}}'  You can also notify execution via ROS API SignalResource. API parameters Status and UniqueId are ignored. Use API parameter Data to pass data.",
      "Value": {
        "Fn::GetAtt": [
          "Execution",
          "CurlCli"
        ]
      }
    },
    "StatusMessage": {
      "Description": "Execution status information.",
      "Value": {
        "Fn::GetAtt": [
          "Execution",
          "StatusMessage"
        ]
      }
    },
    "Counters": {
      "Description": "Task statistics: FailedTasks, SuccessTasks, TotalTasks.",
      "Value": {
        "Fn::GetAtt": [
          "Execution",
          "Counters"
        ]
      }
    }
  }
}