Skip to content

Commit

Permalink
feat(GaussDBforMySQL): gaussdb mysql instance support version (chnsz#691
Browse files Browse the repository at this point in the history
)
  • Loading branch information
houpeng80 authored Oct 17, 2024
1 parent 516de11 commit f223049
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
10 changes: 10 additions & 0 deletions openstack/taurusdb/v3/instances/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,3 +749,13 @@ func UpdatePrivateDnsName(client *golangsdk.ServiceClient, instanceId string, op
})
return
}

func GetVersion(client *golangsdk.ServiceClient, instanceId string) (r GetVersionResult) {
url := versionURL(client, instanceId)

_, r.Err = client.Get(url, &r.Body, &golangsdk.RequestOpts{
MoreHeaders: requestOpts.MoreHeaders,
})

return
}
22 changes: 22 additions & 0 deletions openstack/taurusdb/v3/instances/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,3 +289,25 @@ func (r GetSecondLevelMonitoringResult) Extract() (*SecondLevelMonitoring, error
err := r.ExtractInto(&secondLevelMonitoring)
return &secondLevelMonitoring, err
}

type Version struct {
UpgradeFlag bool `json:"upgrade_flag"`
Datastore Datastore `json:"datastore"`
}

type Datastore struct {
CurrentVersion string `json:"current_version"`
CurrentKernelVersion string `json:"current_kernel_version"`
LatestVersion string `json:"latest_version"`
LatestKernelVersion string `json:"latest_kernel_version"`
}

type GetVersionResult struct {
commonResult
}

func (r GetVersionResult) Extract() (*Version, error) {
var version Version
err := r.ExtractInto(&version)
return &version, err
}
4 changes: 4 additions & 0 deletions openstack/taurusdb/v3/instances/urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func secondLevelMonitoringURL(c *golangsdk.ServiceClient, instanceID string) str
return c.ServiceURL("instances", instanceID, "monitor-policy")
}

func versionURL(c *golangsdk.ServiceClient, instanceID string) string {
return c.ServiceURL("instances", instanceID, "database-version")
}

func jobURL(sc *golangsdk.ServiceClient) string {
return sc.ServiceURL("jobs")
}
Expand Down

0 comments on commit f223049

Please sign in to comment.