This commit is contained in:
stSolo
2022-12-22 17:56:47 +03:00
parent 8712561853
commit d4b1ab7133
672 changed files with 28509 additions and 4419 deletions

View File

@@ -7,13 +7,22 @@ import (
"strconv"
)
// Request struct for revoke access to account
type DeleteUserRequest struct {
AccountID uint64 `url:"accountId"`
UserName string `url:"username"`
RecursiveDelete bool `url:"recursivedelete,omitempty"`
// ID of the account
// Required: true
AccountID uint64 `url:"accountId"`
// ID or emailaddress of the user to remove
// Required: true
UserName string `url:"username"`
// Recursively revoke access rights from owned cloudspaces and vmachines
// Required: false
RecursiveDelete bool `url:"recursivedelete,omitempty"`
}
func (arq DeleteUserRequest) Validate() error {
func (arq DeleteUserRequest) validate() error {
if arq.AccountID == 0 {
return errors.New("validation-error: field AccountID must be set")
}
@@ -24,8 +33,9 @@ func (arq DeleteUserRequest) Validate() error {
return nil
}
// DeleteUser revokes user access from the account
func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, error) {
err := req.Validate()
err := req.validate()
if err != nil {
return false, err
}
@@ -41,5 +51,6 @@ func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, e
if err != nil {
return false, err
}
return result, nil
}