Normalize replaces WorkspaceAndAgent with WorkspaceNameOrID and AgentNameOrID. This must be called before Validate.
()
| 105 | // Normalize replaces WorkspaceAndAgent with WorkspaceNameOrID and |
| 106 | // AgentNameOrID. This must be called before Validate. |
| 107 | func (r Request) Normalize() Request { |
| 108 | req := r |
| 109 | if req.WorkspaceAndAgent != "" { |
| 110 | // workspace.agent |
| 111 | workspaceAndAgent := strings.SplitN(req.WorkspaceAndAgent, ".", 2) |
| 112 | req.WorkspaceAndAgent = "" |
| 113 | req.WorkspaceNameOrID = workspaceAndAgent[0] |
| 114 | if len(workspaceAndAgent) > 1 { |
| 115 | req.AgentNameOrID = workspaceAndAgent[1] |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | if !strings.HasSuffix(req.BasePath, "/") { |
| 120 | req.BasePath += "/" |
| 121 | } |
| 122 | |
| 123 | return req |
| 124 | } |
| 125 | |
| 126 | // Check ensures the request is correct and contains the necessary |
| 127 | // parameters. |
no outgoing calls