-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcluster_usermgr.go
788 lines (643 loc) · 19.5 KB
/
cluster_usermgr.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
package gocb
import (
"encoding/json"
"fmt"
"net/url"
"strings"
"time"
"github.com/google/uuid"
gocbcore "github.com/couchbase/gocbcore/v8"
)
// AuthDomain specifies the user domain of a specific user
type AuthDomain string
const (
// LocalDomain specifies users that are locally stored in Couchbase.
LocalDomain AuthDomain = "local"
// ExternalDomain specifies users that are externally stored
// (in LDAP for instance).
ExternalDomain AuthDomain = "external"
)
type jsonOrigin struct {
Type string `json:"type"`
Name string `json:"name"`
}
type jsonRole struct {
RoleName string `json:"role"`
BucketName string `json:"bucket_name"`
}
type jsonRoleDescription struct {
jsonRole
Name string `json:"string"`
Description string `json:"desc"`
}
type jsonRoleOrigins struct {
jsonRole
Origins []jsonOrigin
}
type jsonUserMetadata struct {
ID string `json:"id"`
Name string `json:"name"`
Roles []jsonRoleOrigins `json:"roles"`
Groups []string `json:"groups"`
Domain AuthDomain `json:"domain"`
ExternalGroups []string `json:"external_groups"`
PasswordChanged time.Time `json:"password_change_date"`
}
type jsonGroup struct {
Name string `json:"id"`
Description string `json:"description"`
Roles []jsonRole `json:"roles"`
LDAPGroupReference string `json:"ldap_group_ref"`
}
// Role represents a specific permission.
type Role struct {
Name string `json:"role"`
Bucket string `json:"bucket_name"`
}
func (ro *Role) fromData(data jsonRole) error {
ro.Name = data.RoleName
ro.Bucket = data.BucketName
return nil
}
// RoleAndDescription represents a role with its display name and description.
type RoleAndDescription struct {
Role
DisplayName string
Description string
}
func (rd *RoleAndDescription) fromData(data jsonRoleDescription) error {
err := rd.Role.fromData(data.jsonRole)
if err != nil {
return err
}
rd.DisplayName = data.Name
rd.Description = data.Description
return nil
}
// Origin indicates why a user has a specific role. Is the Origin Type is "user" then the role is assigned
// directly to the user. If the type is "group" then it means that the role has been inherited from the group
// identified by the Name field.
type Origin struct {
Type string
Name string
}
func (o *Origin) fromData(data jsonOrigin) error {
o.Type = data.Type
o.Name = data.Name
return nil
}
// RoleAndOrigins associates a role with its origins.
type RoleAndOrigins struct {
Role
Origins []Origin
}
func (ro *RoleAndOrigins) fromData(data jsonRoleOrigins) error {
err := ro.Role.fromData(data.jsonRole)
if err != nil {
return err
}
origins := make([]Origin, len(data.Origins))
for _, originData := range data.Origins {
var origin Origin
err := origin.fromData(originData)
if err != nil {
return err
}
origins = append(origins, origin)
}
ro.Origins = origins
return nil
}
// User represents a user which was retrieved from the server.
type User struct {
Username string
DisplayName string
// Roles are the roles assigned to the user that are of type "user".
Roles []Role
Groups []string
Password string
}
// UserAndMetadata represents a user and user meta-data from the server.
type UserAndMetadata struct {
User
Domain AuthDomain
// EffectiveRoles are all of the user's roles and the origins.
EffectiveRoles []RoleAndOrigins
ExternalGroups []string
PasswordChanged time.Time
}
func (um *UserAndMetadata) fromData(data jsonUserMetadata) error {
um.User.Username = data.ID
um.User.DisplayName = data.Name
um.User.Groups = data.Groups
um.ExternalGroups = data.ExternalGroups
um.Domain = data.Domain
um.PasswordChanged = data.PasswordChanged
var roles []Role
var effectiveRoles []RoleAndOrigins
for _, roleData := range data.Roles {
var effectiveRole RoleAndOrigins
err := effectiveRole.fromData(roleData)
if err != nil {
return err
}
effectiveRoles = append(effectiveRoles, effectiveRole)
role := effectiveRole.Role
if effectiveRole.Origins == nil {
roles = append(roles, role)
} else {
for _, origin := range effectiveRole.Origins {
if origin.Type == "user" {
roles = append(roles, role)
break
}
}
}
}
um.EffectiveRoles = effectiveRoles
um.User.Roles = roles
return nil
}
// Group represents a user group on the server.
type Group struct {
Name string
Description string
Roles []Role
LDAPGroupReference string
}
func (g *Group) fromData(data jsonGroup) error {
g.Name = data.Name
g.Description = data.Description
g.LDAPGroupReference = data.LDAPGroupReference
roles := make([]Role, len(data.Roles))
for roleIdx, roleData := range data.Roles {
err := roles[roleIdx].fromData(roleData)
if err != nil {
return err
}
}
g.Roles = roles
return nil
}
// UserManager provides methods for performing Couchbase user management.
type UserManager struct {
httpClient httpProvider
globalTimeout time.Duration
defaultRetryStrategy *retryStrategyWrapper
tracer requestTracer
}
// GetAllUsersOptions is the set of options available to the user manager GetAll operation.
type GetAllUsersOptions struct {
Timeout time.Duration
RetryStrategy RetryStrategy
DomainName string
}
// GetAllUsers returns a list of all the users from the cluster.
func (um *UserManager) GetAllUsers(opts *GetAllUsersOptions) ([]UserAndMetadata, error) {
if opts == nil {
opts = &GetAllUsersOptions{}
}
span := um.tracer.StartSpan("GetAllUsers", nil).
SetTag("couchbase.service", "mgmt")
defer span.Finish()
if opts.DomainName == "" {
opts.DomainName = string(LocalDomain)
}
retryStrategy := um.defaultRetryStrategy
if opts.RetryStrategy == nil {
retryStrategy = newRetryStrategyWrapper(opts.RetryStrategy)
}
req := &gocbcore.HTTPRequest{
Service: gocbcore.ServiceType(ServiceTypeManagement),
Method: "GET",
Path: fmt.Sprintf("/settings/rbac/users/%s", opts.DomainName),
IsIdempotent: true,
RetryStrategy: retryStrategy,
UniqueID: uuid.New().String(),
}
dspan := um.tracer.StartSpan("dispatch", span.Context())
resp, err := um.httpClient.DoHTTPRequest(req)
dspan.Finish()
if err != nil {
return nil, makeGenericHTTPError(err, req, resp)
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, makeHTTPBadStatusError("failed to get all users", req, resp)
}
var usersData []jsonUserMetadata
jsonDec := json.NewDecoder(resp.Body)
err = jsonDec.Decode(&usersData)
if err != nil {
return nil, err
}
err = resp.Body.Close()
if err != nil {
logDebugf("Failed to close socket (%s)", err)
}
users := make([]UserAndMetadata, len(usersData))
for userIdx, userData := range usersData {
err := users[userIdx].fromData(userData)
if err != nil {
return nil, err
}
}
return users, nil
}
// GetUserOptions is the set of options available to the user manager Get operation.
type GetUserOptions struct {
Timeout time.Duration
RetryStrategy RetryStrategy
DomainName string
}
// GetUser returns the data for a particular user
func (um *UserManager) GetUser(name string, opts *GetUserOptions) (*UserAndMetadata, error) {
if opts == nil {
opts = &GetUserOptions{}
}
span := um.tracer.StartSpan("GetUser", nil).
SetTag("couchbase.service", "mgmt")
defer span.Finish()
if opts.DomainName == "" {
opts.DomainName = string(LocalDomain)
}
retryStrategy := um.defaultRetryStrategy
if opts.RetryStrategy == nil {
retryStrategy = newRetryStrategyWrapper(opts.RetryStrategy)
}
req := &gocbcore.HTTPRequest{
Service: gocbcore.ServiceType(ServiceTypeManagement),
Method: "GET",
Path: fmt.Sprintf("/settings/rbac/users/%s/%s", opts.DomainName, name),
IsIdempotent: true,
RetryStrategy: retryStrategy,
UniqueID: uuid.New().String(),
}
dspan := um.tracer.StartSpan("dispatch", span.Context())
resp, err := um.httpClient.DoHTTPRequest(req)
dspan.Finish()
if err != nil {
return nil, makeGenericHTTPError(err, req, resp)
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, makeHTTPBadStatusError("failed to get user", req, resp)
}
var userData jsonUserMetadata
jsonDec := json.NewDecoder(resp.Body)
err = jsonDec.Decode(&userData)
if err != nil {
return nil, err
}
err = resp.Body.Close()
if err != nil {
logDebugf("Failed to close socket (%s)", err)
}
var user UserAndMetadata
err = user.fromData(userData)
if err != nil {
return nil, err
}
return &user, nil
}
// UpsertUserOptions is the set of options available to the user manager Upsert operation.
type UpsertUserOptions struct {
Timeout time.Duration
RetryStrategy RetryStrategy
DomainName string
}
// UpsertUser updates a built-in RBAC user on the cluster.
func (um *UserManager) UpsertUser(user User, opts *UpsertUserOptions) error {
if opts == nil {
opts = &UpsertUserOptions{}
}
span := um.tracer.StartSpan("UpsertUser", nil).
SetTag("couchbase.service", "mgmt")
defer span.Finish()
if opts.DomainName == "" {
opts.DomainName = string(LocalDomain)
}
retryStrategy := um.defaultRetryStrategy
if opts.RetryStrategy == nil {
retryStrategy = newRetryStrategyWrapper(opts.RetryStrategy)
}
var reqRoleStrs []string
for _, roleData := range user.Roles {
reqRoleStrs = append(reqRoleStrs, fmt.Sprintf("%s[%s]", roleData.Name, roleData.Bucket))
}
reqForm := make(url.Values)
reqForm.Add("name", user.DisplayName)
if user.Password != "" {
reqForm.Add("password", user.Password)
}
if len(user.Groups) > 0 {
reqForm.Add("groups", strings.Join(user.Groups, ","))
}
reqForm.Add("roles", strings.Join(reqRoleStrs, ","))
req := &gocbcore.HTTPRequest{
Service: gocbcore.ServiceType(ServiceTypeManagement),
Method: "PUT",
Path: fmt.Sprintf("/settings/rbac/users/%s/%s", opts.DomainName, user.Username),
Body: []byte(reqForm.Encode()),
ContentType: "application/x-www-form-urlencoded",
RetryStrategy: retryStrategy,
UniqueID: uuid.New().String(),
}
dspan := um.tracer.StartSpan("dispatch", span.Context())
resp, err := um.httpClient.DoHTTPRequest(req)
dspan.Finish()
if err != nil {
return makeGenericHTTPError(err, req, resp)
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return makeHTTPBadStatusError("failed to upsert user", req, resp)
}
return nil
}
// DropUserOptions is the set of options available to the user manager Drop operation.
type DropUserOptions struct {
Timeout time.Duration
RetryStrategy RetryStrategy
DomainName string
}
// DropUser removes a built-in RBAC user on the cluster.
func (um *UserManager) DropUser(name string, opts *DropUserOptions) error {
if opts == nil {
opts = &DropUserOptions{}
}
span := um.tracer.StartSpan("DropUser", nil).
SetTag("couchbase.service", "mgmt")
defer span.Finish()
if opts.DomainName == "" {
opts.DomainName = string(LocalDomain)
}
retryStrategy := um.defaultRetryStrategy
if opts.RetryStrategy == nil {
retryStrategy = newRetryStrategyWrapper(opts.RetryStrategy)
}
req := &gocbcore.HTTPRequest{
Service: gocbcore.ServiceType(ServiceTypeManagement),
Method: "DELETE",
Path: fmt.Sprintf("/settings/rbac/users/%s/%s", opts.DomainName, name),
RetryStrategy: retryStrategy,
UniqueID: uuid.New().String(),
}
dspan := um.tracer.StartSpan("dispatch", span.Context())
resp, err := um.httpClient.DoHTTPRequest(req)
dspan.Finish()
if err != nil {
return makeGenericHTTPError(err, req, resp)
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return makeHTTPBadStatusError("failed to drop user", req, resp)
}
return nil
}
// GetRolesOptions is the set of options available to the user manager GetRoles operation.
type GetRolesOptions struct {
Timeout time.Duration
RetryStrategy RetryStrategy
}
// GetRoles lists the roles supported by the cluster.
func (um *UserManager) GetRoles(opts *GetRolesOptions) ([]RoleAndDescription, error) {
if opts == nil {
opts = &GetRolesOptions{}
}
span := um.tracer.StartSpan("GetRoles", nil).
SetTag("couchbase.service", "mgmt")
defer span.Finish()
retryStrategy := um.defaultRetryStrategy
if opts.RetryStrategy == nil {
retryStrategy = newRetryStrategyWrapper(opts.RetryStrategy)
}
req := &gocbcore.HTTPRequest{
Service: gocbcore.ServiceType(ServiceTypeManagement),
Method: "GET",
Path: "/settings/rbac/roles",
RetryStrategy: retryStrategy,
IsIdempotent: true,
UniqueID: uuid.New().String(),
}
dspan := um.tracer.StartSpan("dispatch", span.Context())
resp, err := um.httpClient.DoHTTPRequest(req)
dspan.Finish()
if err != nil {
return nil, makeGenericHTTPError(err, req, resp)
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, makeHTTPBadStatusError("failed to get roles", req, resp)
}
var roleDatas []jsonRoleDescription
jsonDec := json.NewDecoder(resp.Body)
err = jsonDec.Decode(&roleDatas)
if err != nil {
return nil, err
}
err = resp.Body.Close()
if err != nil {
logDebugf("Failed to close socket (%s)", err)
}
roles := make([]RoleAndDescription, len(roleDatas))
for roleIdx, roleData := range roleDatas {
err := roles[roleIdx].fromData(roleData)
if err != nil {
return nil, err
}
}
return roles, nil
}
// GetGroupOptions is the set of options available to the group manager Get operation.
type GetGroupOptions struct {
Timeout time.Duration
RetryStrategy RetryStrategy
}
// GetGroup fetches a single group from the server.
func (um *UserManager) GetGroup(groupName string, opts *GetGroupOptions) (*Group, error) {
if groupName == "" {
return nil, makeInvalidArgumentsError("groupName cannot be empty")
}
if opts == nil {
opts = &GetGroupOptions{}
}
span := um.tracer.StartSpan("GetGroup", nil).
SetTag("couchbase.service", "mgmt")
defer span.Finish()
retryStrategy := um.defaultRetryStrategy
if opts.RetryStrategy == nil {
retryStrategy = newRetryStrategyWrapper(opts.RetryStrategy)
}
req := &gocbcore.HTTPRequest{
Service: gocbcore.ServiceType(ServiceTypeManagement),
Method: "GET",
Path: fmt.Sprintf("/settings/rbac/groups/%s", groupName),
RetryStrategy: retryStrategy,
IsIdempotent: true,
UniqueID: uuid.New().String(),
}
dspan := um.tracer.StartSpan("dispatch", span.Context())
resp, err := um.httpClient.DoHTTPRequest(req)
dspan.Finish()
if err != nil {
return nil, makeGenericHTTPError(err, req, resp)
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, makeHTTPBadStatusError("failed to get group", req, resp)
}
var groupData jsonGroup
jsonDec := json.NewDecoder(resp.Body)
err = jsonDec.Decode(&groupData)
if err != nil {
return nil, err
}
err = resp.Body.Close()
if err != nil {
logDebugf("Failed to close socket (%s)", err)
}
var group Group
err = group.fromData(groupData)
if err != nil {
return nil, err
}
return &group, nil
}
// GetAllGroupsOptions is the set of options available to the group manager GetAll operation.
type GetAllGroupsOptions struct {
Timeout time.Duration
RetryStrategy RetryStrategy
}
// GetAllGroups fetches all groups from the server.
func (um *UserManager) GetAllGroups(opts *GetAllGroupsOptions) ([]Group, error) {
if opts == nil {
opts = &GetAllGroupsOptions{}
}
span := um.tracer.StartSpan("GetAllGroups", nil).
SetTag("couchbase.service", "mgmt")
defer span.Finish()
retryStrategy := um.defaultRetryStrategy
if opts.RetryStrategy == nil {
retryStrategy = newRetryStrategyWrapper(opts.RetryStrategy)
}
req := &gocbcore.HTTPRequest{
Service: gocbcore.ServiceType(ServiceTypeManagement),
Method: "GET",
Path: "/settings/rbac/groups",
RetryStrategy: retryStrategy,
IsIdempotent: true,
UniqueID: uuid.New().String(),
}
dspan := um.tracer.StartSpan("dispatch", span.Context())
resp, err := um.httpClient.DoHTTPRequest(req)
dspan.Finish()
if err != nil {
return nil, makeGenericHTTPError(err, req, resp)
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, makeHTTPBadStatusError("failed to get all groups", req, resp)
}
var groupDatas []jsonGroup
jsonDec := json.NewDecoder(resp.Body)
err = jsonDec.Decode(&groupDatas)
if err != nil {
return nil, err
}
err = resp.Body.Close()
if err != nil {
logDebugf("Failed to close socket (%s)", err)
}
groups := make([]Group, len(groupDatas))
for groupIdx, groupData := range groupDatas {
err = groups[groupIdx].fromData(groupData)
if err != nil {
return nil, err
}
}
return groups, nil
}
// UpsertGroupOptions is the set of options available to the group manager Upsert operation.
type UpsertGroupOptions struct {
Timeout time.Duration
RetryStrategy RetryStrategy
}
// UpsertGroup creates, or updates, a group on the server.
func (um *UserManager) UpsertGroup(group Group, opts *UpsertGroupOptions) error {
if group.Name == "" {
return makeInvalidArgumentsError("group name cannot be empty")
}
if opts == nil {
opts = &UpsertGroupOptions{}
}
span := um.tracer.StartSpan("UpsertGroup", nil).
SetTag("couchbase.service", "mgmt")
defer span.Finish()
retryStrategy := um.defaultRetryStrategy
if opts.RetryStrategy == nil {
retryStrategy = newRetryStrategyWrapper(opts.RetryStrategy)
}
var reqRoleStrs []string
for _, roleData := range group.Roles {
if roleData.Bucket == "" {
reqRoleStrs = append(reqRoleStrs, fmt.Sprintf("%s", roleData.Name))
} else {
reqRoleStrs = append(reqRoleStrs, fmt.Sprintf("%s[%s]", roleData.Name, roleData.Bucket))
}
}
reqForm := make(url.Values)
reqForm.Add("description", group.Description)
reqForm.Add("ldap_group_ref", group.LDAPGroupReference)
reqForm.Add("roles", strings.Join(reqRoleStrs, ","))
req := &gocbcore.HTTPRequest{
Service: gocbcore.ServiceType(ServiceTypeManagement),
Method: "PUT",
Path: fmt.Sprintf("/settings/rbac/groups/%s", group.Name),
Body: []byte(reqForm.Encode()),
ContentType: "application/x-www-form-urlencoded",
RetryStrategy: retryStrategy,
UniqueID: uuid.New().String(),
}
dspan := um.tracer.StartSpan("dispatch", span.Context())
resp, err := um.httpClient.DoHTTPRequest(req)
dspan.Finish()
if err != nil {
return makeGenericHTTPError(err, req, resp)
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return makeHTTPBadStatusError("failed to upsert group", req, resp)
}
return nil
}
// DropGroupOptions is the set of options available to the group manager Drop operation.
type DropGroupOptions struct {
Timeout time.Duration
RetryStrategy RetryStrategy
}
// DropGroup removes a group from the server.
func (um *UserManager) DropGroup(groupName string, opts *DropGroupOptions) error {
if groupName == "" {
return makeInvalidArgumentsError("groupName cannot be empty")
}
if opts == nil {
opts = &DropGroupOptions{}
}
span := um.tracer.StartSpan("DropGroup", nil).
SetTag("couchbase.service", "mgmt")
defer span.Finish()
retryStrategy := um.defaultRetryStrategy
if opts.RetryStrategy == nil {
retryStrategy = newRetryStrategyWrapper(opts.RetryStrategy)
}
req := &gocbcore.HTTPRequest{
Service: gocbcore.ServiceType(ServiceTypeManagement),
Method: "DELETE",
Path: fmt.Sprintf("/settings/rbac/groups/%s", groupName),
RetryStrategy: retryStrategy,
UniqueID: uuid.New().String(),
}
dspan := um.tracer.StartSpan("dispatch", span.Context())
resp, err := um.httpClient.DoHTTPRequest(req)
dspan.Finish()
if err != nil {
return makeGenericHTTPError(err, req, resp)
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return makeHTTPBadStatusError("failed to drop group", req, resp)
}
return nil
}