github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dcs/v1/backups/ListRestoreRecords.go (about)

     1  package backups
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  func ListRestoreRecords(client *golangsdk.ServiceClient, instancesId string, opts ListBackupOpts) (*ListRestoreRecordsResponse, error) {
     9  	url, err := golangsdk.NewURLBuilder().WithEndpoints("instances", instancesId, "restores").WithQueryParams(&opts).Build()
    10  	if err != nil {
    11  		return nil, err
    12  	}
    13  
    14  	raw, err := client.Get(client.ServiceURL(url.String()), nil, nil)
    15  	if err != nil {
    16  		return nil, err
    17  	}
    18  
    19  	var res ListRestoreRecordsResponse
    20  	err = extract.Into(raw.Body, &res)
    21  	return &res, err
    22  }
    23  
    24  type ListRestoreRecordsResponse struct {
    25  	// Array of the restoration records.
    26  	RestoreRecordResponse []InstanceRestoreInfo `json:"restore_record_response"`
    27  	// Number of obtained backup records.
    28  	TotalNum int `json:"total_num"`
    29  }
    30  
    31  type InstanceRestoreInfo struct {
    32  	// ID of the backup record
    33  	BackupId string `json:"backup_id"`
    34  	// ID of the restoration record
    35  	RestoreId string `json:"restore_id"`
    36  	// Name of the backup record
    37  	BackupName string `json:"backup_name"`
    38  	// Time at which DCS instance restoration completed
    39  	UpdatedAt string `json:"updated_at"`
    40  	// Description of DCS instance restoration
    41  	RestoreRemark string `json:"restore_remark"`
    42  	// Time at which the restoration task is created
    43  	CreatedAt string `json:"created_at"`
    44  	// Restoration progress
    45  	Progress string `json:"progress"`
    46  	// Error code returned if DCS instance restoration fails.
    47  	ErrorCode string `json:"error_code"`
    48  	// Name of the restoration record
    49  	RestoreName string `json:"restore_name"`
    50  	// Description of DCS instance backup
    51  	BackupRemark string `json:"backup_remark"`
    52  	// Restoration status
    53  	// waiting: DCS instance restoration is waiting to begin.
    54  	// restoring: DCS instance restoration is in progress.
    55  	// succeed: DCS instance restoration succeeded.
    56  	// failed: DCS instance restoration failed.
    57  	Status string `json:"status"`
    58  	// Source instance ID.
    59  	SourceInstanceID string `json:"sourceInstanceID"`
    60  	// Source instance name.
    61  	SourceInstanceName string `json:"sourceInstanceName"`
    62  }