All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::OOS::Execution

Last Updated:Sep 23, 2024

ALIYUN::OOS::Execution is used to start 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

Constraint

ResourceOptions

Map

No

No

The resource options that are used by Resource Orchestration Service (ROS).

For more information, see ResourceOptions properties.

Parameters

Map

No

No

The JSON strings that consist of parameters.

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

Default value: {}.

Tags

Map

No

No

The tags. A tag is a key-value pair. Example: {"k1":"v1", "k2":"v2"}.

You can add up to 20 tags.

TemplateName

String

No

No

The template name.

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

ParentExecutionId

String

No

No

The ID of the parent execution.

None.

SafetyCheck

String

No

No

The safety check mode.

Valid values:

  • Skip: skips manual confirmation for all actions, regardless of the risk levels. This value is valid when Mode is set to Automatic.

  • ConfirmEveryHighRiskAction (default): requires manual confirmation for every high-risk action. You can call the NotifyExecution operation to confirm or cancel an 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 empty, the system uses the latest version.

ResourceGroupId

String

No

No

The ID of the resource group.

None.

LoopMode

String

No

No

The loop mode.

None.

Description

String

No

No

The description of the execution.

None.

TemplateContent

String

No

No

The template content.

The template content is in the JSON or YAML format. This property has the same effect as the Content parameter in the CreateTemplate operation. You can specify this property to directly execute tasks that are defined in the template content. This way, you do not need to separately create a template and tasks. If you use TemplateName to specify an existing template to create tasks, you can leave TemplateContent empty.

TemplateURL

String

No

No

The URL of the Object Storage Service (OSS) resource where the CloudOps Orchestration Service (OOS) template content is stored. Only public-read URLs are supported.

You can specify this property to directly create tasks that are defined in the template content. This way, you do not need to separately create a template and tasks. If you use TemplateName to specify an existing template to create tasks, you can leave TemplateURL empty.

ResourceOptions syntax

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

ResourceOptions properties

Property

Type

Required

Editable

Description

Constraint

SuccessStatuses

List

No

No

The states that specify whether resources are created.

Valid values:

  • Started

  • Queued

  • Running

  • Waiting

  • Success (default)

  • Failed

  • Cancelled

If the state of the execution is included in the value of the FailureStatuses property, resources failed to be created. If the state of the execution is included in the value of the SuccessStatuses property, resources are created. If neither of the preceding conditions is met, the system waits until the request times out.

Timeout

Number

No

No

The timeout period.

Unit: seconds.

Default value: 1800.

CancelOnDelete

Boolean

No

No

Specifies whether to cancel the execution that is not completed when the resource is being deleted.

Valid values:

  • true

  • false (default)

FailureStatuses

List

No

No

The states that specify whether resources failed to be created. The FailureStatuses property takes precedence over the SuccessStatuses property.

Valid values:

  • Started

  • Queued

  • Running

  • Waiting

  • Success

  • Failed

  • Cancelled

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

Return values

Fn::GetAtt

  • Status: the state of the execution.

  • WindowsCurlCli: The cURL CLI command prefix that is provided for Windows. WindowsCurlCli can be used to send a signal that indicates whether the execution is completed or failed. For more information, see NotifyExecution.

  • PowerShellCurlCli: The cURL CLI command prefix that is provided for PowerShell. PowerShellCurlCli can be used to send a signal that indicates whether the execution is completed or failed.

  • Outputs: the outputs of the execution.

  • ExecutionId: the unique ID of the execution.

  • CurlCli: the cURL command.

  • StatusMessage: the status information.

  • Counters: the number of executions.

Examples

YAML format

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 format

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