feat: add delete tenant command
This commit is contained in:
26
pkg/client/delete_tenant.go
Normal file
26
pkg/client/delete_tenant.go
Normal file
@ -0,0 +1,26 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func (c *Client) DeleteTenant(ctx context.Context, tenantID TenantID, funcs ...OptionFunc) (TenantID, error) {
|
||||
response := withResponse[struct {
|
||||
TenantID string `json:"tenantId"`
|
||||
}]()
|
||||
|
||||
path := fmt.Sprintf("/api/v1/tenants/%s", tenantID)
|
||||
|
||||
if err := c.apiDelete(ctx, path, nil, &response, funcs...); err != nil {
|
||||
return "", errors.WithStack(err)
|
||||
}
|
||||
|
||||
if response.Error != nil {
|
||||
return "", errors.WithStack(response.Error)
|
||||
}
|
||||
|
||||
return TenantID(response.Data.TenantID), nil
|
||||
}
|
Reference in New Issue
Block a user