1. Packages
  2. MSSQL
  3. API Docs
  4. getDatabases
Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse

mssql.getDatabases

Explore with Pulumi AI

mssql logo
Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse

    Obtains information about all databases found in SQL Server instance.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Mssql = Pulumi.Mssql;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Mssql.GetDatabases.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["databases"] = example.Apply(getDatabasesResult => getDatabasesResult.Databases),
        };
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-mssql/sdk/go/mssql"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := mssql.GetDatabases(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("databases", example.Databases)
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.mssql.MssqlFunctions;
    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 example = MssqlFunctions.getDatabases();
    
            ctx.export("databases", example.applyValue(getDatabasesResult -> getDatabasesResult.databases()));
        }
    }
    
    import pulumi
    import pulumi_mssql as mssql
    
    example = mssql.get_databases()
    pulumi.export("databases", example.databases)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as mssql from "@pulumi/mssql";
    
    const example = mssql.getDatabases({});
    export const databases = example.then(example => example.databases);
    
    variables:
      example:
        fn::invoke:
          Function: mssql:getDatabases
          Arguments: {}
    outputs:
      databases: ${example.databases}
    

    Using getDatabases

    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 getDatabases(opts?: InvokeOptions): Promise<GetDatabasesResult>
    function getDatabasesOutput(opts?: InvokeOptions): Output<GetDatabasesResult>
    def get_databases(opts: Optional[InvokeOptions] = None) -> GetDatabasesResult
    def get_databases_output(opts: Optional[InvokeOptions] = None) -> Output[GetDatabasesResult]
    func GetDatabases(ctx *Context, opts ...InvokeOption) (*GetDatabasesResult, error)
    func GetDatabasesOutput(ctx *Context, opts ...InvokeOption) GetDatabasesResultOutput

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

    public static class GetDatabases 
    {
        public static Task<GetDatabasesResult> InvokeAsync(InvokeOptions? opts = null)
        public static Output<GetDatabasesResult> Invoke(InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetDatabasesResult> getDatabases(InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: mssql:index/getDatabases:getDatabases
      arguments:
        # arguments dictionary

    getDatabases Result

    The following output properties are available:

    Databases List<Pulumiverse.Mssql.Outputs.GetDatabasesDatabase>
    Set of database objects
    Id string
    ID of the resource used only internally by the provider.
    Databases []GetDatabasesDatabase
    Set of database objects
    Id string
    ID of the resource used only internally by the provider.
    databases List<GetDatabasesDatabase>
    Set of database objects
    id String
    ID of the resource used only internally by the provider.
    databases GetDatabasesDatabase[]
    Set of database objects
    id string
    ID of the resource used only internally by the provider.
    databases Sequence[GetDatabasesDatabase]
    Set of database objects
    id str
    ID of the resource used only internally by the provider.
    databases List<Property Map>
    Set of database objects
    id String
    ID of the resource used only internally by the provider.

    Supporting Types

    GetDatabasesDatabase

    Collation string
    Default collation name. Can be either a Windows collation name or a SQL collation name.
    Id string
    Database ID. Can be retrieved using SELECT DB_ID('<db_name>').
    Name string
    Database name. Must follow Regular Identifiers rules.
    Collation string
    Default collation name. Can be either a Windows collation name or a SQL collation name.
    Id string
    Database ID. Can be retrieved using SELECT DB_ID('<db_name>').
    Name string
    Database name. Must follow Regular Identifiers rules.
    collation String
    Default collation name. Can be either a Windows collation name or a SQL collation name.
    id String
    Database ID. Can be retrieved using SELECT DB_ID('<db_name>').
    name String
    Database name. Must follow Regular Identifiers rules.
    collation string
    Default collation name. Can be either a Windows collation name or a SQL collation name.
    id string
    Database ID. Can be retrieved using SELECT DB_ID('<db_name>').
    name string
    Database name. Must follow Regular Identifiers rules.
    collation str
    Default collation name. Can be either a Windows collation name or a SQL collation name.
    id str
    Database ID. Can be retrieved using SELECT DB_ID('<db_name>').
    name str
    Database name. Must follow Regular Identifiers rules.
    collation String
    Default collation name. Can be either a Windows collation name or a SQL collation name.
    id String
    Database ID. Can be retrieved using SELECT DB_ID('<db_name>').
    name String
    Database name. Must follow Regular Identifiers rules.

    Package Details

    Repository
    mssql pulumiverse/pulumi-mssql
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the mssql Terraform Provider.
    mssql logo
    Microsoft SQL Server v0.0.8 published on Wednesday, Nov 1, 2023 by pulumiverse