ALIYUN::OOS::Execution

Updated at:

ALIYUN::OOS::Execution starts an execution.

Syntax

{
  "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
  }
}

Properties

Property

Type

Required

Editable

Description

Constraints

ResourceOptions

Map

No

No

For more information, see ResourceOptions properties.

For more information, see the ResourceOptions properties.

Parameters

Map

No

No

Example: {"Status": "Running"}

Default:{}。

Example: {"Status": "Running"}.
Default value: {}.

Tags

Map

No

No

A maximum of 20 tags is supported.

A maximum of 20 tags are supported.

TemplateName

String

No

No

The template name.

The name can be up to 200 characters in length and cannot start with ALIYUN, ACS, or ALIBABA. It can contain letters, digits, hyphens (-), and underscores (_).

ParentExecutionId

String

No

No

The parent execution ID.

None

SafetyCheck

String

No

No

The safety check mode.

Valid values:

  • Skip: Skips the safety check. You understand the risks and can run any action without confirmation, regardless of the risk level. This value takes effect only when Mode is set to Automatic.

  • ConfirmEveryHighRiskAction (default): You must confirm each high-risk action. Call the NotifyExecution operation to confirm or cancel the action.

Mode

String

No

No

The execution mode.

Valid values:

  • Debug

  • Automatic (default)

TemplateVersion

String

No

No

The version number.

If you leave this property blank, the latest version number is used.

ResourceGroupId

String

No

No

The resource group ID.

None

LoopMode

String

No

No

The loop mode.

None

Description

String

No

No

The description to add to the execution.

None

TemplateContent

String

No

No

The template content.

The content must be in JSON or YAML format. The content is the same as the Content field in the request parameters of the CreateTemplate operation. If you specify this property, the tasks in TemplateContent run directly and you do not need to create a template first. If you create the execution from an existing template, leave this property empty.

TemplateURL

String

No

No

The URL of the OOS template content that is stored in Alibaba Cloud Object Storage Service (OSS). Only URLs with public read permissions are supported.

If you specify this property, the execution runs the template content that is stored at TemplateURL and you do not need to create a template first. If you create the execution from an existing template, leave this property empty.

ResourceOptions syntax

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

ResourceOptions properties

Property

Type

Required

Editable

Description

Constraints

SuccessStatuses

List

No

No

ROS uses this property to determine whether the resource is created successfully.

Valid values:

  • Started

  • Queued

  • Running

  • Waiting

  • Success (default)

  • Failed

  • Cancelled

If the Execution status is in FailureStatuses, it is considered a failure. If the Execution status is in SuccessStatuses, it is considered a success. If none of the above conditions are met, continue waiting until timeout (Timeout).

Timeout

Number

No

No

The timeout period.

Unit: seconds. value: 1800.

CancelOnDelete

Boolean

No

No

Specifies whether to cancel the execution if the execution is not complete when the resource is deleted.

Valid values:

  • true: Cancels the execution.

  • false (default): Does not cancel the execution.

FailureStatuses

List

No

No

ROS uses this property to determine whether the resource fails to be created. FailureStatuses has a higher priority than SuccessStatuses.

Valid values:

  • Started

  • Queued

  • Running

  • Waiting

  • Success

  • Failed

  • Cancelled

    Default value: ["Failed", "Cancelled"].

Return values

Fn::GetAtt

  • Status: The status of the execution.

  • WindowsCurlCli: The curl command-line interface (CLI) command prefix for Windows. Use it to signal that the processing is complete or has failed. For more information, see NotifyExecution.

  • PowerShellCurlCli: The curl CLI command prefix for PowerShell. Use it to signal that the processing is complete or has failed.

  • Outputs: The output of the execution.

  • ExecutionId: The unique identifier of the execution.

  • CurlCli: The curl CLI command prefix. Use it to signal that the processing is complete or has failed.

  • StatusMessage: The status message.

  • Counters: Execution count.

Examples

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"
        ]
      }
    }
  }
}