All Products
Search
Document Center

CloudOps Orchestration Service:Template coding standard

Last Updated:Aug 28, 2019

Operation Orchestration Service (OOS) adopts the O&M concept of Operations as Code (Ops as Code). A template is the concrete form of code in OOS. Similar to code, templates need to comply with relevant standards. This topic describes the coding standards of templates for your reference. The standards also apply to all public templates provided by Alibaba Cloud.

Purpose

  • Make it easy to read a template and understand the usage of the template.
  • Facilitate subsequent template maintenance.
  • Establish unified coding standards for O&M templates and share the standards within the organization.

Coding standards

  1. Define the objectives and O&M operations of all templates.
  2. For action names, capitalize the prefixes and use the camel case for the last section. For example, ACS::ExecuteAPI or ACS::ECS::RunInstances.
  3. Use a unified indentation style. We recommend that you use two space characters as the basic unit of indentation. A mix of tabs and space characters is not allowed.
  4. Ensure that the sequence of attributes conforms to common reading habits. You can refer to the sequence of attributes in the syntax of actions.
  5. Recommended field sequence for templates: FormatVersion, Description, Parameters, RamRole, Tasks, and Outputs.
  6. Recommended field sequence for tasks: Name, Action, Description, Properties, Loop, and Outputs.
  7. Recommended attribute sequence for the ACS::ExecuteAPI action: Service, API, and Parameters.
  8. We recommend that you capitalize the service names, such as ECS and RDS, in the ACS::ExecuteAPI action.
  9. Ensure that the jQuery selectors, such as PropertySelector and ValueSelector, do not start with a period (.). The system supports both the format that starts with a period (.) and that starts without a period (.). However, the format that starts without a period (.) looks more elegant.
  10. We recommend that you use the camel case for the names of parameters, tasks, and output parameters, such as InstanceId and CreateInstance.