1. Packages
  2. CockroachDB Cloud
  3. API Docs
  4. getConnectionString
CockroachDB v0.6.0 published on Friday, Nov 1, 2024 by pulumiverse

cockroach.getConnectionString

Explore with Pulumi AI

cockroach logo
CockroachDB v0.6.0 published on Friday, Nov 1, 2024 by pulumiverse

    Generic connection string for a cluster.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cockroach from "@pulumi/cockroach";
    
    const config = new pulumi.Config();
    const clusterId = config.require("clusterId");
    const sqlUserName = config.require("sqlUserName");
    const sqlUserPassword = config.require("sqlUserPassword");
    const database = config.require("database");
    const os = config.require("os");
    const cockroach = cockroach.getConnectionString({
        id: clusterId,
        sqlUser: sqlUserName,
        password: sqlUserPassword,
        database: database,
        os: os,
    });
    
    import pulumi
    import pulumi_cockroach as cockroach
    
    config = pulumi.Config()
    cluster_id = config.require("clusterId")
    sql_user_name = config.require("sqlUserName")
    sql_user_password = config.require("sqlUserPassword")
    database = config.require("database")
    os = config.require("os")
    cockroach = cockroach.get_connection_string(id=cluster_id,
        sql_user=sql_user_name,
        password=sql_user_password,
        database=database,
        os=os)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    	"github.com/pulumiverse/pulumi-cockroach/sdk/go/cockroach"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		clusterId := cfg.Require("clusterId")
    		sqlUserName := cfg.Require("sqlUserName")
    		sqlUserPassword := cfg.Require("sqlUserPassword")
    		database := cfg.Require("database")
    		os := cfg.Require("os")
    		_, err := cockroach.GetConnectionString(ctx, &cockroach.GetConnectionStringArgs{
    			Id:       clusterId,
    			SqlUser:  pulumi.StringRef(sqlUserName),
    			Password: pulumi.StringRef(sqlUserPassword),
    			Database: pulumi.StringRef(database),
    			Os:       pulumi.StringRef(os),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cockroach = Pulumi.Cockroach;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var clusterId = config.Require("clusterId");
        var sqlUserName = config.Require("sqlUserName");
        var sqlUserPassword = config.Require("sqlUserPassword");
        var database = config.Require("database");
        var os = config.Require("os");
        var cockroach = Cockroach.GetConnectionString.Invoke(new()
        {
            Id = clusterId,
            SqlUser = sqlUserName,
            Password = sqlUserPassword,
            Database = database,
            Os = os,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cockroach.CockroachFunctions;
    import com.pulumi.cockroach.inputs.GetConnectionStringArgs;
    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 config = ctx.config();
            final var clusterId = config.get("clusterId");
            final var sqlUserName = config.get("sqlUserName");
            final var sqlUserPassword = config.get("sqlUserPassword");
            final var database = config.get("database");
            final var os = config.get("os");
            final var cockroach = CockroachFunctions.getConnectionString(GetConnectionStringArgs.builder()
                .id(clusterId)
                .sqlUser(sqlUserName)
                .password(sqlUserPassword)
                .database(database)
                .os(os)
                .build());
    
        }
    }
    
    configuration:
      clusterId:
        type: string
      sqlUserName:
        type: string
      sqlUserPassword:
        type: string
      database:
        type: string
      os:
        type: string
    variables:
      cockroach:
        fn::invoke:
          Function: cockroach:getConnectionString
          Arguments:
            id: ${clusterId}
            sqlUser: ${sqlUserName}
            password: ${sqlUserPassword}
            database: ${database}
            os: ${os}
    

    Using getConnectionString

    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 getConnectionString(args: GetConnectionStringArgs, opts?: InvokeOptions): Promise<GetConnectionStringResult>
    function getConnectionStringOutput(args: GetConnectionStringOutputArgs, opts?: InvokeOptions): Output<GetConnectionStringResult>
    def get_connection_string(database: Optional[str] = None,
                              id: Optional[str] = None,
                              os: Optional[str] = None,
                              password: Optional[str] = None,
                              sql_user: Optional[str] = None,
                              opts: Optional[InvokeOptions] = None) -> GetConnectionStringResult
    def get_connection_string_output(database: Optional[pulumi.Input[str]] = None,
                              id: Optional[pulumi.Input[str]] = None,
                              os: Optional[pulumi.Input[str]] = None,
                              password: Optional[pulumi.Input[str]] = None,
                              sql_user: Optional[pulumi.Input[str]] = None,
                              opts: Optional[InvokeOptions] = None) -> Output[GetConnectionStringResult]
    func GetConnectionString(ctx *Context, args *GetConnectionStringArgs, opts ...InvokeOption) (*GetConnectionStringResult, error)
    func GetConnectionStringOutput(ctx *Context, args *GetConnectionStringOutputArgs, opts ...InvokeOption) GetConnectionStringResultOutput

    > Note: This function is named GetConnectionString in the Go SDK.

    public static class GetConnectionString 
    {
        public static Task<GetConnectionStringResult> InvokeAsync(GetConnectionStringArgs args, InvokeOptions? opts = null)
        public static Output<GetConnectionStringResult> Invoke(GetConnectionStringInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetConnectionStringResult> getConnectionString(GetConnectionStringArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: cockroach:index/getConnectionString:getConnectionString
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    Database string
    Os string
    Password string
    SqlUser string
    Id string
    Database string
    Os string
    Password string
    SqlUser string
    id String
    database String
    os String
    password String
    sqlUser String
    id string
    database string
    os string
    password string
    sqlUser string
    id str
    database str
    os str
    password str
    sql_user str
    id String
    database String
    os String
    password String
    sqlUser String

    getConnectionString Result

    The following output properties are available:

    Supporting Types

    GetConnectionStringConnectionParams

    Database string
    Database value to use in a connection URL.
    Host string
    Host value to use in a connection URL.
    Password string
    Password value to use in a connection URL.
    Port string
    Port value to use in a connection URL.
    Username string
    Username value to use in a connection URL.
    Database string
    Database value to use in a connection URL.
    Host string
    Host value to use in a connection URL.
    Password string
    Password value to use in a connection URL.
    Port string
    Port value to use in a connection URL.
    Username string
    Username value to use in a connection URL.
    database String
    Database value to use in a connection URL.
    host String
    Host value to use in a connection URL.
    password String
    Password value to use in a connection URL.
    port String
    Port value to use in a connection URL.
    username String
    Username value to use in a connection URL.
    database string
    Database value to use in a connection URL.
    host string
    Host value to use in a connection URL.
    password string
    Password value to use in a connection URL.
    port string
    Port value to use in a connection URL.
    username string
    Username value to use in a connection URL.
    database str
    Database value to use in a connection URL.
    host str
    Host value to use in a connection URL.
    password str
    Password value to use in a connection URL.
    port str
    Port value to use in a connection URL.
    username str
    Username value to use in a connection URL.
    database String
    Database value to use in a connection URL.
    host String
    Host value to use in a connection URL.
    password String
    Password value to use in a connection URL.
    port String
    Port value to use in a connection URL.
    username String
    Username value to use in a connection URL.

    Package Details

    Repository
    cockroach pulumiverse/pulumi-cockroach
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cockroach Terraform Provider.
    cockroach logo
    CockroachDB v0.6.0 published on Friday, Nov 1, 2024 by pulumiverse