package trunk import ( "context" "net/http" "strconv" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) // AccessRevoke struct to grant access to a trunk to some accounts type AccessRevokeRequest struct { // ID of the trunk to disable // Required: true TrunkID uint64 `url:"id" json:"id" validate:"required"` // IDs of the accounts to revoke access from // Required: true AccountIDs []uint64 `url:"account_ids" json:"account_ids" validate:"required"` } // AccessRevoke revokes access to a trunk from accounts func (t Trunk) AccessRevoke(ctx context.Context, req AccessRevokeRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { return false, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/trunk/access_revoke" res, err := t.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 }