MCPcopy Index your code
hub / github.com/cloudflare/cloudflared / GetManagementToken

Method GetManagementToken

cfapi/tunnel.go:162–178  ·  view source on GitHub ↗
(tunnelID uuid.UUID, res ManagementResource)

Source from the content-addressed store, hash-verified

160}
161
162func (r *RESTClient) GetManagementToken(tunnelID uuid.UUID, res ManagementResource) (token string, err error) {
163 endpoint := r.baseEndpoints.accountLevel
164 endpoint.Path = path.Join(endpoint.Path, managementEndpointPath(tunnelID, res))
165
166 resp, err := r.sendRequest("POST", endpoint, nil)
167 if err != nil {
168 return "", errors.Wrap(err, "REST request failed")
169 }
170 defer resp.Body.Close()
171
172 if resp.StatusCode == http.StatusOK {
173 err = parseResponse(resp.Body, &token)
174 return token, err
175 }
176
177 return "", r.statusCodeToError("get tunnel token", resp)
178}
179
180func (r *RESTClient) DeleteTunnel(tunnelID uuid.UUID, cascade bool) error {
181 endpoint := r.baseEndpoints.accountLevel

Callers

nothing calls this directly

Calls 5

sendRequestMethod · 0.95
statusCodeToErrorMethod · 0.95
managementEndpointPathFunction · 0.85
parseResponseFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected