Datetime
Datetime is a data type used to reference a date and time.
💡 Common datetime usage​
The datetime property type can be used to store any date and time, for example:
- Deployment time
- Release time
- Last incident date
- Creation timestamp
In this live demo example, we can see the Last Update
datetime property. 🎬
API definition​
- Basic
- Array
{
"myDatetimeProp": {
"title": "My datetime",
"icon": "My icon",
"description": "My datetime property",
"type": "string",
"format": "date-time",
"default": "2022-04-18T11:44:15.345Z"
}
}
{
"myDatetimeArray": {
"title": "My datetime array",
"icon": "My icon",
"description": "My datetime array",
"type": "array",
"items": {
"type": "string",
"format": "date-time"
}
}
}
Check out Port's API reference to learn more.
Terraform definition​
- Basic
- Array
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
string_props = {
"myDatetimeProp" = {
title = "My datetime"
icon = "My icon"
description = "My datetime property"
format = "date-time"
default = "2022-04-18T11:44:15.345Z"
}
}
}
}
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
array_props = {
"myDatetimeArray" = {
title = "My datetime array"
icon = "My icon"
required = false
type = "array"
string_items = {
format = "date-time"
}
}
}
}
}
Pulumi definition​
- Basic
- Enum
- Array - coming soon
- Python
- TypeScript
- JavaScript
- GO
"""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={
"myDatetimeProp": BlueprintPropertiesStringPropsArgs(
title="My email",
format="date-time",
Required=True,
)
}
),
relations={},
)
import * as pulumi from "@pulumi/pulumi";
import * as port from "@port-labs/port";
export const blueprint = new port.Blueprint("myBlueprint", {
identifier: "myBlueprint",
title: "My Blueprint",
properties: {
string_props: {
myDatetimeProp: {
title: "My datetime",
format: "date-time",
required: true,
},
},
},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new port.Blueprint("myBlueprint", {
title: "My Blueprint",
identifier: "myBlueprint",
properties: {
string_props: {
myDatetimeProp: {
title: "My datetime",
format: "date-time",
required: true,
},
},
},
relations: {},
});
exports.title = entity.title;
package main
import (
"github.com/port-labs/pulumi-port/sdk/go/port"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
blueprint, err := port.NewBlueprint(ctx, "myBlueprint", &port.BlueprintArgs{
Identifier: pulumi.String("myBlueprint"),
Title: pulumi.String("My Blueprint"),
Properties: port.BlueprintPropertiesArgs{
StringProps: port.BlueprintPropertiesStringPropsMap{
"myDatetimeProp": &port.BlueprintPropertiesStringPropsArgs{
Title: pulumi.String("My datetime"),
Format: pulumi.String("date-time"),
Required: pulumi.Bool(false),
},
},
},
})
ctx.Export("blueprint", blueprint.Title)
if err != nil {
return err
}
return nil
})
}
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import pulumi
from port_pulumi import Blueprint,BlueprintPropertiesStringPropsArgs,BlueprintPropertiesArgs
blueprint = Blueprint(
"myBlueprint",
identifier="myBlueprint",
title="My Blueprint",
properties=BlueprintPropertiesArgs(
string_props={
"myDatetimeProp": BlueprintPropertiesStringPropsArgs(
title="My datetime",
required=True,
format="date-time",
enums=["2022-04-18T11:44:15.345Z", "2022-05-18T11:44:15.345Z"],
enum_colors={
"2022-04-18T11:44:15.345Z": "red",
"2022-05-18T11:44:15.345Z": "green"
},
)
}
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import * as port from "@port-labs/port";
export const blueprint = new port.Blueprint("myBlueprint", {
identifier: "myBlueprint",
title: "My Blueprint",
properties: {
stringProps: {
myDatetimeProp: {
title: "My datetime",
format: "date-time",
required: true,
enums: ["2022-04-18T11:44:15.345Z", "2022-05-18T11:44:15.345Z"],
enumColors: {
"2022-04-18T11:44:15.345Z": "red",
"2022-05-18T11:44:15.345Z": "green",
},
},
},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new port.Blueprint("myBlueprint", {
title: "My Blueprint",
identifier: "myBlueprint",
properties: {
stringProps: {
myDatetimeProp: {
title: "My datetime",
format: "date-time",
required: true,
enums: ["2022-04-18T11:44:15.345Z", "2022-05-18T11:44:15.345Z"],
enumColors: {
"2022-04-18T11:44:15.345Z": "red",
"2022-05-18T11:44:15.345Z": "green",
},
},
},
relations: {},
});
exports.title = entity.title;
package main
import (
"github.com/port-labs/pulumi-port/sdk/go/port"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
blueprint, err := port.NewBlueprint(ctx, "myBlueprint", &port.BlueprintArgs{
Identifier: pulumi.String("myBlueprint"),
Title: pulumi.String("My Blueprint"),
Properties: port.BlueprintPropertiesArgs{
StringProps: port.BlueprintPropertiesStringPropsMap{
"myDatetimeProp": &port.BlueprintPropertiesStringPropsArgs{
Title: pulumi.String("My datetime"),
Format: pulumi.String("date-time"),
Required: pulumi.Bool(false),
Enums: pulumi.StringArray{
pulumi.String("2022-04-18T11:44:15.345Z"),
pulumi.String("2022-05-18T11:44:15.345Z"),
},
EnumColors: pulumi.StringMap{
"2022-04-18T11:44:15.345Z": pulumi.String("red"),
"2022-05-18T11:44:15.345Z": pulumi.String("green"),
},
},
},
},
})
ctx.Export("blueprint", blueprint.Title)
if err != nil {
return err
}
return nil
})
}