@volcengine/pulumi
Version:
A Pulumi package for creating and managing volcengine cloud resources.
208 lines • 9.02 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Instance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as volcengine from "@pulumi/volcengine";
* import * as volcengine from "@volcengine/pulumi";
*
* const fooZones = volcengine.ecs.getZones({});
* // create vpc
* const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
* vpcName: "acc-test-vpc",
* cidrBlock: "172.16.0.0/16",
* dnsServers: [
* "8.8.8.8",
* "114.114.114.114",
* ],
* projectName: "default",
* });
* // create subnet
* const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
* subnetName: "acc-test-subnet",
* cidrBlock: "172.16.0.0/24",
* zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
* vpcId: fooVpc.id,
* });
* // create kafka instance
* const fooInstance = new volcengine.kafka.Instance("fooInstance", {
* instanceName: "acc-test-kafka",
* instanceDescription: "tf-test",
* version: "2.2.2",
* computeSpec: "kafka.20xrate.hw",
* subnetId: fooSubnet.id,
* userName: "tf-user",
* userPassword: "tf-pass!@q1",
* chargeType: "PostPaid",
* storageSpace: 300,
* partitionNumber: 350,
* projectName: "default",
* tags: [{
* key: "k1",
* value: "v1",
* }],
* parameters: [
* {
* parameterName: "MessageMaxByte",
* parameterValue: "12",
* },
* {
* parameterName: "LogRetentionHours",
* parameterValue: "70",
* },
* {
* parameterName: "MessageTimestampType",
* parameterValue: "CreateTime",
* },
* {
* parameterName: "OffsetRetentionMinutes",
* parameterValue: "10080",
* },
* {
* parameterName: "AutoDeleteGroup",
* parameterValue: "false",
* },
* ],
* });
* const fooAddress = new volcengine.eip.Address("fooAddress", {
* billingType: "PostPaidByBandwidth",
* bandwidth: 1,
* isp: "BGP",
* description: "tf-test",
* projectName: "default",
* });
* const fooPublicAddress = new volcengine.kafka.PublicAddress("fooPublicAddress", {
* instanceId: fooInstance.id,
* eipId: fooAddress.id,
* });
* const fooGroup = new volcengine.kafka.Group("fooGroup", {
* instanceId: fooInstance.id,
* groupId: "acc-test-group",
* description: "tf-test",
* });
* const fooTopic = new volcengine.kafka.Topic("fooTopic", {
* topicName: "acc-test-topic",
* instanceId: fooInstance.id,
* description: "tf-test",
* partitionNumber: 15,
* replicaNumber: 3,
* parameters: {
* minInsyncReplicaNumber: 2,
* messageMaxByte: 10,
* logRetentionHours: 96,
* },
* allAuthority: false,
* });
* ```
*
* ## Import
*
* KafkaInstance can be imported using the id, e.g.
*
* ```sh
* $ pulumi import volcengine:kafka/instance:Instance default kafka-insbjwbbwb
* ```
*/
class Instance extends pulumi.CustomResource {
/**
* Get an existing Instance resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new Instance(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Instance. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Instance.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["autoRenew"] = state ? state.autoRenew : undefined;
resourceInputs["chargeType"] = state ? state.chargeType : undefined;
resourceInputs["computeSpec"] = state ? state.computeSpec : undefined;
resourceInputs["instanceDescription"] = state ? state.instanceDescription : undefined;
resourceInputs["instanceName"] = state ? state.instanceName : undefined;
resourceInputs["needRebalance"] = state ? state.needRebalance : undefined;
resourceInputs["parameters"] = state ? state.parameters : undefined;
resourceInputs["partitionNumber"] = state ? state.partitionNumber : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["projectName"] = state ? state.projectName : undefined;
resourceInputs["rebalanceTime"] = state ? state.rebalanceTime : undefined;
resourceInputs["storageSpace"] = state ? state.storageSpace : undefined;
resourceInputs["storageType"] = state ? state.storageType : undefined;
resourceInputs["subnetId"] = state ? state.subnetId : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["userName"] = state ? state.userName : undefined;
resourceInputs["userPassword"] = state ? state.userPassword : undefined;
resourceInputs["version"] = state ? state.version : undefined;
}
else {
const args = argsOrState;
if ((!args || args.chargeType === undefined) && !opts.urn) {
throw new Error("Missing required property 'chargeType'");
}
if ((!args || args.computeSpec === undefined) && !opts.urn) {
throw new Error("Missing required property 'computeSpec'");
}
if ((!args || args.subnetId === undefined) && !opts.urn) {
throw new Error("Missing required property 'subnetId'");
}
if ((!args || args.userName === undefined) && !opts.urn) {
throw new Error("Missing required property 'userName'");
}
if ((!args || args.userPassword === undefined) && !opts.urn) {
throw new Error("Missing required property 'userPassword'");
}
if ((!args || args.version === undefined) && !opts.urn) {
throw new Error("Missing required property 'version'");
}
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["chargeType"] = args ? args.chargeType : undefined;
resourceInputs["computeSpec"] = args ? args.computeSpec : undefined;
resourceInputs["instanceDescription"] = args ? args.instanceDescription : undefined;
resourceInputs["instanceName"] = args ? args.instanceName : undefined;
resourceInputs["needRebalance"] = args ? args.needRebalance : undefined;
resourceInputs["parameters"] = args ? args.parameters : undefined;
resourceInputs["partitionNumber"] = args ? args.partitionNumber : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["projectName"] = args ? args.projectName : undefined;
resourceInputs["rebalanceTime"] = args ? args.rebalanceTime : undefined;
resourceInputs["storageSpace"] = args ? args.storageSpace : undefined;
resourceInputs["storageType"] = args ? args.storageType : undefined;
resourceInputs["subnetId"] = args ? args.subnetId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["userName"] = args ? args.userName : undefined;
resourceInputs["userPassword"] = (args === null || args === void 0 ? void 0 : args.userPassword) ? pulumi.secret(args.userPassword) : undefined;
resourceInputs["version"] = args ? args.version : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["userPassword"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Instance.__pulumiType, name, resourceInputs, opts);
}
}
exports.Instance = Instance;
/** @internal */
Instance.__pulumiType = 'volcengine:kafka/instance:Instance';
//# sourceMappingURL=instance.js.map