@pulumi/yandex
Version:
A Pulumi package for creating and managing yandex cloud resources.
510 lines • 19.7 kB
JavaScript
"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.MdbClickhouseCluster = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a ClickHouse cluster within the Yandex.Cloud. For more information, see
* [the official documentation](https://cloud.yandex.com/docs/managed-clickhouse/concepts).
*
* ## Example Usage
*
* Example of creating a Single Node ClickHouse.
*
* ```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 fooMdbClickhouseCluster = new yandex.MdbClickhouseCluster("foo", {
* clickhouse: {
* config: {
* backgroundPoolSize: 16,
* backgroundSchedulePoolSize: 16,
* compressions: [
* {
* method: "LZ4",
* minPartSize: 1024,
* minPartSizeRatio: 0.5,
* },
* {
* method: "ZSTD",
* minPartSize: 2048,
* minPartSizeRatio: 0.7,
* },
* ],
* geobaseUri: "",
* graphiteRollups: [
* {
* name: "rollup1",
* patterns: [{
* function: "func1",
* regexp: "abc",
* retentions: [{
* age: 1000,
* precision: 3,
* }],
* }],
* },
* {
* name: "rollup2",
* patterns: [{
* function: "func2",
* retentions: [{
* age: 2000,
* precision: 5,
* }],
* }],
* },
* ],
* kafka: {
* saslMechanism: "SASL_MECHANISM_GSSAPI",
* saslPassword: "pass1",
* saslUsername: "user1",
* securityProtocol: "SECURITY_PROTOCOL_PLAINTEXT",
* },
* kafkaTopics: [
* {
* name: "topic1",
* settings: {
* saslMechanism: "SASL_MECHANISM_SCRAM_SHA_256",
* saslPassword: "pass2",
* saslUsername: "user2",
* securityProtocol: "SECURITY_PROTOCOL_SSL",
* },
* },
* {
* name: "topic2",
* settings: {
* saslMechanism: "SASL_MECHANISM_PLAIN",
* securityProtocol: "SECURITY_PROTOCOL_SASL_PLAINTEXT",
* },
* },
* ],
* keepAliveTimeout: 3000,
* logLevel: "TRACE",
* markCacheSize: 5368709120,
* maxConcurrentQueries: 50,
* maxConnections: 100,
* maxPartitionSizeToDrop: 53687091200,
* maxTableSizeToDrop: 53687091200,
* mergeTree: {
* maxBytesToMergeAtMinSpaceInPool: 1048576,
* maxReplicatedMergesInQueue: 16,
* numberOfFreeEntriesInPoolToLowerMaxSizeOfMerge: 8,
* partsToDelayInsert: 150,
* partsToThrowInsert: 300,
* replicatedDeduplicationWindow: 100,
* replicatedDeduplicationWindowSeconds: 604800,
* },
* metricLogEnabled: true,
* metricLogRetentionSize: 536870912,
* metricLogRetentionTime: 2592000,
* partLogRetentionSize: 536870912,
* partLogRetentionTime: 2592000,
* queryLogRetentionSize: 1073741824,
* queryLogRetentionTime: 2592000,
* queryThreadLogEnabled: true,
* queryThreadLogRetentionSize: 536870912,
* queryThreadLogRetentionTime: 2592000,
* rabbitmq: {
* password: "rabbit_pass",
* username: "rabbit_user",
* },
* textLogEnabled: true,
* textLogLevel: "TRACE",
* textLogRetentionSize: 536870912,
* textLogRetentionTime: 2592000,
* timezone: "UTC",
* traceLogEnabled: true,
* traceLogRetentionSize: 536870912,
* traceLogRetentionTime: 2592000,
* uncompressedCacheSize: 8589934592,
* },
* resources: {
* diskSize: 32,
* diskTypeId: "network-ssd",
* resourcePresetId: "s2.micro",
* },
* },
* cloudStorage: {
* enabled: false,
* },
* databases: [{
* name: "db_name",
* }],
* environment: "PRESTABLE",
* formatSchemas: [{
* name: "test_schema",
* type: "FORMAT_SCHEMA_TYPE_CAPNPROTO",
* uri: "https://storage.yandexcloud.net/ch-data/schema.proto",
* }],
* hosts: [{
* subnetId: fooVpcSubnet.id,
* type: "CLICKHOUSE",
* zone: "ru-central1-a",
* }],
* maintenanceWindow: {
* type: "ANYTIME",
* },
* mlModels: [{
* name: "test_model",
* type: "ML_MODEL_TYPE_CATBOOST",
* uri: "https://storage.yandexcloud.net/ch-data/train.csv",
* }],
* networkId: fooVpcNetwork.id,
* serviceAccountId: "your_service_account_id",
* users: [{
* name: "user",
* password: "your_password",
* permissions: [{
* databaseName: "db_name",
* }],
* quotas: [
* {
* errors: 1000,
* intervalDuration: 3600000,
* queries: 10000,
* },
* {
* error: 5000,
* intervalDuration: 79800000,
* queries: 50000,
* },
* ],
* settings: {
* maxMemoryUsageForUser: 1000000000,
* outputFormatJsonQuote64bitIntegers: true,
* readOverflowMode: "throw",
* },
* }],
* });
* ```
*
* Example of creating a HA ClickHouse Cluster.
*
* ```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 fooMdbClickhouseCluster = new yandex.MdbClickhouseCluster("foo", {
* clickhouse: {
* resources: {
* diskSize: 16,
* diskTypeId: "network-ssd",
* resourcePresetId: "s2.micro",
* },
* },
* cloudStorage: {
* enabled: false,
* },
* databases: [{
* name: "db_name",
* }],
* environment: "PRESTABLE",
* hosts: [
* {
* subnetId: fooVpcSubnet.id,
* type: "CLICKHOUSE",
* zone: "ru-central1-a",
* },
* {
* subnetId: bar.id,
* type: "CLICKHOUSE",
* zone: "ru-central1-b",
* },
* {
* subnetId: fooVpcSubnet.id,
* type: "ZOOKEEPER",
* zone: "ru-central1-a",
* },
* {
* subnetId: bar.id,
* type: "ZOOKEEPER",
* zone: "ru-central1-b",
* },
* {
* subnetId: baz.id,
* type: "ZOOKEEPER",
* zone: "ru-central1-c",
* },
* ],
* networkId: fooVpcNetwork.id,
* users: [{
* name: "user",
* password: "password",
* permissions: [{
* databaseName: "db_name",
* }],
* quotas: [
* {
* errors: 1000,
* intervalDuration: 3600000,
* queries: 10000,
* },
* {
* error: 5000,
* intervalDuration: 79800000,
* queries: 50000,
* },
* ],
* settings: {
* maxMemoryUsageForUser: 1000000000,
* outputFormatJsonQuote64bitIntegers: true,
* readOverflowMode: "throw",
* },
* }],
* zookeeper: {
* resources: {
* diskSize: 10,
* diskTypeId: "network-ssd",
* resourcePresetId: "s2.micro",
* },
* },
* });
* ```
*
* Example of creating a sharded ClickHouse Cluster.
*
* ```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 fooMdbClickhouseCluster = new yandex.MdbClickhouseCluster("foo", {
* clickhouse: {
* resources: {
* diskSize: 16,
* diskTypeId: "network-ssd",
* resourcePresetId: "s2.micro",
* },
* },
* cloudStorage: {
* enabled: false,
* },
* databases: [{
* name: "db_name",
* }],
* environment: "PRODUCTION",
* hosts: [
* {
* shardName: "shard1",
* subnetId: fooVpcSubnet.id,
* type: "CLICKHOUSE",
* zone: "ru-central1-a",
* },
* {
* shardName: "shard1",
* subnetId: bar.id,
* type: "CLICKHOUSE",
* zone: "ru-central1-b",
* },
* {
* shardName: "shard2",
* subnetId: bar.id,
* type: "CLICKHOUSE",
* zone: "ru-central1-b",
* },
* {
* shardName: "shard2",
* subnetId: baz.id,
* type: "CLICKHOUSE",
* zone: "ru-central1-c",
* },
* ],
* networkId: fooVpcNetwork.id,
* shardGroups: [{
* description: "Cluster configuration that contain only shard1",
* name: "single_shard_group",
* shardNames: ["shard1"],
* }],
* users: [{
* name: "user",
* password: "password",
* permissions: [{
* databaseName: "db_name",
* }],
* quotas: [
* {
* errors: 1000,
* intervalDuration: 3600000,
* queries: 10000,
* },
* {
* error: 5000,
* intervalDuration: 79800000,
* queries: 50000,
* },
* ],
* settings: {
* maxMemoryUsageForUser: 1000000000,
* outputFormatJsonQuote64bitIntegers: true,
* readOverflowMode: "throw",
* },
* }],
* zookeeper: {
* resources: {
* diskSize: 10,
* diskTypeId: "network-ssd",
* resourcePresetId: "s2.micro",
* },
* },
* });
* ```
*
* ## Import
*
* A cluster can be imported using the `id` of the resource, e.g.
*
* ```sh
* $ pulumi import yandex:index/mdbClickhouseCluster:MdbClickhouseCluster foo cluster_id
* ```
*/
class MdbClickhouseCluster extends pulumi.CustomResource {
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["access"] = state ? state.access : undefined;
resourceInputs["adminPassword"] = state ? state.adminPassword : undefined;
resourceInputs["backupWindowStart"] = state ? state.backupWindowStart : undefined;
resourceInputs["clickhouse"] = state ? state.clickhouse : undefined;
resourceInputs["cloudStorage"] = state ? state.cloudStorage : undefined;
resourceInputs["copySchemaOnNewHosts"] = state ? state.copySchemaOnNewHosts : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["databases"] = state ? state.databases : 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["formatSchemas"] = state ? state.formatSchemas : undefined;
resourceInputs["health"] = state ? state.health : undefined;
resourceInputs["hosts"] = state ? state.hosts : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["maintenanceWindow"] = state ? state.maintenanceWindow : undefined;
resourceInputs["mlModels"] = state ? state.mlModels : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["networkId"] = state ? state.networkId : undefined;
resourceInputs["securityGroupIds"] = state ? state.securityGroupIds : undefined;
resourceInputs["serviceAccountId"] = state ? state.serviceAccountId : undefined;
resourceInputs["shardGroups"] = state ? state.shardGroups : undefined;
resourceInputs["sqlDatabaseManagement"] = state ? state.sqlDatabaseManagement : undefined;
resourceInputs["sqlUserManagement"] = state ? state.sqlUserManagement : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["users"] = state ? state.users : undefined;
resourceInputs["version"] = state ? state.version : undefined;
resourceInputs["zookeeper"] = state ? state.zookeeper : undefined;
}
else {
const args = argsOrState;
if ((!args || args.clickhouse === undefined) && !opts.urn) {
throw new Error("Missing required property 'clickhouse'");
}
if ((!args || args.environment === undefined) && !opts.urn) {
throw new Error("Missing required property 'environment'");
}
if ((!args || args.hosts === undefined) && !opts.urn) {
throw new Error("Missing required property 'hosts'");
}
if ((!args || args.networkId === undefined) && !opts.urn) {
throw new Error("Missing required property 'networkId'");
}
resourceInputs["access"] = args ? args.access : undefined;
resourceInputs["adminPassword"] = args ? args.adminPassword : undefined;
resourceInputs["backupWindowStart"] = args ? args.backupWindowStart : undefined;
resourceInputs["clickhouse"] = args ? args.clickhouse : undefined;
resourceInputs["cloudStorage"] = args ? args.cloudStorage : undefined;
resourceInputs["copySchemaOnNewHosts"] = args ? args.copySchemaOnNewHosts : undefined;
resourceInputs["databases"] = args ? args.databases : 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["formatSchemas"] = args ? args.formatSchemas : undefined;
resourceInputs["hosts"] = args ? args.hosts : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["maintenanceWindow"] = args ? args.maintenanceWindow : undefined;
resourceInputs["mlModels"] = args ? args.mlModels : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["networkId"] = args ? args.networkId : undefined;
resourceInputs["securityGroupIds"] = args ? args.securityGroupIds : undefined;
resourceInputs["serviceAccountId"] = args ? args.serviceAccountId : undefined;
resourceInputs["shardGroups"] = args ? args.shardGroups : undefined;
resourceInputs["sqlDatabaseManagement"] = args ? args.sqlDatabaseManagement : undefined;
resourceInputs["sqlUserManagement"] = args ? args.sqlUserManagement : undefined;
resourceInputs["users"] = args ? args.users : undefined;
resourceInputs["version"] = args ? args.version : undefined;
resourceInputs["zookeeper"] = args ? args.zookeeper : undefined;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["health"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(MdbClickhouseCluster.__pulumiType, name, resourceInputs, opts);
}
/**
* Get an existing MdbClickhouseCluster 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 MdbClickhouseCluster(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of MdbClickhouseCluster. 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'] === MdbClickhouseCluster.__pulumiType;
}
}
exports.MdbClickhouseCluster = MdbClickhouseCluster;
/** @internal */
MdbClickhouseCluster.__pulumiType = 'yandex:index/mdbClickhouseCluster:MdbClickhouseCluster';
//# sourceMappingURL=mdbClickhouseCluster.js.map