github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dds/v3/job/Get.go (about) 1 package job 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 // Get TODO: merge to common job 9 func Get(client *golangsdk.ServiceClient, id string) (*JobDDSInstance, error) { 10 // GET /v3/{project_id}/jobs 11 raw, err := client.Get(client.ServiceURL("jobs?id="+id), nil, nil) 12 if err != nil { 13 return nil, err 14 } 15 16 var res JobDDSInstance 17 err = extract.IntoStructPtr(raw.Body, &res, "job") 18 return &res, err 19 } 20 21 type JobDDSInstance struct { 22 // Task ID 23 Id string `json:"id"` 24 // Task name 25 Name string `json:"name"` 26 // Task execution status 27 // 28 // Valid value: 29 // Running: The task is being executed. 30 // Completed: The task is successfully executed. 31 // Failed: The task fails to be executed. 32 Status string `json:"status"` 33 // Creation time in the "yyyy-mm-ddThh:mm:ssZ" format. 34 // 35 // T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. 36 Created string `json:"created"` 37 // End time in the "yyyy-mm-ddThh:mm:ssZ" format. 38 // 39 // T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. 40 Ended string `json:"ended"` 41 // Task execution progress 42 // 43 // NOTE: 44 // The execution progress (such as "60%", indicating the task execution progress is 60%) is displayed only when the task is being executed. Otherwise, "" is returned. 45 Progress string `json:"progress"` 46 // Task failure information. 47 FailReason string `json:"fail_reason"` 48 // Instance on which the task is executed. 49 Instance Instance `json:"instance"` 50 } 51 52 type Instance struct { 53 // Instance ID 54 Id string `json:"id"` 55 // DB instance name 56 Name string `json:"name"` 57 }