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

Check out Port for yourself ➜ 

Number

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

Common usage​

Use number properties to store measurements and counts ingested from your tools, such as:

  • Open vulnerability counts.
  • CPU and memory allocations.
  • Deployment replica counts.
  • Monthly cloud costs.

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​

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 = {
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
}
}