Skip to main content

Check out Port for yourselfย 

Number

Number is a primitive data type used to save numeric data.

๐Ÿ’ก Common number usageโ€‹

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

  • Number of critical vulnerabilities;
  • Memory/storage allocations;
  • Replica counts;
  • Number of open issues;
  • etc.

In this live demo example, we can see the JIRA Issues number property. ๐ŸŽฌ

API definitionโ€‹

{
"myNumberProp": {
"title": "My number",
"icon": "My icon",
"description": "My number property",
"type": "number",
"default": 7
}
}

Check out Port's API reference to learn more.

Terraform definitionโ€‹

resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
number_props = {
"myNumberProp" = {
title = "My number"
description = "My number property"
default = 7
}
}
}
}

Pulumi definitionโ€‹

"""A Python Pulumi program"""

import pulumi
from port_pulumi import Blueprint,BlueprintPropertiesArgs,BlueprintPropertiesNumberPropsArgs

blueprint = Blueprint(
"myBlueprint",
identifier="myBlueprint",
title="My Blueprint",
properties=BlueprintPropertiesArgs(
number_props={
"myNumberProp": BlueprintPropertiesNumberPropsArgs(
title="My number", required=False,
)
},
),
relations={}
)

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
{
"myNumberProp": {
"title": "My number",
"icon": "My icon",
"description": "My number property",
"type": "number",
"minimum": 0,
"maximum": 50
}
}