MCPcopy
hub / github.com/netbirdio/netbird / delete

Method delete

management/server/idp/zitadel.go:574–607  ·  view source on GitHub ↗

delete perform Delete requests.

(ctx context.Context, resource string)

Source from the content-addressed store, hash-verified

572
573// delete perform Delete requests.
574func (zm *ZitadelManager) delete(ctx context.Context, resource string) error {
575 jwtToken, err := zm.credentials.Authenticate(ctx)
576 if err != nil {
577 return err
578 }
579
580 reqURL := fmt.Sprintf("%s/%s", zm.managementEndpoint, resource)
581 req, err := http.NewRequest(http.MethodDelete, reqURL, nil)
582 if err != nil {
583 return err
584 }
585 req.Header.Add("authorization", "Bearer "+jwtToken.AccessToken)
586 req.Header.Add("content-type", "application/json")
587
588 resp, err := zm.httpClient.Do(req)
589 if err != nil {
590 if zm.appMetrics != nil {
591 zm.appMetrics.IDPMetrics().CountRequestError()
592 }
593
594 return err
595 }
596 defer resp.Body.Close()
597
598 if resp.StatusCode != http.StatusOK {
599 if zm.appMetrics != nil {
600 zm.appMetrics.IDPMetrics().CountRequestStatusError()
601 }
602
603 return fmt.Errorf("unable to get %s, statusCode %d", reqURL, resp.StatusCode)
604 }
605
606 return nil
607}
608
609// get perform Get requests.
610func (zm *ZitadelManager) get(ctx context.Context, resource string, q url.Values) ([]byte, error) {

Callers 1

DeleteUserMethod · 0.95

Calls 9

NewRequestMethod · 0.80
CountRequestErrorMethod · 0.80
ErrorfMethod · 0.80
AuthenticateMethod · 0.65
AddMethod · 0.65
DoMethod · 0.65
IDPMetricsMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected