func DeleteResource(ctx context.Context, kcResourceID string, authzEndpoint string, protectionAPIToken string) error {
	log.Debug(ctx, map[string]interface{}{
		"kc_resource_id": kcResourceID,
	}, "Deleting the Keycloak resource")

	req, err := http.NewRequest("DELETE", authzEndpoint+"/"+kcResourceID, nil)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err": err.Error(),
		}, "Unable to crete http request")
		return errors.NewInternalError("unable to crete http request " + err.Error())
	}
	req.Header.Add("Authorization", "Bearer "+protectionAPIToken)
	res, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"kc_resource_id": kcResourceID,
			"err":            err.Error(),
		}, "Unable to delete the Keycloak resource")
		return errors.NewInternalError("Unable to delete the Keycloak resource " + err.Error())
	}
	if res.StatusCode != http.StatusNoContent {
		log.Error(ctx, map[string]interface{}{
			"kc_resource_id":  kcResourceID,
			"response_status": res.Status,
			"response_body":   rest.ReadBody(res.Body),
		}, "Unable to delete the Keycloak resource")
		return errors.NewInternalError("Unable to delete the Keycloak resource. Response status: " + res.Status + ". Responce body: " + rest.ReadBody(res.Body))
	}

	log.Debug(ctx, map[string]interface{}{
		"kc_resource_id": kcResourceID,
	}, "Keycloak resource deleted")

	return nil
}
// DeleteResource deletes the Keycloak resource assosiated with the space
DeleteResource deletes the Keycloak resource assosiated with the space
// DeleteResource deletes the Keycloak resource assosiated with the space
func DeleteResource(ctx context.Context, kcResourceID string, authzEndpoint string, protectionAPIToken string) error {
	log.Debug(ctx, map[string]interface{}{
		"kc_resource_id": kcResourceID,
	}, "Deleting the Keycloak resource")
	req, err := http.NewRequest("DELETE", authzEndpoint+"/"+kcResourceID, nil)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err": err.Error(),
		}, "Unable to crete http request")
		return errors.NewInternalError("unable to crete http request " + err.Error())
	}
	req.Header.Add("Authorization", "Bearer "+protectionAPIToken)
	res, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"kc_resource_id": kcResourceID,
			"err":            err.Error(),
		}, "Unable to delete the Keycloak resource")
		return errors.NewInternalError("Unable to delete the Keycloak resource " + err.Error())
	}
	if res.StatusCode != http.StatusNoContent {
		log.Error(ctx, map[string]interface{}{
			"kc_resource_id":  kcResourceID,
			"response_status": res.Status,
			"response_body":   rest.ReadBody(res.Body),
		}, "Unable to delete the Keycloak resource")
		return errors.NewInternalError("Unable to delete the Keycloak resource. Response status: " + res.Status + ". Responce body: " + rest.ReadBody(res.Body))
	}
	log.Debug(ctx, map[string]interface{}{
		"kc_resource_id": kcResourceID,
	}, "Keycloak resource deleted")
	return nil
}
func DeleteResource ( ctx context . Context , kcResourceID string , authzEndpoint string , protectionAPIToken string ) error { log . Debug ( ctx , map [ string ] interface { } { " " : kcResourceID , } , " " ) req , err := http . NewRequest ( " " , authzEndpoint + " " + kcResourceID , nil ) if err != nil { log . Error ( ctx , map [ string ] interface { } { " " : err . Error ( ) , } , " " ) return errors . NewInternalError ( " " + err . Error ( ) ) } req . Header . Add ( " " , " " + protectionAPIToken ) res , err := http . DefaultClient . Do ( req ) if err != nil { log . Error ( ctx , map [ string ] interface { } { " " : kcResourceID , " " : err . Error ( ) , } , " " ) return errors . NewInternalError ( " " + err . Error ( ) ) } if res . StatusCode != http . StatusNoContent { log . Error ( ctx , map [ string ] interface { } { " " : kcResourceID , " " : res . Status , " " : rest . ReadBody ( res . Body ) , } , " " ) return errors . NewInternalError ( " " + res . Status + " " + rest . ReadBody ( res . Body ) ) } log . Debug ( ctx , map [ string ] interface { } { " " : kcResourceID , } , " " ) return nil }
DeleteResource deletes the Keycloak resource assosiated with the space
DeleteResource deletes the Keycloak resource assosiated with the space