mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-07 01:10:03 +00:00
apply feedbacks 1
This commit is contained in:
@@ -34,6 +34,86 @@ tags:
|
||||
x-cloud-only: true
|
||||
components:
|
||||
schemas:
|
||||
JobRequest:
|
||||
type: object
|
||||
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
|
||||
Job:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: Primary identifier
|
||||
example: "123456"
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
description: When the job was created (UTC)
|
||||
completedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
description: When the job finished, null if still running
|
||||
triggeredBy:
|
||||
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:
|
||||
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:
|
||||
type: object
|
||||
additionalProperties: true
|
||||
description: Job configuration parameters
|
||||
example:
|
||||
bundle_for: true
|
||||
bundle_for_time: 60
|
||||
log_file_count: 10
|
||||
anonymize: false
|
||||
required:
|
||||
- id
|
||||
- createdAt
|
||||
- triggeredBy
|
||||
- peerId
|
||||
- accountId
|
||||
- type
|
||||
- status
|
||||
Account:
|
||||
type: object
|
||||
properties:
|
||||
@@ -2170,6 +2250,108 @@ security:
|
||||
- BearerAuth: [ ]
|
||||
- TokenAuth: [ ]
|
||||
paths:
|
||||
/api/peers/{peerId}/jobs:
|
||||
get:
|
||||
summary: List Jobs
|
||||
description: Retrieve all jobs for a given peer
|
||||
tags: [ Jobs ]
|
||||
security:
|
||||
- BearerAuth: []
|
||||
- TokenAuth: []
|
||||
parameters:
|
||||
- in: path
|
||||
name: peerId
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
description: The unique identifier of a peer
|
||||
responses:
|
||||
'200':
|
||||
description: List of jobs
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Job'
|
||||
'400':
|
||||
$ref: '#/components/responses/bad_request'
|
||||
'401':
|
||||
$ref: '#/components/responses/requires_authentication'
|
||||
'403':
|
||||
$ref: '#/components/responses/forbidden'
|
||||
'500':
|
||||
$ref: '#/components/responses/internal_error'
|
||||
post:
|
||||
summary: Create Job
|
||||
description: Create a new job for a given peer
|
||||
tags: [ Jobs ]
|
||||
security:
|
||||
- BearerAuth: []
|
||||
- TokenAuth: []
|
||||
parameters:
|
||||
- in: path
|
||||
name: peerId
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
description: The unique identifier of a peer
|
||||
requestBody:
|
||||
description: Create job request
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/JobRequest'
|
||||
required: true
|
||||
responses:
|
||||
'201':
|
||||
description: Job created
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Job'
|
||||
'400':
|
||||
"$ref": "#/components/responses/bad_request"
|
||||
'401':
|
||||
"$ref": "#/components/responses/requires_authentication"
|
||||
'403':
|
||||
"$ref": "#/components/responses/forbidden"
|
||||
'500':
|
||||
"$ref": "#/components/responses/internal_error"
|
||||
/api/peers/{peerId}/jobs/{jobId}:
|
||||
get:
|
||||
summary: Get Job
|
||||
description: Retrieve details of a specific job
|
||||
tags: [ Jobs ]
|
||||
security:
|
||||
- BearerAuth: []
|
||||
- TokenAuth: []
|
||||
parameters:
|
||||
- in: path
|
||||
name: peerId
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- in: path
|
||||
name: jobId
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: A Job object
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Job'
|
||||
'400':
|
||||
"$ref": "#/components/responses/bad_request"
|
||||
'401':
|
||||
"$ref": "#/components/responses/requires_authentication"
|
||||
'403':
|
||||
"$ref": "#/components/responses/forbidden"
|
||||
'500':
|
||||
"$ref": "#/components/responses/internal_error"
|
||||
/api/accounts:
|
||||
get:
|
||||
summary: List all Accounts
|
||||
|
||||
@@ -104,6 +104,23 @@ const (
|
||||
IngressPortAllocationRequestPortRangeProtocolUdp IngressPortAllocationRequestPortRangeProtocol = "udp"
|
||||
)
|
||||
|
||||
// Defines values for JobStatus.
|
||||
const (
|
||||
JobStatusFailed JobStatus = "failed"
|
||||
JobStatusPending JobStatus = "pending"
|
||||
JobStatusSucceeded JobStatus = "succeeded"
|
||||
)
|
||||
|
||||
// Defines values for JobType.
|
||||
const (
|
||||
JobTypeBundle JobType = "bundle"
|
||||
)
|
||||
|
||||
// Defines values for JobRequestType.
|
||||
const (
|
||||
JobRequestTypeBundle JobRequestType = "bundle"
|
||||
)
|
||||
|
||||
// Defines values for NameserverNsType.
|
||||
const (
|
||||
NameserverNsTypeUdp NameserverNsType = "udp"
|
||||
@@ -199,11 +216,6 @@ const (
|
||||
GetApiEventsNetworkTrafficParamsDirectionINGRESS GetApiEventsNetworkTrafficParamsDirection = "INGRESS"
|
||||
)
|
||||
|
||||
type JobRequest struct {
|
||||
Type string `json:"type" binding:"required"` // Job type, e.g., "bundle"
|
||||
Parameters map[string]any `json:"parameters" binding:"required"` // Dynamic parameters
|
||||
}
|
||||
|
||||
// AccessiblePeer defines model for AccessiblePeer.
|
||||
type AccessiblePeer struct {
|
||||
// CityName Commonly used English name of the city
|
||||
@@ -648,6 +660,56 @@ type IngressPortAllocationRequestPortRange struct {
|
||||
// IngressPortAllocationRequestPortRangeProtocol The protocol accepted by the port range
|
||||
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"`
|
||||
|
||||
// CreatedAt When the job was created (UTC)
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
|
||||
// FailedReason Why the job failed (if failed)
|
||||
FailedReason *string `json:"failedReason,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"`
|
||||
|
||||
// TriggeredBy User that triggered this job
|
||||
TriggeredBy string `json:"triggeredBy"`
|
||||
Type JobType `json:"type"`
|
||||
}
|
||||
|
||||
// JobStatus defines model for Job.Status.
|
||||
type JobStatus string
|
||||
|
||||
// JobType defines model for Job.Type.
|
||||
type JobType string
|
||||
|
||||
// JobRequest defines model for JobRequest.
|
||||
type JobRequest struct {
|
||||
// Parameters Key-value parameters required for the job
|
||||
Parameters map[string]interface{} `json:"parameters"`
|
||||
|
||||
// Type The type of job to execute
|
||||
Type JobRequestType `json:"type"`
|
||||
}
|
||||
|
||||
// JobRequestType The type of job to execute
|
||||
type JobRequestType string
|
||||
|
||||
// Location Describe geographical location information
|
||||
type Location struct {
|
||||
// CityName Commonly used English name of the city
|
||||
@@ -1020,8 +1082,6 @@ type OSVersionCheck struct {
|
||||
|
||||
// Peer defines model for Peer.
|
||||
type Peer struct {
|
||||
// CreatedAt Peer creation date (UTC)
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
// ApprovalRequired (Cloud only) Indicates whether peer needs approval
|
||||
ApprovalRequired bool `json:"approval_required"`
|
||||
|
||||
@@ -1037,6 +1097,9 @@ type Peer struct {
|
||||
// CountryCode 2-letter ISO 3166-1 alpha-2 code that represents the country
|
||||
CountryCode CountryCode `json:"country_code"`
|
||||
|
||||
// CreatedAt Peer creation date (UTC)
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
|
||||
// DnsLabel Peer's DNS label is the parsed peer name for domain resolution. It is used to form an FQDN by appending the account's domain to the peer label. e.g. peer-dns-label.netbird.cloud
|
||||
DnsLabel string `json:"dns_label"`
|
||||
|
||||
@@ -1103,8 +1166,6 @@ type Peer struct {
|
||||
|
||||
// PeerBatch defines model for PeerBatch.
|
||||
type PeerBatch struct {
|
||||
// CreatedAt Peer creation date (UTC)
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
// AccessiblePeersCount Number of accessible peers
|
||||
AccessiblePeersCount int `json:"accessible_peers_count"`
|
||||
|
||||
@@ -1123,6 +1184,9 @@ type PeerBatch struct {
|
||||
// CountryCode 2-letter ISO 3166-1 alpha-2 code that represents the country
|
||||
CountryCode CountryCode `json:"country_code"`
|
||||
|
||||
// CreatedAt Peer creation date (UTC)
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
|
||||
// DnsLabel Peer's DNS label is the parsed peer name for domain resolution. It is used to form an FQDN by appending the account's domain to the peer label. e.g. peer-dns-label.netbird.cloud
|
||||
DnsLabel string `json:"dns_label"`
|
||||
|
||||
@@ -1940,6 +2004,9 @@ type PostApiPeersPeerIdIngressPortsJSONRequestBody = IngressPortAllocationReques
|
||||
// PutApiPeersPeerIdIngressPortsAllocationIdJSONRequestBody defines body for PutApiPeersPeerIdIngressPortsAllocationId for application/json ContentType.
|
||||
type PutApiPeersPeerIdIngressPortsAllocationIdJSONRequestBody = IngressPortAllocationRequest
|
||||
|
||||
// PostApiPeersPeerIdJobsJSONRequestBody defines body for PostApiPeersPeerIdJobs for application/json ContentType.
|
||||
type PostApiPeersPeerIdJobsJSONRequestBody = JobRequest
|
||||
|
||||
// PostApiPoliciesJSONRequestBody defines body for PostApiPolicies for application/json ContentType.
|
||||
type PostApiPoliciesJSONRequestBody = PolicyUpdate
|
||||
|
||||
|
||||
Reference in New Issue
Block a user