1. Packages
  2. Volcengine
  3. API Docs
  4. rds_mysql
  5. Databases
Volcengine v0.0.23 published on Wednesday, Jan 3, 2024 by Volcengine

volcengine.rds_mysql.Databases

Explore with Pulumi AI

volcengine logo
Volcengine v0.0.23 published on Wednesday, Jan 3, 2024 by Volcengine

    Use this data source to query detailed information of rds mysql databases

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Volcengine = Pulumi.Volcengine;
    using Volcengine = Volcengine.Pulumi.Volcengine;
    
    return await Deployment.RunAsync(() => 
    {
        var fooZones = Volcengine.Ecs.Zones.Invoke();
    
        var fooVpc = new Volcengine.Vpc.Vpc("fooVpc", new()
        {
            VpcName = "acc-test-project1",
            CidrBlock = "172.16.0.0/16",
        });
    
        var fooSubnet = new Volcengine.Vpc.Subnet("fooSubnet", new()
        {
            SubnetName = "acc-subnet-test-2",
            CidrBlock = "172.16.0.0/24",
            ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
            VpcId = fooVpc.Id,
        });
    
        var fooInstance = new Volcengine.Rds_mysql.Instance("fooInstance", new()
        {
            DbEngineVersion = "MySQL_5_7",
            NodeSpec = "rds.mysql.1c2g",
            PrimaryZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
            SecondaryZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
            StorageSpace = 80,
            SubnetId = fooSubnet.Id,
            InstanceName = "acc-test",
            LowerCaseTableNames = "1",
            ChargeInfo = new Volcengine.Rds_mysql.Inputs.InstanceChargeInfoArgs
            {
                ChargeType = "PostPaid",
            },
            Parameters = new[]
            {
                new Volcengine.Rds_mysql.Inputs.InstanceParameterArgs
                {
                    ParameterName = "auto_increment_increment",
                    ParameterValue = "2",
                },
                new Volcengine.Rds_mysql.Inputs.InstanceParameterArgs
                {
                    ParameterName = "auto_increment_offset",
                    ParameterValue = "4",
                },
            },
        });
    
        var fooDatabase = new Volcengine.Rds_mysql.Database("fooDatabase", new()
        {
            DbName = "acc-test",
            InstanceId = fooInstance.Id,
        });
    
        var fooDatabases = Volcengine.Rds_mysql.Databases.Invoke(new()
        {
            DbName = "acc-test",
            InstanceId = fooInstance.Id,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/rds_mysql"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		fooZones, err := ecs.Zones(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		fooVpc, err := vpc.NewVpc(ctx, "fooVpc", &vpc.VpcArgs{
    			VpcName:   pulumi.String("acc-test-project1"),
    			CidrBlock: pulumi.String("172.16.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		fooSubnet, err := vpc.NewSubnet(ctx, "fooSubnet", &vpc.SubnetArgs{
    			SubnetName: pulumi.String("acc-subnet-test-2"),
    			CidrBlock:  pulumi.String("172.16.0.0/24"),
    			ZoneId:     *pulumi.String(fooZones.Zones[0].Id),
    			VpcId:      fooVpc.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		fooInstance, err := rds_mysql.NewInstance(ctx, "fooInstance", &rds_mysql.InstanceArgs{
    			DbEngineVersion:     pulumi.String("MySQL_5_7"),
    			NodeSpec:            pulumi.String("rds.mysql.1c2g"),
    			PrimaryZoneId:       *pulumi.String(fooZones.Zones[0].Id),
    			SecondaryZoneId:     *pulumi.String(fooZones.Zones[0].Id),
    			StorageSpace:        pulumi.Int(80),
    			SubnetId:            fooSubnet.ID(),
    			InstanceName:        pulumi.String("acc-test"),
    			LowerCaseTableNames: pulumi.String("1"),
    			ChargeInfo: &rds_mysql.InstanceChargeInfoArgs{
    				ChargeType: pulumi.String("PostPaid"),
    			},
    			Parameters: rds_mysql.InstanceParameterArray{
    				&rds_mysql.InstanceParameterArgs{
    					ParameterName:  pulumi.String("auto_increment_increment"),
    					ParameterValue: pulumi.String("2"),
    				},
    				&rds_mysql.InstanceParameterArgs{
    					ParameterName:  pulumi.String("auto_increment_offset"),
    					ParameterValue: pulumi.String("4"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = rds_mysql.NewDatabase(ctx, "fooDatabase", &rds_mysql.DatabaseArgs{
    			DbName:     pulumi.String("acc-test"),
    			InstanceId: fooInstance.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_ = rds_mysql.DatabasesOutput(ctx, rds_mysql.DatabasesOutputArgs{
    			DbName:     pulumi.String("acc-test"),
    			InstanceId: fooInstance.ID(),
    		}, nil)
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.volcengine.ecs.EcsFunctions;
    import com.pulumi.volcengine.ecs.inputs.ZonesArgs;
    import com.pulumi.volcengine.vpc.Vpc;
    import com.pulumi.volcengine.vpc.VpcArgs;
    import com.pulumi.volcengine.vpc.Subnet;
    import com.pulumi.volcengine.vpc.SubnetArgs;
    import com.pulumi.volcengine.rds_mysql.Instance;
    import com.pulumi.volcengine.rds_mysql.InstanceArgs;
    import com.pulumi.volcengine.rds_mysql.inputs.InstanceChargeInfoArgs;
    import com.pulumi.volcengine.rds_mysql.inputs.InstanceParameterArgs;
    import com.pulumi.volcengine.rds_mysql.Database;
    import com.pulumi.volcengine.rds_mysql.DatabaseArgs;
    import com.pulumi.volcengine.rds_mysql.Rds_mysqlFunctions;
    import com.pulumi.volcengine.rds_mysql.inputs.DatabasesArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var fooZones = EcsFunctions.Zones();
    
            var fooVpc = new Vpc("fooVpc", VpcArgs.builder()        
                .vpcName("acc-test-project1")
                .cidrBlock("172.16.0.0/16")
                .build());
    
            var fooSubnet = new Subnet("fooSubnet", SubnetArgs.builder()        
                .subnetName("acc-subnet-test-2")
                .cidrBlock("172.16.0.0/24")
                .zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
                .vpcId(fooVpc.id())
                .build());
    
            var fooInstance = new Instance("fooInstance", InstanceArgs.builder()        
                .dbEngineVersion("MySQL_5_7")
                .nodeSpec("rds.mysql.1c2g")
                .primaryZoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
                .secondaryZoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
                .storageSpace(80)
                .subnetId(fooSubnet.id())
                .instanceName("acc-test")
                .lowerCaseTableNames("1")
                .chargeInfo(InstanceChargeInfoArgs.builder()
                    .chargeType("PostPaid")
                    .build())
                .parameters(            
                    InstanceParameterArgs.builder()
                        .parameterName("auto_increment_increment")
                        .parameterValue("2")
                        .build(),
                    InstanceParameterArgs.builder()
                        .parameterName("auto_increment_offset")
                        .parameterValue("4")
                        .build())
                .build());
    
            var fooDatabase = new Database("fooDatabase", DatabaseArgs.builder()        
                .dbName("acc-test")
                .instanceId(fooInstance.id())
                .build());
    
            final var fooDatabases = Rds_mysqlFunctions.Databases(DatabasesArgs.builder()
                .dbName("acc-test")
                .instanceId(fooInstance.id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_volcengine as volcengine
    
    foo_zones = volcengine.ecs.zones()
    foo_vpc = volcengine.vpc.Vpc("fooVpc",
        vpc_name="acc-test-project1",
        cidr_block="172.16.0.0/16")
    foo_subnet = volcengine.vpc.Subnet("fooSubnet",
        subnet_name="acc-subnet-test-2",
        cidr_block="172.16.0.0/24",
        zone_id=foo_zones.zones[0].id,
        vpc_id=foo_vpc.id)
    foo_instance = volcengine.rds_mysql.Instance("fooInstance",
        db_engine_version="MySQL_5_7",
        node_spec="rds.mysql.1c2g",
        primary_zone_id=foo_zones.zones[0].id,
        secondary_zone_id=foo_zones.zones[0].id,
        storage_space=80,
        subnet_id=foo_subnet.id,
        instance_name="acc-test",
        lower_case_table_names="1",
        charge_info=volcengine.rds_mysql.InstanceChargeInfoArgs(
            charge_type="PostPaid",
        ),
        parameters=[
            volcengine.rds_mysql.InstanceParameterArgs(
                parameter_name="auto_increment_increment",
                parameter_value="2",
            ),
            volcengine.rds_mysql.InstanceParameterArgs(
                parameter_name="auto_increment_offset",
                parameter_value="4",
            ),
        ])
    foo_database = volcengine.rds_mysql.Database("fooDatabase",
        db_name="acc-test",
        instance_id=foo_instance.id)
    foo_databases = volcengine.rds_mysql.databases_output(db_name="acc-test",
        instance_id=foo_instance.id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@pulumi/volcengine";
    import * as volcengine from "@volcengine/pulumi";
    
    const fooZones = volcengine.ecs.Zones({});
    const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
        vpcName: "acc-test-project1",
        cidrBlock: "172.16.0.0/16",
    });
    const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
        subnetName: "acc-subnet-test-2",
        cidrBlock: "172.16.0.0/24",
        zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
        vpcId: fooVpc.id,
    });
    const fooInstance = new volcengine.rds_mysql.Instance("fooInstance", {
        dbEngineVersion: "MySQL_5_7",
        nodeSpec: "rds.mysql.1c2g",
        primaryZoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
        secondaryZoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
        storageSpace: 80,
        subnetId: fooSubnet.id,
        instanceName: "acc-test",
        lowerCaseTableNames: "1",
        chargeInfo: {
            chargeType: "PostPaid",
        },
        parameters: [
            {
                parameterName: "auto_increment_increment",
                parameterValue: "2",
            },
            {
                parameterName: "auto_increment_offset",
                parameterValue: "4",
            },
        ],
    });
    const fooDatabase = new volcengine.rds_mysql.Database("fooDatabase", {
        dbName: "acc-test",
        instanceId: fooInstance.id,
    });
    const fooDatabases = volcengine.rds_mysql.DatabasesOutput({
        dbName: "acc-test",
        instanceId: fooInstance.id,
    });
    
    resources:
      fooVpc:
        type: volcengine:vpc:Vpc
        properties:
          vpcName: acc-test-project1
          cidrBlock: 172.16.0.0/16
      fooSubnet:
        type: volcengine:vpc:Subnet
        properties:
          subnetName: acc-subnet-test-2
          cidrBlock: 172.16.0.0/24
          zoneId: ${fooZones.zones[0].id}
          vpcId: ${fooVpc.id}
      fooInstance:
        type: volcengine:rds_mysql:Instance
        properties:
          dbEngineVersion: MySQL_5_7
          nodeSpec: rds.mysql.1c2g
          primaryZoneId: ${fooZones.zones[0].id}
          secondaryZoneId: ${fooZones.zones[0].id}
          storageSpace: 80
          subnetId: ${fooSubnet.id}
          instanceName: acc-test
          lowerCaseTableNames: '1'
          chargeInfo:
            chargeType: PostPaid
          parameters:
            - parameterName: auto_increment_increment
              parameterValue: '2'
            - parameterName: auto_increment_offset
              parameterValue: '4'
      fooDatabase:
        type: volcengine:rds_mysql:Database
        properties:
          dbName: acc-test
          instanceId: ${fooInstance.id}
    variables:
      fooZones:
        fn::invoke:
          Function: volcengine:ecs:Zones
          Arguments: {}
      fooDatabases:
        fn::invoke:
          Function: volcengine:rds_mysql:Databases
          Arguments:
            dbName: acc-test
            instanceId: ${fooInstance.id}
    

    Using Databases

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function databases(args: DatabasesArgs, opts?: InvokeOptions): Promise<DatabasesResult>
    function databasesOutput(args: DatabasesOutputArgs, opts?: InvokeOptions): Output<DatabasesResult>
    def databases(db_name: Optional[str] = None,
                  instance_id: Optional[str] = None,
                  name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> DatabasesResult
    def databases_output(db_name: Optional[pulumi.Input[str]] = None,
                  instance_id: Optional[pulumi.Input[str]] = None,
                  name_regex: Optional[pulumi.Input[str]] = None,
                  output_file: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[DatabasesResult]
    func Databases(ctx *Context, args *DatabasesArgs, opts ...InvokeOption) (*DatabasesResult, error)
    func DatabasesOutput(ctx *Context, args *DatabasesOutputArgs, opts ...InvokeOption) DatabasesResultOutput
    public static class Databases 
    {
        public static Task<DatabasesResult> InvokeAsync(DatabasesArgs args, InvokeOptions? opts = null)
        public static Output<DatabasesResult> Invoke(DatabasesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<DatabasesResult> databases(DatabasesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: volcengine:rds_mysql:Databases
      arguments:
        # arguments dictionary

    The following arguments are supported:

    InstanceId string
    The id of the RDS instance.
    DbName string
    The name of the RDS database.
    NameRegex string
    A Name Regex of RDS database.
    OutputFile string
    File name where to save data source results.
    InstanceId string
    The id of the RDS instance.
    DbName string
    The name of the RDS database.
    NameRegex string
    A Name Regex of RDS database.
    OutputFile string
    File name where to save data source results.
    instanceId String
    The id of the RDS instance.
    dbName String
    The name of the RDS database.
    nameRegex String
    A Name Regex of RDS database.
    outputFile String
    File name where to save data source results.
    instanceId string
    The id of the RDS instance.
    dbName string
    The name of the RDS database.
    nameRegex string
    A Name Regex of RDS database.
    outputFile string
    File name where to save data source results.
    instance_id str
    The id of the RDS instance.
    db_name str
    The name of the RDS database.
    name_regex str
    A Name Regex of RDS database.
    output_file str
    File name where to save data source results.
    instanceId String
    The id of the RDS instance.
    dbName String
    The name of the RDS database.
    nameRegex String
    A Name Regex of RDS database.
    outputFile String
    File name where to save data source results.

    Databases Result

    The following output properties are available:

    Databases List<Volcengine.DatabasesDatabase>
    The collection of RDS instance account query.
    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceId string
    TotalCount int
    The total count of RDS database query.
    DbName string
    The name of the RDS database. This field supports fuzzy queries.
    NameRegex string
    OutputFile string
    Databases []DatabasesDatabase
    The collection of RDS instance account query.
    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceId string
    TotalCount int
    The total count of RDS database query.
    DbName string
    The name of the RDS database. This field supports fuzzy queries.
    NameRegex string
    OutputFile string
    databases List<DatabasesDatabase>
    The collection of RDS instance account query.
    id String
    The provider-assigned unique ID for this managed resource.
    instanceId String
    totalCount Integer
    The total count of RDS database query.
    dbName String
    The name of the RDS database. This field supports fuzzy queries.
    nameRegex String
    outputFile String
    databases DatabasesDatabase[]
    The collection of RDS instance account query.
    id string
    The provider-assigned unique ID for this managed resource.
    instanceId string
    totalCount number
    The total count of RDS database query.
    dbName string
    The name of the RDS database. This field supports fuzzy queries.
    nameRegex string
    outputFile string
    databases Sequence[DatabasesDatabase]
    The collection of RDS instance account query.
    id str
    The provider-assigned unique ID for this managed resource.
    instance_id str
    total_count int
    The total count of RDS database query.
    db_name str
    The name of the RDS database. This field supports fuzzy queries.
    name_regex str
    output_file str
    databases List<Property Map>
    The collection of RDS instance account query.
    id String
    The provider-assigned unique ID for this managed resource.
    instanceId String
    totalCount Number
    The total count of RDS database query.
    dbName String
    The name of the RDS database. This field supports fuzzy queries.
    nameRegex String
    outputFile String

    Supporting Types

    DatabasesDatabase

    CharacterSetName string
    The character set of the RDS database.
    DatabasePrivileges List<Volcengine.DatabasesDatabaseDatabasePrivilege>
    The privilege detail list of RDS mysql instance database.
    DbName string
    The name of the RDS database.
    CharacterSetName string
    The character set of the RDS database.
    DatabasePrivileges []DatabasesDatabaseDatabasePrivilege
    The privilege detail list of RDS mysql instance database.
    DbName string
    The name of the RDS database.
    characterSetName String
    The character set of the RDS database.
    databasePrivileges List<DatabasesDatabaseDatabasePrivilege>
    The privilege detail list of RDS mysql instance database.
    dbName String
    The name of the RDS database.
    characterSetName string
    The character set of the RDS database.
    databasePrivileges DatabasesDatabaseDatabasePrivilege[]
    The privilege detail list of RDS mysql instance database.
    dbName string
    The name of the RDS database.
    character_set_name str
    The character set of the RDS database.
    database_privileges Sequence[DatabasesDatabaseDatabasePrivilege]
    The privilege detail list of RDS mysql instance database.
    db_name str
    The name of the RDS database.
    characterSetName String
    The character set of the RDS database.
    databasePrivileges List<Property Map>
    The privilege detail list of RDS mysql instance database.
    dbName String
    The name of the RDS database.

    DatabasesDatabaseDatabasePrivilege

    AccountName string
    The name of account.
    AccountPrivilege string
    The privilege type of the account.
    AccountPrivilegeDetail string
    The privilege detail of the account.
    AccountName string
    The name of account.
    AccountPrivilege string
    The privilege type of the account.
    AccountPrivilegeDetail string
    The privilege detail of the account.
    accountName String
    The name of account.
    accountPrivilege String
    The privilege type of the account.
    accountPrivilegeDetail String
    The privilege detail of the account.
    accountName string
    The name of account.
    accountPrivilege string
    The privilege type of the account.
    accountPrivilegeDetail string
    The privilege detail of the account.
    account_name str
    The name of account.
    account_privilege str
    The privilege type of the account.
    account_privilege_detail str
    The privilege detail of the account.
    accountName String
    The name of account.
    accountPrivilege String
    The privilege type of the account.
    accountPrivilegeDetail String
    The privilege detail of the account.

    Package Details

    Repository
    volcengine volcengine/pulumi-volcengine
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the volcengine Terraform Provider.
    volcengine logo
    Volcengine v0.0.23 published on Wednesday, Jan 3, 2024 by Volcengine