github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dcs/v1/backups/ListBackupRecords.go (about) 1 package backups 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 type ListBackupOpts struct { 9 // Start sequence number of the backup record that is to be queried. By default, this parameter is set to 1. 10 Start int32 `q:"start"` 11 // Start time of the period to be queried. Format: yyyyMMddHHmmss, for example, 20170718235959. 12 BeginTime string `q:"begin_time"` 13 // End time of the period to be queried. Format: yyyyMMddHHmmss, for example, 20170718235959. 14 EndTime string `q:"end_time"` 15 // Number of backup records displayed on each page. The minimum value of this parameter is 1. 16 // If this parameter is not set, 10 backup records are displayed on each page by default. 17 Limit int32 `q:"limit"` 18 } 19 20 func ListBackupRecords(client *golangsdk.ServiceClient, instancesId string, opts ListBackupOpts) (*ListBackupRecordsResponse, error) { 21 url, err := golangsdk.NewURLBuilder().WithEndpoints("instances", instancesId, "backups").WithQueryParams(&opts).Build() 22 if err != nil { 23 return nil, err 24 } 25 26 raw, err := client.Get(client.ServiceURL(url.String()), nil, nil) 27 if err != nil { 28 return nil, err 29 } 30 31 var res ListBackupRecordsResponse 32 err = extract.Into(raw.Body, &res) 33 return &res, err 34 } 35 36 type ListBackupRecordsResponse struct { 37 // Number of obtained backup records. 38 TotalNum int `json:"total_num"` 39 // Array of the backup records. For details about backup_record_response, 40 BackupRecordResponse []BackupRecordResponse `json:"backup_record_response"` 41 } 42 43 type BackupRecordResponse struct { 44 // ID of the backup record 45 BackupId string `json:"backup_id"` 46 // Time segment in which DCS instance backup was performed 47 Period string `json:"period"` 48 // Name of the backup record 49 BackupName string `json:"backup_name"` 50 // DCS instance ID 51 InstanceId string `json:"instance_id"` 52 // Size of the backup file. Unit: byte. 53 Size int64 `json:"size"` 54 // Backup type. Options: 55 // manual: manual backup 56 // auto: automatic backup 57 BackupType string `json:"backup_type"` 58 // Time at which the backup task is created 59 CreatedAt string `json:"created_at"` 60 // Time at which DCS instance backup is completed 61 UpdatedAt string `json:"updated_at"` 62 // Backup progress 63 Progress string `json:"progress"` 64 // Error code returned if DCS instance backup fails. 65 ErrorCode string `json:"error_code"` 66 // Description of DCS instance backup 67 Remark string `json:"remark"` 68 // Backup status. Options: 69 // waiting: DCS instance restoration is waiting to begin. 70 // backuping: DCS instance backup is in progress. 71 // succeed: DCS instance backup succeeded. 72 // failed: DCS instance backup failed. 73 // expired: The backup file expires. 74 // deleted: The backup file has been deleted manually. 75 Status string `json:"status"` 76 // An indicator of whether restoration is supported. Options: TRUE or FALSE. 77 IsSupportRestore string `json:"is_support_restore"` 78 // Time at which the backup starts. 79 ExecutionAt string `json:"execution_at"` 80 // Backup format. 81 BackupFormat string `json:"backup_format"` 82 }