Skip to main content

Check out Port for yourselfย 

String

String is a primitive data type used to save text data.

๐Ÿ’ก Common string usageโ€‹

The string property type can be used to store any text based data, for example:

  • Image tags
  • Variable keys
  • Commit SHA
  • File names

In this live demo example, we can see the Language string property. ๐ŸŽฌ

API definitionโ€‹

{
"myStringProp": {
"title": "My string",
"icon": "My icon",
"description": "My string property",
"type": "string",
"default": "My default"
}
}

Check out Port's API reference to learn more.

Terraform definitionโ€‹

resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
string_props = {
"myStringProp" = {
title = "My string"
required = false
}
}
}
}

Pulumi definitionโ€‹

"""A Python Pulumi program"""

import pulumi
from port_pulumi import Blueprint,BlueprintPropertiesArgs,BlueprintPropertiesStringPropsArgs

blueprint = Blueprint(
"myBlueprint",
identifier="myBlueprint",
title="My Blueprint",
properties=BlueprintPropertiesArgs(
string_props={
"myStringProp": BlueprintPropertiesStringPropsArgs(
title="My string", required=False
)
),
relations={}
)

Validate stringโ€‹

String validations support the following operators:

  • minLength - enforce minimal string length.
  • maxLength - enforce maximal string length.
  • pattern - enforce Regex patterns.
{
"myStringProp": {
"title": "My string",
"icon": "My icon",
"description": "My string property",
"type": "string",
"minLength": 1,
"maxLength": 32,
"pattern": "^[a-zA-Z0-9-]*-service$"
}
}

Available enum colorsโ€‹

Properties defined using enum can also include specific colors for the different values available in the property definition, the available enum colors are:

blue
turquoise
orange
purple
pink
yellow
green
red
darkGray
lightGray
bronze