Tunnel

class Tunnel : KotlinCustomResource

Provides an OTS tunnel resource. For information about OTS tunnel and how to use it, see Tunnel overview.

NOTE: Available since v1.172.0.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const config = new pulumi.Config();
const name = config.get("name") || "tf-example";
const _default = new random.index.Integer("default", {
min: 10000,
max: 99999,
});
const defaultInstance = new alicloud.ots.Instance("default", {
name: `${name}-${_default.result}`,
description: name,
accessedBy: "Any",
tags: {
Created: "TF",
For: "example",
},
});
const defaultTable = new alicloud.ots.Table("default", {
instanceName: defaultInstance.name,
tableName: "tf_example",
timeToLive: -1,
maxVersion: 1,
enableSse: true,
sseKeyType: "SSE_KMS_SERVICE",
primaryKeys: [
{
name: "pk1",
type: "Integer",
},
{
name: "pk2",
type: "String",
},
{
name: "pk3",
type: "Binary",
},
],
});
const defaultTunnel = new alicloud.ots.Tunnel("default", {
instanceName: defaultInstance.name,
tableName: defaultTable.tableName,
tunnelName: "tf_example",
tunnelType: "BaseAndStream",
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-example"
default = random.index.Integer("default",
min=10000,
max=99999)
default_instance = alicloud.ots.Instance("default",
name=f"{name}-{default['result']}",
description=name,
accessed_by="Any",
tags={
"Created": "TF",
"For": "example",
})
default_table = alicloud.ots.Table("default",
instance_name=default_instance.name,
table_name="tf_example",
time_to_live=-1,
max_version=1,
enable_sse=True,
sse_key_type="SSE_KMS_SERVICE",
primary_keys=[
{
"name": "pk1",
"type": "Integer",
},
{
"name": "pk2",
"type": "String",
},
{
"name": "pk3",
"type": "Binary",
},
])
default_tunnel = alicloud.ots.Tunnel("default",
instance_name=default_instance.name,
table_name=default_table.table_name,
tunnel_name="tf_example",
tunnel_type="BaseAndStream")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tf-example";
var @default = new Random.Index.Integer("default", new()
{
Min = 10000,
Max = 99999,
});
var defaultInstance = new AliCloud.Ots.Instance("default", new()
{
Name = $"{name}-{@default.Result}",
Description = name,
AccessedBy = "Any",
Tags =
{
{ "Created", "TF" },
{ "For", "example" },
},
});
var defaultTable = new AliCloud.Ots.Table("default", new()
{
InstanceName = defaultInstance.Name,
TableName = "tf_example",
TimeToLive = -1,
MaxVersion = 1,
EnableSse = true,
SseKeyType = "SSE_KMS_SERVICE",
PrimaryKeys = new[]
{
new AliCloud.Ots.Inputs.TablePrimaryKeyArgs
{
Name = "pk1",
Type = "Integer",
},
new AliCloud.Ots.Inputs.TablePrimaryKeyArgs
{
Name = "pk2",
Type = "String",
},
new AliCloud.Ots.Inputs.TablePrimaryKeyArgs
{
Name = "pk3",
Type = "Binary",
},
},
});
var defaultTunnel = new AliCloud.Ots.Tunnel("default", new()
{
InstanceName = defaultInstance.Name,
TableName = defaultTable.TableName,
TunnelName = "tf_example",
TunnelType = "BaseAndStream",
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ots"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "tf-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Min: 10000,
Max: 99999,
})
if err != nil {
return err
}
defaultInstance, err := ots.NewInstance(ctx, "default", &ots.InstanceArgs{
Name: pulumi.Sprintf("%v-%v", name, _default.Result),
Description: pulumi.String(name),
AccessedBy: pulumi.String("Any"),
Tags: pulumi.StringMap{
"Created": pulumi.String("TF"),
"For": pulumi.String("example"),
},
})
if err != nil {
return err
}
defaultTable, err := ots.NewTable(ctx, "default", &ots.TableArgs{
InstanceName: defaultInstance.Name,
TableName: pulumi.String("tf_example"),
TimeToLive: pulumi.Int(-1),
MaxVersion: pulumi.Int(1),
EnableSse: pulumi.Bool(true),
SseKeyType: pulumi.String("SSE_KMS_SERVICE"),
PrimaryKeys: ots.TablePrimaryKeyArray{
&ots.TablePrimaryKeyArgs{
Name: pulumi.String("pk1"),
Type: pulumi.String("Integer"),
},
&ots.TablePrimaryKeyArgs{
Name: pulumi.String("pk2"),
Type: pulumi.String("String"),
},
&ots.TablePrimaryKeyArgs{
Name: pulumi.String("pk3"),
Type: pulumi.String("Binary"),
},
},
})
if err != nil {
return err
}
_, err = ots.NewTunnel(ctx, "default", &ots.TunnelArgs{
InstanceName: defaultInstance.Name,
TableName: defaultTable.TableName,
TunnelName: pulumi.String("tf_example"),
TunnelType: pulumi.String("BaseAndStream"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.integer;
import com.pulumi.random.IntegerArgs;
import com.pulumi.alicloud.ots.Instance;
import com.pulumi.alicloud.ots.InstanceArgs;
import com.pulumi.alicloud.ots.Table;
import com.pulumi.alicloud.ots.TableArgs;
import com.pulumi.alicloud.ots.inputs.TablePrimaryKeyArgs;
import com.pulumi.alicloud.ots.Tunnel;
import com.pulumi.alicloud.ots.TunnelArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var name = config.get("name").orElse("tf-example");
var default_ = new Integer("default", IntegerArgs.builder()
.min(10000)
.max(99999)
.build());
var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
.name(String.format("%s-%s", name,default_.result()))
.description(name)
.accessedBy("Any")
.tags(Map.ofEntries(
Map.entry("Created", "TF"),
Map.entry("For", "example")
))
.build());
var defaultTable = new Table("defaultTable", TableArgs.builder()
.instanceName(defaultInstance.name())
.tableName("tf_example")
.timeToLive(-1)
.maxVersion(1)
.enableSse(true)
.sseKeyType("SSE_KMS_SERVICE")
.primaryKeys(
TablePrimaryKeyArgs.builder()
.name("pk1")
.type("Integer")
.build(),
TablePrimaryKeyArgs.builder()
.name("pk2")
.type("String")
.build(),
TablePrimaryKeyArgs.builder()
.name("pk3")
.type("Binary")
.build())
.build());
var defaultTunnel = new Tunnel("defaultTunnel", TunnelArgs.builder()
.instanceName(defaultInstance.name())
.tableName(defaultTable.tableName())
.tunnelName("tf_example")
.tunnelType("BaseAndStream")
.build());
}
}
configuration:
name:
type: string
default: tf-example
resources:
default:
type: random:integer
properties:
min: 10000
max: 99999
defaultInstance:
type: alicloud:ots:Instance
name: default
properties:
name: ${name}-${default.result}
description: ${name}
accessedBy: Any
tags:
Created: TF
For: example
defaultTable:
type: alicloud:ots:Table
name: default
properties:
instanceName: ${defaultInstance.name}
tableName: tf_example
timeToLive: -1
maxVersion: 1
enableSse: true
sseKeyType: SSE_KMS_SERVICE
primaryKeys:
- name: pk1
type: Integer
- name: pk2
type: String
- name: pk3
type: Binary
defaultTunnel:
type: alicloud:ots:Tunnel
name: default
properties:
instanceName: ${defaultInstance.name}
tableName: ${defaultTable.tableName}
tunnelName: tf_example
tunnelType: BaseAndStream

Import

OTS tunnel can be imported using id, e.g.

$ pulumi import alicloud:ots/tunnel:Tunnel foo <instance_name>:<table_name>:<tunnel_name>

Properties

Link copied to clipboard

The channels of OTS tunnel. Each element contains the following attributes:

Link copied to clipboard
val createTime: Output<Int>

The creation time of the Tunnel.

Link copied to clipboard
val expired: Output<Boolean>

Whether the tunnel has expired.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val instanceName: Output<String>

The name of the OTS instance in which table will located.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val tableName: Output<String>

The name of the OTS table. If changed, a new table would be created.

Link copied to clipboard
val tunnelId: Output<String>

The tunnel id of the OTS which could not be changed.

Link copied to clipboard
val tunnelName: Output<String>

The name of the OTS tunnel. If changed, a new tunnel would be created.

Link copied to clipboard
val tunnelRpo: Output<Int>

The latest consumption time of the tunnel, unix time in nanosecond.

Link copied to clipboard
val tunnelStage: Output<String>

The stage of OTS tunnel, valid values: InitBaseDataAndStreamShard, ProcessBaseData, ProcessStream.

Link copied to clipboard
val tunnelType: Output<String>

The type of the OTS tunnel. Only BaseAndStream, BaseData or Stream is allowed.

Link copied to clipboard
val urn: Output<String>