UNPKG

@pulumi/yandex

Version:

A Pulumi package for creating and managing yandex cloud resources.

647 lines 20 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.MdbMysqlCluster = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Manages a MySQL cluster within the Yandex.Cloud. For more information, see * [the official documentation](https://cloud.yandex.com/docs/managed-mysql/). * * ## Example Usage * * Example of creating a Single Node MySQL. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("fooVpcNetwork", {}); * const fooVpcSubnet = new yandex.VpcSubnet("fooVpcSubnet", { * zone: "ru-central1-a", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.5.0.0/24"], * }); * const fooMdbMysqlCluster = new yandex.MdbMysqlCluster("fooMdbMysqlCluster", { * environment: "PRESTABLE", * networkId: fooVpcNetwork.id, * version: "8.0", * resources: { * resourcePresetId: "s2.micro", * diskTypeId: "network-ssd", * diskSize: 16, * }, * mysqlConfig: { * sql_mode: "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION", * max_connections: 100, * default_authentication_plugin: "MYSQL_NATIVE_PASSWORD", * innodb_print_all_deadlocks: true, * }, * access: { * webSql: true, * }, * databases: [{ * name: "db_name", * }], * users: [{ * name: "user_name", * password: "your_password", * permissions: [{ * databaseName: "db_name", * roles: ["ALL"], * }], * }], * hosts: [{ * zone: "ru-central1-a", * subnetId: fooVpcSubnet.id, * }], * }); * ``` * * Example of creating a High-Availability(HA) MySQL Cluster. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("fooVpcNetwork", {}); * const fooVpcSubnet = new yandex.VpcSubnet("fooVpcSubnet", { * zone: "ru-central1-a", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.1.0.0/24"], * }); * const bar = new yandex.VpcSubnet("bar", { * zone: "ru-central1-b", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.2.0.0/24"], * }); * const fooMdbMysqlCluster = new yandex.MdbMysqlCluster("fooMdbMysqlCluster", { * environment: "PRESTABLE", * networkId: fooVpcNetwork.id, * version: "8.0", * resources: { * resourcePresetId: "s2.micro", * diskTypeId: "network-ssd", * diskSize: 16, * }, * databases: [{ * name: "db_name", * }], * maintenanceWindow: { * type: "WEEKLY", * day: "SAT", * hour: 12, * }, * users: [{ * name: "user_name", * password: "your_password", * permissions: [{ * databaseName: "db_name", * roles: ["ALL"], * }], * }], * hosts: [ * { * zone: "ru-central1-a", * subnetId: fooVpcSubnet.id, * }, * { * zone: "ru-central1-b", * subnetId: bar.id, * }, * ], * }); * ``` * * Example of creating a MySQL Cluster with cascade replicas: HA-group consist of 'na-1' and 'na-2', cascade replicas form a chain 'na-1' > 'nb-1' > 'nb-2' * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("fooVpcNetwork", {}); * const fooVpcSubnet = new yandex.VpcSubnet("fooVpcSubnet", { * zone: "ru-central1-a", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.1.0.0/24"], * }); * const bar = new yandex.VpcSubnet("bar", { * zone: "ru-central1-b", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.2.0.0/24"], * }); * const fooMdbMysqlCluster = new yandex.MdbMysqlCluster("fooMdbMysqlCluster", { * environment: "PRESTABLE", * networkId: fooVpcNetwork.id, * version: "8.0", * resources: { * resourcePresetId: "s2.micro", * diskTypeId: "network-ssd", * diskSize: 16, * }, * databases: [{ * name: "db_name", * }], * maintenanceWindow: { * type: "WEEKLY", * day: "SAT", * hour: 12, * }, * users: [{ * name: "user_name", * password: "your_password", * permissions: [{ * databaseName: "db_name", * roles: ["ALL"], * }], * }], * hosts: [ * { * zone: "ru-central1-a", * name: "na-1", * subnetId: fooVpcSubnet.id, * }, * { * zone: "ru-central1-a", * name: "na-2", * subnetId: fooVpcSubnet.id, * }, * { * zone: "ru-central1-b", * name: "nb-1", * replicationSourceName: "na-1", * subnetId: bar.id, * }, * { * zone: "ru-central1-b", * name: "nb-2", * replicationSourceName: "nb-1", * subnetId: bar.id, * }, * ], * }); * ``` * * Example of creating a Single Node MySQL with user params. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("fooVpcNetwork", {}); * const fooVpcSubnet = new yandex.VpcSubnet("fooVpcSubnet", { * zone: "ru-central1-a", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.5.0.0/24"], * }); * const fooMdbMysqlCluster = new yandex.MdbMysqlCluster("fooMdbMysqlCluster", { * environment: "PRESTABLE", * networkId: fooVpcNetwork.id, * version: "8.0", * resources: { * resourcePresetId: "s2.micro", * diskTypeId: "network-ssd", * diskSize: 16, * }, * databases: [{ * name: "db_name", * }], * maintenanceWindow: { * type: "ANYTIME", * }, * users: [{ * name: "user_name", * password: "your_password", * permissions: [{ * databaseName: "db_name", * roles: ["ALL"], * }], * connectionLimits: { * maxQuestionsPerHour: 10, * }, * globalPermissions: [ * "REPLICATION_SLAVE", * "PROCESS", * ], * authenticationPlugin: "CACHING_SHA2_PASSWORD", * }], * hosts: [{ * zone: "ru-central1-a", * subnetId: fooVpcSubnet.id, * }], * }); * ``` * * Example of restoring MySQL cluster. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("fooVpcNetwork", {}); * const fooVpcSubnet = new yandex.VpcSubnet("fooVpcSubnet", { * zone: "ru-central1-a", * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.5.0.0/24"], * }); * const fooMdbMysqlCluster = new yandex.MdbMysqlCluster("fooMdbMysqlCluster", { * environment: "PRESTABLE", * networkId: fooVpcNetwork.id, * version: "8.0", * restore: { * backupId: "c9qj2tns23432471d9qha:stream_20210122T141717Z", * time: "2021-01-23T15:04:05", * }, * resources: { * resourcePresetId: "s2.micro", * diskTypeId: "network-ssd", * diskSize: 16, * }, * databases: [{ * name: "db_name", * }], * users: [{ * name: "user_name", * password: "your_password", * permissions: [{ * databaseName: "db_name", * roles: ["ALL"], * }], * }], * hosts: [{ * zone: "ru-central1-a", * subnetId: fooVpcSubnet.id, * }], * }); * ``` * ## MySQL config * * If not specified `mysqlConfig` then does not make any changes. * * * `sqlMode` default value: `ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION` * * some of:\ * - 1: "ALLOW_INVALID_DATES" * - 2: "ANSI_QUOTES" * - 3: "ERROR_FOR_DIVISION_BY_ZERO" * - 4: "HIGH_NOT_PRECEDENCE" * - 5: "IGNORE_SPACE" * - 6: "NO_AUTO_VALUE_ON_ZERO" * - 7: "NO_BACKSLASH_ESCAPES" * - 8: "NO_ENGINE_SUBSTITUTION" * - 9: "NO_UNSIGNED_SUBTRACTION" * - 10: "NO_ZERO_DATE" * - 11: "NO_ZERO_IN_DATE" * - 15: "ONLY_FULL_GROUP_BY" * - 16: "PAD_CHAR_TO_FULL_LENGTH" * - 17: "PIPES_AS_CONCAT" * - 18: "REAL_AS_FLOAT" * - 19: "STRICT_ALL_TABLES" * - 20: "STRICT_TRANS_TABLES" * - 21: "TIME_TRUNCATE_FRACTIONAL" * - 22: "ANSI" * - 23: "TRADITIONAL" * - 24: "NO_DIR_IN_CREATE" * or: * - 0: "SQLMODE_UNSPECIFIED" * * ### MysqlConfig 8.0 * * `auditLog` boolean * * * `autoIncrementIncrement` integer * * * `autoIncrementOffset` integer * * * `binlogCacheSize` integer * * * `binlogGroupCommitSyncDelay` integer * * * `binlogRowImage` one of: * - 0: "BINLOG_ROW_IMAGE_UNSPECIFIED" * - 1: "FULL" * - 2: "MINIMAL" * - 3: "NOBLOB" * * * `binlogRowsQueryLogEvents` boolean * * * `characterSetServer` text * * * `collationServer` text * * * `defaultAuthenticationPlugin` one of: * - 0: "AUTH_PLUGIN_UNSPECIFIED" * - 1: "MYSQL_NATIVE_PASSWORD" * - 2: "CACHING_SHA2_PASSWORD" * - 3: "SHA256_PASSWORD" * * * `defaultTimeZone` text * * * `explicitDefaultsForTimestamp` boolean * * * `generalLog` boolean * * * `groupConcatMaxLen` integer * * * `innodbAdaptiveHashIndex` boolean * * * `innodbBufferPoolSize` integer * * * `innodbFlushLogAtTrxCommit` integer * * * `innodbIoCapacity` integer * * * `innodbIoCapacityMax` integer * * * `innodbLockWaitTimeout` integer * * * `innodbLogBufferSize` integer * * * `innodbLogFileSize` integer * * * `innodbNumaInterleave` boolean * * * `innodbPrintAllDeadlocks` boolean * * * `innodbPurgeThreads` integer * * * `innodbReadIoThreads` integer * * * `innodbTempDataFileMaxSize` integer * * * `innodbThreadConcurrency` integer * * * `innodbWriteIoThreads` integer * * * `joinBufferSize` integer * * * `longQueryTime` float * * * `maxAllowedPacket` integer * * * `maxConnections` integer * * * `maxHeapTableSize` integer * * * `netReadTimeout` integer * * * `netWriteTimeout` integer * * * `regexpTimeLimit` integer * * * `rplSemiSyncMasterWaitForSlaveCount` integer * * * `slaveParallelType` one of: * - 0: "SLAVE_PARALLEL_TYPE_UNSPECIFIED" * - 1: "DATABASE" * - 2: "LOGICAL_CLOCK" * * * `slaveParallelWorkers` integer * * * `sortBufferSize` integer * * * `syncBinlog` integer * * * `tableDefinitionCache` integer * * * `tableOpenCache` integer * * * `tableOpenCacheInstances` integer * * * `threadCacheSize` integer * * * `threadStack` integer * * * `tmpTableSize` integer * * * `transactionIsolation` one of: * - 0: "TRANSACTION_ISOLATION_UNSPECIFIED" * - 1: "READ_COMMITTED" * - 2: "REPEATABLE_READ" * - 3: "SERIALIZABLE" * * ### MysqlConfig 5.7 * * `auditLog` boolean * * * `autoIncrementIncrement` integer * * * `autoIncrementOffset` integer * * * `binlogCacheSize` integer * * * `binlogGroupCommitSyncDelay` integer * * * `binlogRowImage` one of: * - 0: "BINLOG_ROW_IMAGE_UNSPECIFIED" * - 1: "FULL" * - 2: "MINIMAL" * - 3: "NOBLOB" * * * `binlogRowsQueryLogEvents` boolean * * * `characterSetServer` text * * * `collationServer` text * * * `defaultAuthenticationPlugin` one of: * - 0: "AUTH_PLUGIN_UNSPECIFIED" * - 1: "MYSQL_NATIVE_PASSWORD" * - 2: "CACHING_SHA2_PASSWORD" * - 3: "SHA256_PASSWORD" * * * `defaultTimeZone` text * * * `explicitDefaultsForTimestamp` boolean * * * `generalLog` boolean * * * `groupConcatMaxLen` integer * * * `innodbAdaptiveHashIndex` boolean * * * `innodbBufferPoolSize` integer * * * `innodbFlushLogAtTrxCommit` integer * * * `innodbIoCapacity` integer * * * `innodbIoCapacityMax` integer * * * `innodbLockWaitTimeout` integer * * * `innodbLogBufferSize` integer * * * `innodbLogFileSize` integer * * * `innodbNumaInterleave` boolean * * * `innodbPrintAllDeadlocks` boolean * * * `innodbPurgeThreads` integer * * * `innodbReadIoThreads` integer * * * `innodbTempDataFileMaxSize` integer * * * `innodbThreadConcurrency` integer * * * `innodbWriteIoThreads` integer * * * `joinBufferSize` integer * * * `longQueryTime` float * * * `maxAllowedPacket` integer * * * `maxConnections` integer * * * `maxHeapTableSize` integer * * * `netReadTimeout` integer * * * `netWriteTimeout` integer * * * `rplSemiSyncMasterWaitForSlaveCount` integer * * * `slaveParallelType` one of: * - 0: "SLAVE_PARALLEL_TYPE_UNSPECIFIED" * - 1: "DATABASE" * - 2: "LOGICAL_CLOCK" * * * `slaveParallelWorkers` integer * * * `sortBufferSize` integer * * * `syncBinlog` integer * * * `tableDefinitionCache` integer * * * `tableOpenCache` integer * * * `tableOpenCacheInstances` integer * * * `threadCacheSize` integer * * * `threadStack` integer * * * `tmpTableSize` integer * * * `transactionIsolation` one of: * - 0: "TRANSACTION_ISOLATION_UNSPECIFIED" * - 1: "READ_COMMITTED" * - 2: "REPEATABLE_READ" * - 3: "SERIALIZABLE" * * ## Import * * A cluster can be imported using the `id` of the resource, e.g. * * ```sh * $ pulumi import yandex:index/mdbMysqlCluster:MdbMysqlCluster foo cluster_id * ``` */ class MdbMysqlCluster extends pulumi.CustomResource { constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["access"] = state ? state.access : undefined; resourceInputs["allowRegenerationHost"] = state ? state.allowRegenerationHost : undefined; resourceInputs["backupWindowStart"] = state ? state.backupWindowStart : 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["health"] = state ? state.health : undefined; resourceInputs["hosts"] = state ? state.hosts : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["maintenanceWindow"] = state ? state.maintenanceWindow : undefined; resourceInputs["mysqlConfig"] = state ? state.mysqlConfig : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["networkId"] = state ? state.networkId : undefined; resourceInputs["resources"] = state ? state.resources : undefined; resourceInputs["restore"] = state ? state.restore : undefined; resourceInputs["securityGroupIds"] = state ? state.securityGroupIds : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["users"] = state ? state.users : undefined; resourceInputs["version"] = state ? state.version : undefined; } else { const args = argsOrState; if ((!args || args.databases === undefined) && !opts.urn) { throw new Error("Missing required property 'databases'"); } 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'"); } if ((!args || args.resources === undefined) && !opts.urn) { throw new Error("Missing required property 'resources'"); } if ((!args || args.users === undefined) && !opts.urn) { throw new Error("Missing required property 'users'"); } if ((!args || args.version === undefined) && !opts.urn) { throw new Error("Missing required property 'version'"); } resourceInputs["access"] = args ? args.access : undefined; resourceInputs["allowRegenerationHost"] = args ? args.allowRegenerationHost : undefined; resourceInputs["backupWindowStart"] = args ? args.backupWindowStart : 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["hosts"] = args ? args.hosts : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["maintenanceWindow"] = args ? args.maintenanceWindow : undefined; resourceInputs["mysqlConfig"] = args ? args.mysqlConfig : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["networkId"] = args ? args.networkId : undefined; resourceInputs["resources"] = args ? args.resources : undefined; resourceInputs["restore"] = args ? args.restore : undefined; resourceInputs["securityGroupIds"] = args ? args.securityGroupIds : undefined; resourceInputs["users"] = args ? args.users : undefined; resourceInputs["version"] = args ? args.version : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["health"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(MdbMysqlCluster.__pulumiType, name, resourceInputs, opts); } /** * Get an existing MdbMysqlCluster 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 MdbMysqlCluster(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of MdbMysqlCluster. 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'] === MdbMysqlCluster.__pulumiType; } } exports.MdbMysqlCluster = MdbMysqlCluster; /** @internal */ MdbMysqlCluster.__pulumiType = 'yandex:index/mdbMysqlCluster:MdbMysqlCluster'; //# sourceMappingURL=mdbMysqlCluster.js.map