You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
685 B
35 lines
685 B
package account
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"net/http"
|
|
)
|
|
|
|
type DisableAccountsRequest struct {
|
|
AccountIDs []uint64 `url:"accountIds,omitempty"`
|
|
}
|
|
|
|
func (arq DisableAccountsRequest) Validate() error {
|
|
if arq.AccountIDs == nil || len(arq.AccountIDs) == 0 {
|
|
return errors.New("validation-error: field AccountIDs must be set")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (a Account) DisableAccounts(ctx context.Context, req DisableAccountsRequest) (bool, error) {
|
|
err := req.Validate()
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
|
|
url := "/cloudbroker/account/disableAccounts"
|
|
|
|
_, err = a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
|
|
return true, nil
|
|
}
|