v9.0.0
This commit is contained in:
42
pkg/cloudbroker/apiaccess/desc_update.go
Normal file
42
pkg/cloudbroker/apiaccess/desc_update.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package apiaccess
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v9/internal/validators"
|
||||
)
|
||||
|
||||
// DescUpdateRequest struct for updating apiaccess group description.
|
||||
type DescUpdateRequest struct {
|
||||
// APIAccess group ID.
|
||||
// Required: true
|
||||
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
|
||||
|
||||
// New description to set for the apiaccess group.
|
||||
// Required: true
|
||||
Description string `url:"desc" json:"desc" validate:"required"`
|
||||
}
|
||||
|
||||
// DescUpdate sets a new text description of the apiaccess group.
|
||||
func (a APIAccess) DescUpdate(ctx context.Context, req DescUpdateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/apiaccess/descUpdate"
|
||||
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user