change api and apply new schema

This commit is contained in:
aliamerj
2025-08-26 13:00:28 +03:00
parent 1fe6295d44
commit 667dfdfcc3
4 changed files with 118 additions and 87 deletions

View File

@@ -37,23 +37,25 @@ components:
JobRequest:
type: object
properties:
type:
type: string
description: The type of job to execute
example: bundle
enum: [ "bundle" ]
parameters:
workload:
type: object
description: Key-value parameters required for the job
additionalProperties: true
example:
bundle_for: true
bundle_for_time: 5
log_file_count: 2
anonymize: false
properties:
type:
type: string
description: The type of job to execute
example: bundle
enum: [ "bundle" ]
parameters:
type: object
description: Key-value parameters required for the job
additionalProperties: true
example:
bundle_for: true
bundle_for_time: 5
log_file_count: 2
anonymize: false
required:
- type
- parameters
- workload
Job:
type: object
properties:
@@ -61,59 +63,52 @@ components:
type: string
description: Primary identifier
example: "123456"
createdAt:
created_at:
type: string
format: date-time
description: When the job was created (UTC)
completedAt:
completed_at:
type: string
format: date-time
description: When the job finished, null if still running
triggeredBy:
triggered_by:
type: string
description: User that triggered this job
example: "user_42"
peerId:
type: string
description: Associated peer ID
example: "peer_99"
accountId:
type: string
description: Associated account ID
example: "acc_77"
type:
type: string
enum: [ bundle ]
example: bundle
status:
type: string
enum: [ pending, succeeded, failed ]
example: pending
failedReason:
failed_reason:
type: string
description: Why the job failed (if failed)
example: "Connection timeout"
result:
type: string
description: Job output (JSON, URL, etc.)
example: "https://example.com/bundle.zip"
parameters:
workload:
type: object
additionalProperties: true
description: Job configuration parameters
example:
bundle_for: true
bundle_for_time: 60
log_file_count: 10
anonymize: false
properties:
type:
type: string
description: The type of job to execute
example: bundle
enum: [ "bundle" ]
parameters:
type: object
description: Key-value parameters required for the job
additionalProperties: true
example:
bundle_for: true
bundle_for_time: 5
log_file_count: 2
anonymize: false
result:
type: string
description: Job output (JSON, URL, etc.)
example: "https://example.com/bundle.zip"
required:
- id
- createdAt
- triggeredBy
- peerId
- accountId
- type
- status
- created_at
- triggered_by
- workload
Account:
type: object
properties:

View File

@@ -111,14 +111,14 @@ const (
JobStatusSucceeded JobStatus = "succeeded"
)
// Defines values for JobType.
// Defines values for JobWorkloadType.
const (
JobTypeBundle JobType = "bundle"
JobWorkloadTypeBundle JobWorkloadType = "bundle"
)
// Defines values for JobRequestType.
// Defines values for JobRequestWorkloadType.
const (
JobRequestTypeBundle JobRequestType = "bundle"
JobRequestWorkloadTypeBundle JobRequestWorkloadType = "bundle"
)
// Defines values for NameserverNsType.
@@ -662,53 +662,52 @@ type IngressPortAllocationRequestPortRangeProtocol string
// Job defines model for Job.
type Job struct {
// AccountId Associated account ID
AccountId string `json:"accountId"`
// CompletedAt When the job finished, null if still running
CompletedAt *time.Time `json:"completedAt,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
// CreatedAt When the job was created (UTC)
CreatedAt time.Time `json:"createdAt"`
CreatedAt time.Time `json:"created_at"`
// FailedReason Why the job failed (if failed)
FailedReason *string `json:"failedReason,omitempty"`
FailedReason *string `json:"failed_reason,omitempty"`
// Id Primary identifier
Id string `json:"id"`
// Parameters Job configuration parameters
Parameters *map[string]interface{} `json:"parameters,omitempty"`
// PeerId Associated peer ID
PeerId string `json:"peerId"`
// Result Job output (JSON, URL, etc.)
Result *string `json:"result,omitempty"`
Status JobStatus `json:"status"`
Id string `json:"id"`
Status *JobStatus `json:"status,omitempty"`
// TriggeredBy User that triggered this job
TriggeredBy string `json:"triggeredBy"`
Type JobType `json:"type"`
TriggeredBy string `json:"triggered_by"`
Workload struct {
// Parameters Key-value parameters required for the job
Parameters *map[string]interface{} `json:"parameters,omitempty"`
// Result Job output (JSON, URL, etc.)
Result *string `json:"result,omitempty"`
// Type The type of job to execute
Type *JobWorkloadType `json:"type,omitempty"`
} `json:"workload"`
}
// JobStatus defines model for Job.Status.
type JobStatus string
// JobType defines model for Job.Type.
type JobType string
// JobWorkloadType The type of job to execute
type JobWorkloadType string
// JobRequest defines model for JobRequest.
type JobRequest struct {
// Parameters Key-value parameters required for the job
Parameters map[string]interface{} `json:"parameters"`
Workload struct {
// Parameters Key-value parameters required for the job
Parameters *map[string]interface{} `json:"parameters,omitempty"`
// Type The type of job to execute
Type JobRequestType `json:"type"`
// Type The type of job to execute
Type *JobRequestWorkloadType `json:"type,omitempty"`
} `json:"workload"`
}
// JobRequestType The type of job to execute
type JobRequestType string
// JobRequestWorkloadType The type of job to execute
type JobRequestWorkloadType string
// Location Describe geographical location information
type Location struct {