This commit is contained in:
2024-04-16 14:26:06 +03:00
parent bc264c4d90
commit e7c968797b
298 changed files with 11066 additions and 398 deletions

View File

@@ -8,8 +8,8 @@ type Audit struct {
}
// Builder for audit endpoint
func New(client interfaces.Caller) *Audit {
func New(client interfaces.Caller) *Audit{
return &Audit{
client: client,
}
}
}

View File

@@ -43,4 +43,4 @@ func (a Audit) GetRawLinkedJobs(ctx context.Context, req LinkedJobsRequest) ([]b
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
}
}

View File

@@ -4,6 +4,8 @@ import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// ListRequest struct to give list of account audits
@@ -25,9 +27,17 @@ type ListRequest struct {
// Required: false
Call string `url:"call,omitempty" json:"call,omitempty"`
// Find by HTTP status code
// Find by HTTP min status code
// Required: false
StatusCode uint64 `url:"statusCode,omitempty" json:"statusCode,omitempty"`
MinStatusCode uint64 `url:"minStatusCode,omitempty" json:"minStatusCode,omitempty"`
// Find by HTTP max status code
// Required: false
MaxStatusCode uint64 `url:"maxStatusCode,omitempty" json:"maxStatusCode,omitempty"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Page number
// Required: false
@@ -40,6 +50,7 @@ type ListRequest struct {
// List gets audit records for the specified account object
func (a Audit) List(ctx context.Context, req ListRequest) (*ListAudits, error) {
res, err := a.ListRaw(ctx, req)
if err != nil {
return nil, err
@@ -57,6 +68,11 @@ func (a Audit) List(ctx context.Context, req ListRequest) (*ListAudits, error) {
// ListRaw gets list of audit records an array of bytes
func (a Audit) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/audit/list"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)

View File

@@ -82,6 +82,9 @@ type ItemLinkedJobs struct {
// CMD
CMD string `json:"cmd"`
// GUID
GUID string `json:"guid"`
// NID
NID uint64 `json:"nid"`