@pulumi/yandex
Version:
A Pulumi package for creating and managing yandex cloud resources.
121 lines • 4.87 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.MdbKafkaTopic = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a topic of a Kafka cluster within the Yandex.Cloud. For more information, see
* [the official documentation](https://cloud.yandex.com/docs/managed-kafka/concepts).
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as yandex from "@pulumi/yandex";
*
* const foo = new yandex.MdbKafkaCluster("foo", {
* networkId: "c64vs98keiqc7f24pvkd",
* config: {
* version: "2.8",
* zones: ["ru-central1-a"],
* unmanagedTopics: true,
* kafka: {
* resources: {
* resourcePresetId: "s2.micro",
* diskTypeId: "network-hdd",
* diskSize: 16,
* },
* },
* },
* });
* const events = new yandex.MdbKafkaTopic("events", {
* clusterId: foo.id,
* partitions: 4,
* replicationFactor: 1,
* topicConfig: {
* cleanupPolicy: "CLEANUP_POLICY_COMPACT",
* compressionType: "COMPRESSION_TYPE_LZ4",
* deleteRetentionMs: 86400000,
* fileDeleteDelayMs: 60000,
* flushMessages: 128,
* flushMs: 1000,
* minCompactionLagMs: 0,
* retentionBytes: 10737418240,
* retentionMs: 604800000,
* maxMessageBytes: 1048588,
* minInsyncReplicas: 1,
* segmentBytes: 268435456,
* preallocate: true,
* },
* });
* ```
*
* ## Import
*
* Kafka topic can be imported using following format
*
* ```sh
* $ pulumi import yandex:index/mdbKafkaTopic:MdbKafkaTopic foo {{cluster_id}}:{{topic_name}}
* ```
*/
class MdbKafkaTopic extends pulumi.CustomResource {
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["clusterId"] = state ? state.clusterId : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["partitions"] = state ? state.partitions : undefined;
resourceInputs["replicationFactor"] = state ? state.replicationFactor : undefined;
resourceInputs["topicConfig"] = state ? state.topicConfig : undefined;
}
else {
const args = argsOrState;
if ((!args || args.clusterId === undefined) && !opts.urn) {
throw new Error("Missing required property 'clusterId'");
}
if ((!args || args.partitions === undefined) && !opts.urn) {
throw new Error("Missing required property 'partitions'");
}
if ((!args || args.replicationFactor === undefined) && !opts.urn) {
throw new Error("Missing required property 'replicationFactor'");
}
resourceInputs["clusterId"] = args ? args.clusterId : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["partitions"] = args ? args.partitions : undefined;
resourceInputs["replicationFactor"] = args ? args.replicationFactor : undefined;
resourceInputs["topicConfig"] = args ? args.topicConfig : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(MdbKafkaTopic.__pulumiType, name, resourceInputs, opts);
}
/**
* Get an existing MdbKafkaTopic 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 MdbKafkaTopic(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of MdbKafkaTopic. 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'] === MdbKafkaTopic.__pulumiType;
}
}
exports.MdbKafkaTopic = MdbKafkaTopic;
/** @internal */
MdbKafkaTopic.__pulumiType = 'yandex:index/mdbKafkaTopic:MdbKafkaTopic';
//# sourceMappingURL=mdbKafkaTopic.js.map