Skip to main content

Check out Port for yourselfย 

Number

Number is a basic input for numeric data.

๐Ÿ’ก Common number usageโ€‹

The number input type can be used to store any numeric data, for example:

  • Memory/storage allocations
  • Replica counts
  • Number of days to retain data

In the live demo self-service hub page, we can see the scaffold new service action whose K8s Replica Count input is a number input. ๐ŸŽฌ

API definitionโ€‹

{
"myNumberInput": {
"title": "My number input",
"icon": "My icon",
"description": "My number input",
"type": "number",
"default": 7
}
}

Check out Port's API reference to learn more.

Terraform definitionโ€‹

resource "port_action" "myAction" {
# ...action properties
user_properties = {
number_props = {
"myNumberInput" = {
title = "My number input"
description = "My number input"
default = 7
}
}
}
}

Validate numberโ€‹

Number validations support the following operators:

  • range

Ranges of numbers are specified using a combination of the minimum and maximum keywords, (or exclusiveMinimum and exclusiveMaximum for expressing exclusive range).

If x is the value being validated, the following must hold true:

  • x โ‰ฅ minimum
  • x > exclusiveMinimum
  • x โ‰ค maximum
  • x < exclusiveMaximum
{
"myNumberInput": {
"title": "My number input",
"icon": "My icon",
"description": "My number input",
"type": "number",
"minimum": 0,
"maximum": 50
}
}