MCPcopy
hub / github.com/lxc/incus / setURLQueryAttributes

Method setURLQueryAttributes

client/incus.go:336–352  ·  view source on GitHub ↗

setURLQueryAttributes modifies the supplied URL's query string with the client's current target and project.

(apiURL *neturl.URL)

Source from the content-addressed store, hash-verified

334
335// setURLQueryAttributes modifies the supplied URL's query string with the client's current target and project.
336func (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
354func (r *ProtocolIncus) setQueryAttributes(uri string) (string, error) {
355 // Parse the full URI

Calls 2

GetMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected