1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. spanner
  5. getDatabase
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

gcp.spanner.getDatabase

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

    Get a spanner database from Google Cloud by its name and instance name.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const foo = gcp.spanner.getDatabase({
        name: "foo",
        instance: instance.name,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    foo = gcp.spanner.get_database(name="foo",
        instance=instance["name"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/spanner"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := spanner.LookupDatabase(ctx, &spanner.LookupDatabaseArgs{
    			Name:     "foo",
    			Instance: instance.Name,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var foo = Gcp.Spanner.GetDatabase.Invoke(new()
        {
            Name = "foo",
            Instance = instance.Name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.spanner.SpannerFunctions;
    import com.pulumi.gcp.spanner.inputs.GetDatabaseArgs;
    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 foo = SpannerFunctions.getDatabase(GetDatabaseArgs.builder()
                .name("foo")
                .instance(instance.name())
                .build());
    
        }
    }
    
    variables:
      foo:
        fn::invoke:
          Function: gcp:spanner:getDatabase
          Arguments:
            name: foo
            instance: ${instance.name}
    

    Using getDatabase

    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 getDatabase(args: GetDatabaseArgs, opts?: InvokeOptions): Promise<GetDatabaseResult>
    function getDatabaseOutput(args: GetDatabaseOutputArgs, opts?: InvokeOptions): Output<GetDatabaseResult>
    def get_database(instance: Optional[str] = None,
                     name: Optional[str] = None,
                     project: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetDatabaseResult
    def get_database_output(instance: Optional[pulumi.Input[str]] = None,
                     name: Optional[pulumi.Input[str]] = None,
                     project: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetDatabaseResult]
    func LookupDatabase(ctx *Context, args *LookupDatabaseArgs, opts ...InvokeOption) (*LookupDatabaseResult, error)
    func LookupDatabaseOutput(ctx *Context, args *LookupDatabaseOutputArgs, opts ...InvokeOption) LookupDatabaseResultOutput

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

    public static class GetDatabase 
    {
        public static Task<GetDatabaseResult> InvokeAsync(GetDatabaseArgs args, InvokeOptions? opts = null)
        public static Output<GetDatabaseResult> Invoke(GetDatabaseInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetDatabaseResult> getDatabase(GetDatabaseArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:spanner/getDatabase:getDatabase
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Instance string
    The name of the database's spanner instance.


    Name string
    The name of the spanner database.
    Project string
    The project in which the resource belongs. If it is not provided, the provider project is used.
    Instance string
    The name of the database's spanner instance.


    Name string
    The name of the spanner database.
    Project string
    The project in which the resource belongs. If it is not provided, the provider project is used.
    instance String
    The name of the database's spanner instance.


    name String
    The name of the spanner database.
    project String
    The project in which the resource belongs. If it is not provided, the provider project is used.
    instance string
    The name of the database's spanner instance.


    name string
    The name of the spanner database.
    project string
    The project in which the resource belongs. If it is not provided, the provider project is used.
    instance str
    The name of the database's spanner instance.


    name str
    The name of the spanner database.
    project str
    The project in which the resource belongs. If it is not provided, the provider project is used.
    instance String
    The name of the database's spanner instance.


    name String
    The name of the spanner database.
    project String
    The project in which the resource belongs. If it is not provided, the provider project is used.

    getDatabase Result

    The following output properties are available:

    DatabaseDialect string
    Ddls List<string>
    DeletionProtection bool
    EnableDropProtection bool
    EncryptionConfigs List<GetDatabaseEncryptionConfig>
    Id string
    The provider-assigned unique ID for this managed resource.
    Instance string
    Name string
    State string
    VersionRetentionPeriod string
    Project string
    DatabaseDialect string
    Ddls []string
    DeletionProtection bool
    EnableDropProtection bool
    EncryptionConfigs []GetDatabaseEncryptionConfig
    Id string
    The provider-assigned unique ID for this managed resource.
    Instance string
    Name string
    State string
    VersionRetentionPeriod string
    Project string
    databaseDialect String
    ddls List<String>
    deletionProtection Boolean
    enableDropProtection Boolean
    encryptionConfigs List<GetDatabaseEncryptionConfig>
    id String
    The provider-assigned unique ID for this managed resource.
    instance String
    name String
    state String
    versionRetentionPeriod String
    project String
    databaseDialect string
    ddls string[]
    deletionProtection boolean
    enableDropProtection boolean
    encryptionConfigs GetDatabaseEncryptionConfig[]
    id string
    The provider-assigned unique ID for this managed resource.
    instance string
    name string
    state string
    versionRetentionPeriod string
    project string
    database_dialect str
    ddls Sequence[str]
    deletion_protection bool
    enable_drop_protection bool
    encryption_configs Sequence[GetDatabaseEncryptionConfig]
    id str
    The provider-assigned unique ID for this managed resource.
    instance str
    name str
    state str
    version_retention_period str
    project str
    databaseDialect String
    ddls List<String>
    deletionProtection Boolean
    enableDropProtection Boolean
    encryptionConfigs List<Property Map>
    id String
    The provider-assigned unique ID for this managed resource.
    instance String
    name String
    state String
    versionRetentionPeriod String
    project String

    Supporting Types

    GetDatabaseEncryptionConfig

    KmsKeyName string
    Fully qualified name of the KMS key to use to encrypt this database. This key must exist in the same location as the Spanner Database.
    KmsKeyNames List<string>
    Fully qualified name of the KMS keys to use to encrypt this database. The keys must exist in the same locations as the Spanner Database.
    KmsKeyName string
    Fully qualified name of the KMS key to use to encrypt this database. This key must exist in the same location as the Spanner Database.
    KmsKeyNames []string
    Fully qualified name of the KMS keys to use to encrypt this database. The keys must exist in the same locations as the Spanner Database.
    kmsKeyName String
    Fully qualified name of the KMS key to use to encrypt this database. This key must exist in the same location as the Spanner Database.
    kmsKeyNames List<String>
    Fully qualified name of the KMS keys to use to encrypt this database. The keys must exist in the same locations as the Spanner Database.
    kmsKeyName string
    Fully qualified name of the KMS key to use to encrypt this database. This key must exist in the same location as the Spanner Database.
    kmsKeyNames string[]
    Fully qualified name of the KMS keys to use to encrypt this database. The keys must exist in the same locations as the Spanner Database.
    kms_key_name str
    Fully qualified name of the KMS key to use to encrypt this database. This key must exist in the same location as the Spanner Database.
    kms_key_names Sequence[str]
    Fully qualified name of the KMS keys to use to encrypt this database. The keys must exist in the same locations as the Spanner Database.
    kmsKeyName String
    Fully qualified name of the KMS key to use to encrypt this database. This key must exist in the same location as the Spanner Database.
    kmsKeyNames List<String>
    Fully qualified name of the KMS keys to use to encrypt this database. The keys must exist in the same locations as the Spanner Database.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi