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.
decort-golang-sdk/pkg/cloudbroker/account/disable.go

39 lines
825 B

package account
import (
"context"
"net/http"
"strconv"
3 years ago
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
2 years ago
// DisableRequest struct to disable account
type DisableRequest struct {
3 years ago
// ID of account
// Required: true
3 years ago
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
}
3 years ago
// Disable disables an account
func (a Account) Disable(ctx context.Context, req DisableRequest) (bool, error) {
3 years ago
err := validators.ValidateRequest(req)
if err != nil {
2 years ago
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/disable"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}