mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-24 03:06:38 +00:00
apply feedback 2
This commit is contained in:
@@ -38,22 +38,23 @@ components:
|
||||
type: string
|
||||
enum:
|
||||
- bundle
|
||||
- other
|
||||
BundleParameters:
|
||||
type: object
|
||||
properties:
|
||||
bundle_for:
|
||||
type: boolean
|
||||
example: true
|
||||
bundle_for_time:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 0
|
||||
example: 2
|
||||
log_file_count:
|
||||
type: integer
|
||||
format: int32
|
||||
minimum: 0
|
||||
example: 100
|
||||
anonymize:
|
||||
type: boolean
|
||||
example: false
|
||||
required:
|
||||
- bundle_for
|
||||
- bundle_for_time
|
||||
@@ -64,8 +65,8 @@ components:
|
||||
properties:
|
||||
upload_key:
|
||||
type: string
|
||||
required:
|
||||
- upload_key
|
||||
example: "upload_key_123"
|
||||
nullable: true
|
||||
BundleWorkloadRequest:
|
||||
type: object
|
||||
properties:
|
||||
@@ -89,61 +90,20 @@ components:
|
||||
- type
|
||||
- parameters
|
||||
- result
|
||||
OtherParameters:
|
||||
type: object
|
||||
properties:
|
||||
example_param:
|
||||
type: string
|
||||
required:
|
||||
- example_param
|
||||
OtherResult:
|
||||
type: object
|
||||
properties:
|
||||
upload_key:
|
||||
type: string
|
||||
required:
|
||||
- upload_key
|
||||
OtherWorkloadRequest:
|
||||
type: object
|
||||
properties:
|
||||
type:
|
||||
$ref: '#/components/schemas/WorkloadType'
|
||||
parameters:
|
||||
$ref: '#/components/schemas/OtherParameters'
|
||||
required:
|
||||
- type
|
||||
- parameters
|
||||
OtherWorkloadResponse:
|
||||
type: object
|
||||
properties:
|
||||
type:
|
||||
$ref: '#/components/schemas/WorkloadType'
|
||||
parameters:
|
||||
$ref: '#/components/schemas/OtherParameters'
|
||||
result:
|
||||
$ref: '#/components/schemas/OtherResult'
|
||||
required:
|
||||
- type
|
||||
- parameters
|
||||
- result
|
||||
WorkloadRequest:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/BundleWorkloadRequest'
|
||||
- $ref: '#/components/schemas/OtherWorkloadRequest'
|
||||
discriminator:
|
||||
propertyName: type
|
||||
mapping:
|
||||
bundle: '#/components/schemas/BundleWorkloadRequest'
|
||||
other: '#/components/schemas/OtherWorkloadRequest'
|
||||
WorkloadResponse:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/BundleWorkloadResponse'
|
||||
- $ref: '#/components/schemas/OtherWorkloadResponse'
|
||||
discriminator:
|
||||
propertyName: type
|
||||
mapping:
|
||||
bundle: '#/components/schemas/BundleWorkloadResponse'
|
||||
other: '#/components/schemas/OtherWorkloadResponse'
|
||||
JobRequest:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
@@ -192,7 +192,6 @@ const (
|
||||
// Defines values for WorkloadType.
|
||||
const (
|
||||
WorkloadTypeBundle WorkloadType = "bundle"
|
||||
WorkloadTypeOther WorkloadType = "other"
|
||||
)
|
||||
|
||||
// Defines values for GetApiEventsNetworkTrafficParamsType.
|
||||
@@ -356,15 +355,15 @@ type AvailablePorts struct {
|
||||
|
||||
// BundleParameters defines model for BundleParameters.
|
||||
type BundleParameters struct {
|
||||
Anonymize bool `json:"anonymize"`
|
||||
BundleFor bool `json:"bundle_for"`
|
||||
BundleForTime int64 `json:"bundle_for_time"`
|
||||
LogFileCount int32 `json:"log_file_count"`
|
||||
Anonymize bool `json:"anonymize"`
|
||||
BundleFor bool `json:"bundle_for"`
|
||||
BundleForTime int `json:"bundle_for_time"`
|
||||
LogFileCount int `json:"log_file_count"`
|
||||
}
|
||||
|
||||
// BundleResult defines model for BundleResult.
|
||||
type BundleResult struct {
|
||||
UploadKey string `json:"upload_key"`
|
||||
UploadKey *string `json:"upload_key"`
|
||||
}
|
||||
|
||||
// BundleWorkloadRequest defines model for BundleWorkloadRequest.
|
||||
@@ -1075,29 +1074,6 @@ type OSVersionCheck struct {
|
||||
Windows *MinKernelVersionCheck `json:"windows,omitempty"`
|
||||
}
|
||||
|
||||
// OtherParameters defines model for OtherParameters.
|
||||
type OtherParameters struct {
|
||||
ExampleParam string `json:"example_param"`
|
||||
}
|
||||
|
||||
// OtherResult defines model for OtherResult.
|
||||
type OtherResult struct {
|
||||
UploadKey string `json:"upload_key"`
|
||||
}
|
||||
|
||||
// OtherWorkloadRequest defines model for OtherWorkloadRequest.
|
||||
type OtherWorkloadRequest struct {
|
||||
Parameters OtherParameters `json:"parameters"`
|
||||
Type WorkloadType `json:"type"`
|
||||
}
|
||||
|
||||
// OtherWorkloadResponse defines model for OtherWorkloadResponse.
|
||||
type OtherWorkloadResponse struct {
|
||||
Parameters OtherParameters `json:"parameters"`
|
||||
Result OtherResult `json:"result"`
|
||||
Type WorkloadType `json:"type"`
|
||||
}
|
||||
|
||||
// Peer defines model for Peer.
|
||||
type Peer struct {
|
||||
// ApprovalRequired (Cloud only) Indicates whether peer needs approval
|
||||
@@ -2099,34 +2075,6 @@ func (t *WorkloadRequest) MergeBundleWorkloadRequest(v BundleWorkloadRequest) er
|
||||
return err
|
||||
}
|
||||
|
||||
// AsOtherWorkloadRequest returns the union data inside the WorkloadRequest as a OtherWorkloadRequest
|
||||
func (t WorkloadRequest) AsOtherWorkloadRequest() (OtherWorkloadRequest, error) {
|
||||
var body OtherWorkloadRequest
|
||||
err := json.Unmarshal(t.union, &body)
|
||||
return body, err
|
||||
}
|
||||
|
||||
// FromOtherWorkloadRequest overwrites any union data inside the WorkloadRequest as the provided OtherWorkloadRequest
|
||||
func (t *WorkloadRequest) FromOtherWorkloadRequest(v OtherWorkloadRequest) error {
|
||||
v.Type = "other"
|
||||
b, err := json.Marshal(v)
|
||||
t.union = b
|
||||
return err
|
||||
}
|
||||
|
||||
// MergeOtherWorkloadRequest performs a merge with any union data inside the WorkloadRequest, using the provided OtherWorkloadRequest
|
||||
func (t *WorkloadRequest) MergeOtherWorkloadRequest(v OtherWorkloadRequest) error {
|
||||
v.Type = "other"
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
merged, err := runtime.JsonMerge(b, t.union)
|
||||
t.union = merged
|
||||
return err
|
||||
}
|
||||
|
||||
func (t WorkloadRequest) Discriminator() (string, error) {
|
||||
var discriminator struct {
|
||||
Discriminator string `json:"type"`
|
||||
@@ -2143,8 +2091,6 @@ func (t WorkloadRequest) ValueByDiscriminator() (interface{}, error) {
|
||||
switch discriminator {
|
||||
case "bundle":
|
||||
return t.AsBundleWorkloadRequest()
|
||||
case "other":
|
||||
return t.AsOtherWorkloadRequest()
|
||||
default:
|
||||
return nil, errors.New("unknown discriminator value: " + discriminator)
|
||||
}
|
||||
@@ -2188,34 +2134,6 @@ func (t *WorkloadResponse) MergeBundleWorkloadResponse(v BundleWorkloadResponse)
|
||||
return err
|
||||
}
|
||||
|
||||
// AsOtherWorkloadResponse returns the union data inside the WorkloadResponse as a OtherWorkloadResponse
|
||||
func (t WorkloadResponse) AsOtherWorkloadResponse() (OtherWorkloadResponse, error) {
|
||||
var body OtherWorkloadResponse
|
||||
err := json.Unmarshal(t.union, &body)
|
||||
return body, err
|
||||
}
|
||||
|
||||
// FromOtherWorkloadResponse overwrites any union data inside the WorkloadResponse as the provided OtherWorkloadResponse
|
||||
func (t *WorkloadResponse) FromOtherWorkloadResponse(v OtherWorkloadResponse) error {
|
||||
v.Type = "other"
|
||||
b, err := json.Marshal(v)
|
||||
t.union = b
|
||||
return err
|
||||
}
|
||||
|
||||
// MergeOtherWorkloadResponse performs a merge with any union data inside the WorkloadResponse, using the provided OtherWorkloadResponse
|
||||
func (t *WorkloadResponse) MergeOtherWorkloadResponse(v OtherWorkloadResponse) error {
|
||||
v.Type = "other"
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
merged, err := runtime.JsonMerge(b, t.union)
|
||||
t.union = merged
|
||||
return err
|
||||
}
|
||||
|
||||
func (t WorkloadResponse) Discriminator() (string, error) {
|
||||
var discriminator struct {
|
||||
Discriminator string `json:"type"`
|
||||
@@ -2232,8 +2150,6 @@ func (t WorkloadResponse) ValueByDiscriminator() (interface{}, error) {
|
||||
switch discriminator {
|
||||
case "bundle":
|
||||
return t.AsBundleWorkloadResponse()
|
||||
case "other":
|
||||
return t.AsOtherWorkloadResponse()
|
||||
default:
|
||||
return nil, errors.New("unknown discriminator value: " + discriminator)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user