URL
URL 是一种数据类型,被用于来保存网站链接。
💡 常用网址 Usage
例如,URL 属性类型可被用来存储指向任何网络资源的链接:
- 链接到 Datadog 仪表板
- 指向 Sentry 跟踪的链接
- 链接到拉取请求
应用程序接口定义
- Basic
- Enum
- Array
{
"myUrlProp": {
"title": "My url",
"icon": "My icon",
"description": "My url property",
"type": "string",
"format": "url",
"default": "https://example.com"
}
}
{
"myUrlEnum": {
"title": "My url enum",
"icon": "My icon",
"description": "My url enum",
"type": "string",
"format": "url",
"enum": ["https://example.com", "https://getport.io"],
"enumColors": {
"https://example.com": "red",
"https://getport.io": "green"
}
}
}
{
"myUrlArray": {
"title": "My url array",
"icon": "My icon",
"description": "My url array",
"type": "array",
"items": {
"type": "string",
"format": "url"
}
}
}
Check out Port's API reference to learn more.
Terraform 定义
- Basic
- Enum
- Array
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
string_props = {
"myUrlProp" = {
title = "My url"
required = false
format = "url"
}
}
}
}
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
string_props = {
"myUrlEnum" = {
title = "My url enum"
required = false
format = "url"
enum = ["https://example.com", "https://getport.io"]
enum_colors = {
"https://example.com" = "red",
"https://getport.io" = "green"
}
}
}
}
}
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
string_props = {
"myUrlArray" = {
title = "My url array"
required = false
string_items = {
format = "url"
}
}
}
}
}
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={
"myUrlProp": BlueprintPropertiesStringPropsArgs(
title="My url", required=False, format="url"
),
}
),
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: {
myUrlProp: {
title: "My url",
required: true,
format: "url",
},
},
},
});
"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: {
myUrlProp: {
title: "My url",
required: true,
format: "url",
},
},
},
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{
"myUrlProp": &port.BlueprintPropertyArgs{
Title: pulumi.String("My url"),
Required: pulumi.Bool(true),
Format: pulumi.String("url"),
},
},
},
})
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
blueprint = Blueprint(
"myBlueprint",
identifier="myBlueprint",
title="My Blueprint",
properties=BlueprintPropertiesArgs(
string_props={
"myUrlProp":BlueprintPropertiesStringPropsArgs(
title="My url",
required=True,
format="url",
enum=["https://example.com", "https://getport.io"],
enum_colors={
"https://example.com": "red",
"https://getport.io": "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: {
myUrlProp: {
title: "My url",
required: true,
format: "url",
enums: ["https://example.com", "https://getport.io"],
enumColors: {
"https://example.com": "red",
"https://getport.io": "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: {
myUrlProp: {
title: "My url",
required: true,
format: "url",
enums: ["https://example.com", "https://getport.io"],
enumColors: {
"https://example.com": "red",
"https://getport.io": "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{
"myUrlProp": port.BlueprintPropertiesStringPropsArgs{
Title: pulumi.String("My url"),
Required: pulumi.Bool(false),
Format: pulumi.String("url"),
Enums: pulumi.StringArray{
pulumi.String("https://example.com"),
pulumi.String("https://getport.io"),
},
EnumColors: pulumi.StringMap{
"https://example.com": pulumi.String("red"),
"https://getport.io": pulumi.String("green"),
},
},
},
},
})
ctx.Export("blueprint", blueprint.Title)
if err != nil {
return err
}
return nil
})
}