UNPKG

@pulumi/yandex

Version:

A Pulumi package for creating and managing yandex cloud resources.

272 lines 10.9 kB
"use strict"; // *** 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.MdbKafkaCluster = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Manages a Kafka cluster within the Yandex.Cloud. For more information, see * [the official documentation](https://cloud.yandex.com/docs/managed-kafka/concepts). * * ## Example Usage * * Example of creating a Single Node Kafka. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("foo", {}); * const fooVpcSubnet = new yandex.VpcSubnet("foo", { * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.5.0.0/24"], * zone: "ru-central1-a", * }); * const fooMdbKafkaCluster = new yandex.MdbKafkaCluster("foo", { * config: { * assignPublicIp: false, * brokersCount: 1, * kafka: { * kafkaConfig: { * compressionType: "COMPRESSION_TYPE_ZSTD", * defaultReplicationFactor: "1", * logFlushIntervalMessages: "1024", * logFlushIntervalMs: "1000", * logFlushSchedulerIntervalMs: "1000", * logPreallocate: true, * logRetentionBytes: "1.073741824e+09", * logRetentionHours: "168", * logRetentionMinutes: "10080", * logRetentionMs: "8.64e+07", * logSegmentBytes: "1.34217728e+08", * numPartitions: "10", * }, * resources: { * diskSize: 32, * diskTypeId: "network-ssd", * resourcePresetId: "s2.micro", * }, * }, * schemaRegistry: false, * unmanagedTopics: false, * version: "2.8", * zones: ["ru-central1-a"], * }, * environment: "PRESTABLE", * networkId: fooVpcNetwork.id, * subnetIds: [fooVpcSubnet.id], * users: [ * { * name: "producer-application", * password: "password", * permissions: [{ * role: "ACCESS_ROLE_PRODUCER", * topicName: "input", * }], * }, * { * name: "worker", * password: "password", * permissions: [ * { * role: "ACCESS_ROLE_CONSUMER", * topicName: "input", * }, * { * role: "ACCESS_ROLE_PRODUCER", * topicName: "output", * }, * ], * }, * ], * }); * ``` * * Example of creating a HA Kafka Cluster with two brokers per AZ (6 brokers + 3 zk) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("foo", {}); * const fooVpcSubnet = new yandex.VpcSubnet("foo", { * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.1.0.0/24"], * zone: "ru-central1-a", * }); * const bar = new yandex.VpcSubnet("bar", { * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.2.0.0/24"], * zone: "ru-central1-b", * }); * const baz = new yandex.VpcSubnet("baz", { * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.3.0.0/24"], * zone: "ru-central1-c", * }); * const fooMdbKafkaCluster = new yandex.MdbKafkaCluster("foo", { * config: { * assignPublicIp: true, * brokersCount: 2, * kafka: { * kafkaConfig: { * compressionType: "COMPRESSION_TYPE_ZSTD", * defaultReplicationFactor: "6", * logFlushIntervalMessages: "1024", * logFlushIntervalMs: "1000", * logFlushSchedulerIntervalMs: "1000", * logPreallocate: true, * logRetentionBytes: "1.073741824e+09", * logRetentionHours: "168", * logRetentionMinutes: "10080", * logRetentionMs: "8.64e+07", * logSegmentBytes: "1.34217728e+08", * numPartitions: "10", * }, * resources: { * diskSize: 128, * diskTypeId: "network-ssd", * resourcePresetId: "s2.medium", * }, * }, * schemaRegistry: false, * unmanagedTopics: false, * version: "2.8", * zones: [ * "ru-central1-a", * "ru-central1-b", * "ru-central1-c", * ], * zookeeper: { * resources: { * diskSize: 20, * diskTypeId: "network-ssd", * resourcePresetId: "s2.micro", * }, * }, * }, * environment: "PRESTABLE", * networkId: fooVpcNetwork.id, * subnetIds: [ * fooVpcSubnet.id, * bar.id, * baz.id, * ], * users: [ * { * name: "producer-application", * password: "password", * permissions: [{ * role: "ACCESS_ROLE_PRODUCER", * topicName: "input", * }], * }, * { * name: "worker", * password: "password", * permissions: [ * { * role: "ACCESS_ROLE_CONSUMER", * topicName: "input", * }, * { * role: "ACCESS_ROLE_PRODUCER", * topicName: "output", * }, * ], * }, * ], * }); * ``` * * ## Import * * A cluster can be imported using the `id` of the resource, e.g. * * ```sh * $ pulumi import yandex:index/mdbKafkaCluster:MdbKafkaCluster foo cluster_id * ``` */ class MdbKafkaCluster extends pulumi.CustomResource { constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["config"] = state ? state.config : undefined; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["deletionProtection"] = state ? state.deletionProtection : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["environment"] = state ? state.environment : undefined; resourceInputs["folderId"] = state ? state.folderId : undefined; resourceInputs["health"] = state ? state.health : undefined; resourceInputs["hostGroupIds"] = state ? state.hostGroupIds : undefined; resourceInputs["hosts"] = state ? state.hosts : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["maintenanceWindow"] = state ? state.maintenanceWindow : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["networkId"] = state ? state.networkId : undefined; resourceInputs["securityGroupIds"] = state ? state.securityGroupIds : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["subnetIds"] = state ? state.subnetIds : undefined; resourceInputs["topics"] = state ? state.topics : undefined; resourceInputs["users"] = state ? state.users : undefined; } else { const args = argsOrState; if ((!args || args.config === undefined) && !opts.urn) { throw new Error("Missing required property 'config'"); } if ((!args || args.networkId === undefined) && !opts.urn) { throw new Error("Missing required property 'networkId'"); } resourceInputs["config"] = args ? args.config : undefined; resourceInputs["deletionProtection"] = args ? args.deletionProtection : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["environment"] = args ? args.environment : undefined; resourceInputs["folderId"] = args ? args.folderId : undefined; resourceInputs["hostGroupIds"] = args ? args.hostGroupIds : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["maintenanceWindow"] = args ? args.maintenanceWindow : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["networkId"] = args ? args.networkId : undefined; resourceInputs["securityGroupIds"] = args ? args.securityGroupIds : undefined; resourceInputs["subnetIds"] = args ? args.subnetIds : undefined; resourceInputs["topics"] = args ? args.topics : undefined; resourceInputs["users"] = args ? args.users : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["health"] = undefined /*out*/; resourceInputs["hosts"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(MdbKafkaCluster.__pulumiType, name, resourceInputs, opts); } /** * Get an existing MdbKafkaCluster 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 MdbKafkaCluster(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of MdbKafkaCluster. 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'] === MdbKafkaCluster.__pulumiType; } } exports.MdbKafkaCluster = MdbKafkaCluster; /** @internal */ MdbKafkaCluster.__pulumiType = 'yandex:index/mdbKafkaCluster:MdbKafkaCluster'; //# sourceMappingURL=mdbKafkaCluster.js.map