> For the complete documentation index, see llms.txt.
Skip to main content

Check out Port for yourself ➜ 

String

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

Common usage​

Use string properties to store free-form text from your development tools, such as:

  • Container image tags and package versions.
  • Git commit hashes.
  • Repository file paths.
  • Service descriptions.

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​

The examples below use version 2.29.0 of the Terraform and Pulumi providers. Configure your provider first, then run one example at a time in its own project. Each example creates a blueprint; use distinct identifiers when you combine examples.

resource "port_blueprint" "myBlueprint" {
identifier = "myBlueprint"
title = "My blueprint"
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, to see the available enum colors refer to the enum page.