github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/gaussdb/v3/ShowJobInfo.go (about) 1 package v3 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 type taskIdStr struct { 9 Id string `q:"id"` 10 } 11 12 func ShowJobInfo(client *golangsdk.ServiceClient, taskId string) (*GetJobInfoDetail, error) { 13 url, err := golangsdk.NewURLBuilder().WithEndpoints("jobs").WithQueryParams(&taskIdStr{Id: taskId}).Build() 14 if err != nil { 15 return nil, err 16 } 17 18 // GET https://{Endpoint}/mysql/v3/{project_id}/jobs?id={id} 19 raw, err := client.Get(client.ServiceURL(url.String()), nil, nil) 20 if err != nil { 21 return nil, err 22 } 23 24 var res GetJobInfoDetail 25 err = extract.IntoStructPtr(raw.Body, &res, "job") 26 return &res, err 27 } 28 29 type GetJobInfoDetail struct { 30 // Task ID 31 Id string `json:"id"` 32 // Task name 33 Name string `json:"name"` 34 // Task execution status Value: 35 // Running: The task is being executed. 36 // Completed: The task is successfully executed. 37 // Failed: The task failed to be executed. 38 Status string `json:"status"` 39 // Creation time in the "yyyy-mm-ddThh:mm:ssZ" format. 40 // T is the separator between the calendar and the hourly notation of time. 41 // Z indicates the time zone offset. 42 // For example, for French Winter Time (FWT), the time offset is shown as +0200. 43 // The value is empty unless the instance creation is complete. 44 Created string `json:"created"` 45 // End time in the "yyyy-mm-ddThh:mm:ssZ" format. 46 // T is the separator between the calendar and the hourly notation of time. 47 // Z indicates the time zone offset. 48 // For example, for French Winter Time (FWT), the time offset is shown as +0200. 49 // The value is empty unless the instance creation is complete. 50 Ended string `json:"ended,omitempty"` 51 // Task execution progress. The execution progress (such as 60%) is displayed only when the task is being executed. Otherwise, "" is returned. 52 Process string `json:"process,omitempty"` 53 // Instance information of the task with the specified ID 54 Instance JobInstanceInfo `json:"instance"` 55 // Displayed information varies depending on tasks. 56 Entities JobEntities `json:"entities,omitempty"` 57 // Task failure information 58 FailReason string `json:"fail_reason,omitempty"` 59 } 60 61 type JobInstanceInfo struct { 62 // Instance ID 63 Id string `json:"id"` 64 // Instance name 65 Name string `json:"name"` 66 } 67 68 type JobEntities struct { 69 // Instance queried in the task 70 Instance JobInstance `json:"instance"` 71 // Resource ID involved in a task 72 ResourceIds []string `json:"resource_ids"` 73 } 74 75 type JobInstance struct { 76 // Instance connection address 77 Endpoint string `json:"endpoint"` 78 // Instance type 79 Type string `json:"type"` 80 // Database information. 81 Datastore JobDatastore `json:"datastore"` 82 } 83 84 type JobDatastore struct { 85 // DB engine 86 Type string `json:"type"` 87 // DB engine version 88 Version string `json:"version"` 89 }