All Products
Search
Document Center

Resource Orchestration Service:How to control the length of a random string?

Last Updated:Mar 27, 2024

You can set AssociationProperty to AutoCompleteInput in Resource Orchestration Service (ROS) to automatically generate a random string.

You can set AssociationProperty in the RandomName parameter of the Parameters section of a template to AutoCompleteInput to generate a random string. Then, you can specify the Length, Prefix, and CharacterClasses properties in AssociationPropertyMetadata to control the length of the random string. For more information, see AssociationProperty and AssociationPropertyMetadata.

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "RandomName": {
      "Type": "String",
      "Label": {
        "en": "Random Name",
         
      },
      "AssociationProperty": "AutoCompleteInput",
      "AssociationPropertyMetadata": {
        "Length": 5 ,
        "Prefix": "test-ros",
        "CharacterClasses": [
          {
            "Class": "lowercase",
            "min": 1
          }
        ]
      }
    }
  },
  "Outputs": {
    "RandomNameStr": {
      "Value": {
        "Ref": "RandomName"
      }
    }
  }
}

Console UI

image