v1.16.6
v1.16.6
This commit is contained in:
@@ -29,6 +29,11 @@ type CreateRequest struct {
|
||||
// one of: bvs, decs3o
|
||||
// Required: false
|
||||
Provider string `url:"provider,omitempty" json:"provider,omitempty" validate:"omitempty,userProvider"`
|
||||
|
||||
// Whether we create a service account
|
||||
// Default value: false
|
||||
// Required: false
|
||||
ServiceAccount interface{} `url:"serviceaccount,omitempty" json:"serviceaccount,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
// Create creates a user.
|
||||
|
||||
42
pkg/cloudbroker/user/update_service_account.go
Normal file
42
pkg/cloudbroker/user/update_service_account.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// UpdateServiceAccountRequest to update ServiceAccount field
|
||||
type UpdateServiceAccountRequest struct {
|
||||
// User ID
|
||||
// Required: true
|
||||
UserID string `url:"user_id" json:"user_id" validate:"required"`
|
||||
|
||||
// Whether the account is a service account
|
||||
// Required: true
|
||||
ServiceAccount interface{} `url:"serviceaccount" json:"serviceaccount" validate:"required,isBool"`
|
||||
}
|
||||
|
||||
// UpdateServiceAccount updates ServiceAccount field
|
||||
func (u User) UpdateServiceAccount(ctx context.Context, req UpdateServiceAccountRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/update_service_account"
|
||||
|
||||
res, err := u.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
|
||||
}
|
||||
Reference in New Issue
Block a user