github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/cce/v3/addons/urls.go (about) 1 package addons 2 3 import ( 4 "net/url" 5 "strings" 6 7 "github.com/huaweicloud/golangsdk" 8 ) 9 10 const ( 11 rootPath = "addons" 12 ) 13 14 func rootURL(client *golangsdk.ServiceClient, cluster_id string) string { 15 return CCEServiceURL(client, cluster_id, rootPath) 16 } 17 18 func resourceURL(client *golangsdk.ServiceClient, id, cluster_id string) string { 19 return CCEServiceURL(client, cluster_id, rootPath, id+"?cluster_id="+cluster_id) 20 } 21 22 func resourceListURL(client *golangsdk.ServiceClient, cluster_id string) string { 23 return CCEServiceURL(client, cluster_id, rootPath+"?cluster_id="+cluster_id) 24 } 25 26 func CCEServiceURL(client *golangsdk.ServiceClient, cluster_id string, parts ...string) string { 27 u, _ := url.Parse(client.ResourceBaseURL()) 28 u.Host = cluster_id + "." + u.Host 29 rbUrl := u.String() 30 return rbUrl + strings.Join(parts, "/") 31 }