Files
decort-golang-sdk/pkg/cloudbroker/pcidevice/access_revoke.go
dayterr b3fccfb000 v1.16.1
v1.16.1
2026-08-28 16:50:10 +03:00

39 lines
1.0 KiB
Go

package pcidevice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// AccessRevoke struct to revoke access from a PCI device
type AccessRevokeRequest struct {
DeviceID uint64 `url:"device_id" json:"device_id" validate:"required"`
AccountIDs []uint64 `url:"account_ids" json:"account_ids" validate:"required"`
}
// AccessRevoke revokes access from a PCI device
func (p PCIDevice) AccessRevoke(ctx context.Context, req AccessRevokeRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/pcidevice/access_revoke"
res, err := p.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}