电子邮件
电子邮件是一种用于保存电子邮件地址的数据类型。
💡 常用电子邮件 Usage
电子邮件属性类型可被用于来存储任何合法的电子邮件地址。
应用程序接口定义
- Basic
- Enum
- Array
{
"myEmailProp": {
"title": "My email",
"icon": "My icon",
"description": "My email property",
"type": "string",
"format": "email",
"default": "[email protected]"
}
}
{
"myEmailEnum": {
"title": "My email enum",
"icon": "My icon",
"description": "My email enum",
"type": "string",
"format": "email",
"enum": ["[email protected]", "[email protected]"],
"enumColors": {
"[email protected]": "red",
"[email protected]": "green"
}
}
}
{
"myEmailArray": {
"title": "My email array",
"icon": "My icon",
"description": "My email array",
"type": "array",
"items": {
"type": "string",
"format": "email"
}
}
}
Check out Port's API reference to learn more.
Terraform 定义
- Basic
- Enum
- Array
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
string_props = {
"myEmailProp" = {
title = "My email"
icon = "My icon"
description = "My email property"
format = "email"
}
}
}
}
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
identifier = "myEmailProp"
title = "My email"
required = false
type = "string"
format = "email"
enum = ["[email protected]", "[email protected]"]
enum_colors = {
"[email protected]" = "red",
"[email protected]" = "green"
}
}
}
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
array_props = {
myEmailArray = {
title = "My email array"
identifier = "myEmailArray"
type = "array"
string_items = {
format = "email"
}
}
}
}
}
Pulumi 的定义
- 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={
"myEmailProp": BlueprintPropertiesStringPropsArgs(
title="My email",
format="email",
)
}
),
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: {
myEmailProp: {
title: "My email",
format: "email",
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: {
myEmailProp: {
title: "My email",
format: "email",
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{
"myEmailProp": &port.BlueprintPropertiesStringPropsArgs{
Title: pulumi.String("My email"),
Format: pulumi.String("email"),
Required: pulumi.Bool(true),
},
},
},
})
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,BlueprintPropertiesArgs,BlueprintPropertiesStringPropsArgs
blueprint = Blueprint(
"myBlueprint",
identifier="myBlueprint",
title="My Blueprint",
properties=BlueprintPropertiesArgs(
string_props={
"myEmailProp": BlueprintPropertiesStringPropsArgs(
title="My email",
required=True,
format="email",
enums=["[email protected]", "[email protected]"],
enum_colors={
"[email protected]": "red",
"[email protected]": "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: {
myEmailProp: {
title: "My email",
required: true,
format: "email",
enums: ["[email protected]", "[email protected]"],
enumColors: {
"[email protected]": "red",
"[email protected]": "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: {
myEmailProp: {
title: "My email",
required: true,
format: "email",
enums: ["[email protected]", "[email protected]"],
enumColors: {
"[email protected]": "red",
"[email protected]": "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{
"myEmailProp": &port.BlueprintPropertiesStringPropsArgs{
Title: pulumi.String("My email"),
Required: pulumi.Bool(false),
Format: pulumi.String("email"),
Enums: pulumi.StringArray{
pulumi.String("[email protected]"),
pulumi.String("[email protected]"),
},
EnumColors: pulumi.StringMap{
"[email protected]": pulumi.String("red"),
"[email protected]": pulumi.String("green"),
},
Format: pulumi.String("email"),
},
},
},
})
ctx.Export("blueprint", blueprint.Title)
if err != nil {
return err
}
return nil
})
}