setURLQueryAttributes modifies the supplied URL's query string with the client's current target and project.
(apiURL *neturl.URL)
| 334 | |
| 335 | // setURLQueryAttributes modifies the supplied URL's query string with the client's current target and project. |
| 336 | func (r *ProtocolIncus) setURLQueryAttributes(apiURL *neturl.URL) { |
| 337 | // Extract query fields and update for cluster targeting or project |
| 338 | values := apiURL.Query() |
| 339 | if r.clusterTarget != "" { |
| 340 | if values.Get("target") == "" { |
| 341 | values.Set("target", r.clusterTarget) |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | if r.project != "" { |
| 346 | if values.Get("project") == "" && values.Get("all-projects") == "" { |
| 347 | values.Set("project", r.project) |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | apiURL.RawQuery = values.Encode() |
| 352 | } |
| 353 | |
| 354 | func (r *ProtocolIncus) setQueryAttributes(uri string) (string, error) { |
| 355 | // Parse the full URI |
no test coverage detected