1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. sql
  5. getBackupRun
Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi

gcp.sql.getBackupRun

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi

    Use this data source to get information about a Cloud SQL instance backup run.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const backup = gcp.sql.getBackupRun({
        instance: main.name,
        mostRecent: true,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    backup = gcp.sql.get_backup_run(instance=main["name"],
        most_recent=True)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := sql.GetBackupRun(ctx, &sql.GetBackupRunArgs{
    			Instance:   main.Name,
    			MostRecent: pulumi.BoolRef(true),
    		}, 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 backup = Gcp.Sql.GetBackupRun.Invoke(new()
        {
            Instance = main.Name,
            MostRecent = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.sql.SqlFunctions;
    import com.pulumi.gcp.sql.inputs.GetBackupRunArgs;
    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 backup = SqlFunctions.getBackupRun(GetBackupRunArgs.builder()
                .instance(main.name())
                .mostRecent(true)
                .build());
    
        }
    }
    
    variables:
      backup:
        fn::invoke:
          Function: gcp:sql:getBackupRun
          Arguments:
            instance: ${main.name}
            mostRecent: true
    

    Using getBackupRun

    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 getBackupRun(args: GetBackupRunArgs, opts?: InvokeOptions): Promise<GetBackupRunResult>
    function getBackupRunOutput(args: GetBackupRunOutputArgs, opts?: InvokeOptions): Output<GetBackupRunResult>
    def get_backup_run(backup_id: Optional[int] = None,
                       instance: Optional[str] = None,
                       most_recent: Optional[bool] = None,
                       project: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetBackupRunResult
    def get_backup_run_output(backup_id: Optional[pulumi.Input[int]] = None,
                       instance: Optional[pulumi.Input[str]] = None,
                       most_recent: Optional[pulumi.Input[bool]] = None,
                       project: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetBackupRunResult]
    func GetBackupRun(ctx *Context, args *GetBackupRunArgs, opts ...InvokeOption) (*GetBackupRunResult, error)
    func GetBackupRunOutput(ctx *Context, args *GetBackupRunOutputArgs, opts ...InvokeOption) GetBackupRunResultOutput

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

    public static class GetBackupRun 
    {
        public static Task<GetBackupRunResult> InvokeAsync(GetBackupRunArgs args, InvokeOptions? opts = null)
        public static Output<GetBackupRunResult> Invoke(GetBackupRunInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetBackupRunResult> getBackupRun(GetBackupRunArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:sql/getBackupRun:getBackupRun
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Instance string
    The name of the instance the backup is taken from.
    BackupId int
    The identifier for this backup run. Unique only for a specific Cloud SQL instance. If left empty and multiple backups exist for the instance, most_recent must be set to true.
    MostRecent bool
    Toggles use of the most recent backup run if multiple backups exist for a Cloud SQL instance.
    Project string
    The project to list instances for. If it is not provided, the provider project is used.
    Instance string
    The name of the instance the backup is taken from.
    BackupId int
    The identifier for this backup run. Unique only for a specific Cloud SQL instance. If left empty and multiple backups exist for the instance, most_recent must be set to true.
    MostRecent bool
    Toggles use of the most recent backup run if multiple backups exist for a Cloud SQL instance.
    Project string
    The project to list instances for. If it is not provided, the provider project is used.
    instance String
    The name of the instance the backup is taken from.
    backupId Integer
    The identifier for this backup run. Unique only for a specific Cloud SQL instance. If left empty and multiple backups exist for the instance, most_recent must be set to true.
    mostRecent Boolean
    Toggles use of the most recent backup run if multiple backups exist for a Cloud SQL instance.
    project String
    The project to list instances for. If it is not provided, the provider project is used.
    instance string
    The name of the instance the backup is taken from.
    backupId number
    The identifier for this backup run. Unique only for a specific Cloud SQL instance. If left empty and multiple backups exist for the instance, most_recent must be set to true.
    mostRecent boolean
    Toggles use of the most recent backup run if multiple backups exist for a Cloud SQL instance.
    project string
    The project to list instances for. If it is not provided, the provider project is used.
    instance str
    The name of the instance the backup is taken from.
    backup_id int
    The identifier for this backup run. Unique only for a specific Cloud SQL instance. If left empty and multiple backups exist for the instance, most_recent must be set to true.
    most_recent bool
    Toggles use of the most recent backup run if multiple backups exist for a Cloud SQL instance.
    project str
    The project to list instances for. If it is not provided, the provider project is used.
    instance String
    The name of the instance the backup is taken from.
    backupId Number
    The identifier for this backup run. Unique only for a specific Cloud SQL instance. If left empty and multiple backups exist for the instance, most_recent must be set to true.
    mostRecent Boolean
    Toggles use of the most recent backup run if multiple backups exist for a Cloud SQL instance.
    project String
    The project to list instances for. If it is not provided, the provider project is used.

    getBackupRun Result

    The following output properties are available:

    BackupId int
    Id string
    The provider-assigned unique ID for this managed resource.
    Instance string
    Location string
    Location of the backups.
    Project string
    StartTime string
    The time the backup operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
    Status string
    The status of this run. Refer to API reference for possible status values.
    MostRecent bool
    BackupId int
    Id string
    The provider-assigned unique ID for this managed resource.
    Instance string
    Location string
    Location of the backups.
    Project string
    StartTime string
    The time the backup operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
    Status string
    The status of this run. Refer to API reference for possible status values.
    MostRecent bool
    backupId Integer
    id String
    The provider-assigned unique ID for this managed resource.
    instance String
    location String
    Location of the backups.
    project String
    startTime String
    The time the backup operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
    status String
    The status of this run. Refer to API reference for possible status values.
    mostRecent Boolean
    backupId number
    id string
    The provider-assigned unique ID for this managed resource.
    instance string
    location string
    Location of the backups.
    project string
    startTime string
    The time the backup operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
    status string
    The status of this run. Refer to API reference for possible status values.
    mostRecent boolean
    backup_id int
    id str
    The provider-assigned unique ID for this managed resource.
    instance str
    location str
    Location of the backups.
    project str
    start_time str
    The time the backup operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
    status str
    The status of this run. Refer to API reference for possible status values.
    most_recent bool
    backupId Number
    id String
    The provider-assigned unique ID for this managed resource.
    instance String
    location String
    Location of the backups.
    project String
    startTime String
    The time the backup operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
    status String
    The status of this run. Refer to API reference for possible status values.
    mostRecent Boolean

    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 v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi