diff --git a/client/jobs/cancel_job_parameters.go b/client/jobs/cancel_job_parameters.go index 555f934..f54c5e1 100644 --- a/client/jobs/cancel_job_parameters.go +++ b/client/jobs/cancel_job_parameters.go @@ -63,7 +63,7 @@ type CancelJobParams struct { /* JobName. - Job Name + Job Name */ JobName string diff --git a/client/jobs/get_job_parameters.go b/client/jobs/get_job_parameters.go index bd1f327..74dbf52 100644 --- a/client/jobs/get_job_parameters.go +++ b/client/jobs/get_job_parameters.go @@ -63,7 +63,7 @@ type GetJobParams struct { /* JobName. - Job Name + Job Name */ JobName string diff --git a/client/signadot_api_client.go b/client/signadot_api_client.go index 9f1fa58..faf9fbb 100644 --- a/client/signadot_api_client.go +++ b/client/signadot_api_client.go @@ -18,6 +18,8 @@ import ( "github.com/signadot/go-sdk/client/route_groups" "github.com/signadot/go-sdk/client/runner_groups" "github.com/signadot/go-sdk/client/sandboxes" + "github.com/signadot/go-sdk/client/test_executions" + "github.com/signadot/go-sdk/client/tests" ) // Default signadot API HTTP client. @@ -70,6 +72,8 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *SignadotAP cli.RouteGroups = route_groups.New(transport, formats) cli.RunnerGroups = runner_groups.New(transport, formats) cli.Sandboxes = sandboxes.New(transport, formats) + cli.TestExecutions = test_executions.New(transport, formats) + cli.Tests = tests.New(transport, formats) return cli } @@ -130,6 +134,10 @@ type SignadotAPI struct { Sandboxes sandboxes.ClientService + TestExecutions test_executions.ClientService + + Tests tests.ClientService + Transport runtime.ClientTransport } @@ -144,4 +152,6 @@ func (c *SignadotAPI) SetTransport(transport runtime.ClientTransport) { c.RouteGroups.SetTransport(transport) c.RunnerGroups.SetTransport(transport) c.Sandboxes.SetTransport(transport) + c.TestExecutions.SetTransport(transport) + c.Tests.SetTransport(transport) } diff --git a/client/test_executions/cancel_test_execution_parameters.go b/client/test_executions/cancel_test_execution_parameters.go new file mode 100644 index 0000000..c0575ac --- /dev/null +++ b/client/test_executions/cancel_test_execution_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package test_executions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewCancelTestExecutionParams creates a new CancelTestExecutionParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewCancelTestExecutionParams() *CancelTestExecutionParams { + return &CancelTestExecutionParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCancelTestExecutionParamsWithTimeout creates a new CancelTestExecutionParams object +// with the ability to set a timeout on a request. +func NewCancelTestExecutionParamsWithTimeout(timeout time.Duration) *CancelTestExecutionParams { + return &CancelTestExecutionParams{ + timeout: timeout, + } +} + +// NewCancelTestExecutionParamsWithContext creates a new CancelTestExecutionParams object +// with the ability to set a context for a request. +func NewCancelTestExecutionParamsWithContext(ctx context.Context) *CancelTestExecutionParams { + return &CancelTestExecutionParams{ + Context: ctx, + } +} + +// NewCancelTestExecutionParamsWithHTTPClient creates a new CancelTestExecutionParams object +// with the ability to set a custom HTTPClient for a request. +func NewCancelTestExecutionParamsWithHTTPClient(client *http.Client) *CancelTestExecutionParams { + return &CancelTestExecutionParams{ + HTTPClient: client, + } +} + +/* +CancelTestExecutionParams contains all the parameters to send to the API endpoint + + for the cancel test execution operation. + + Typically these are written to a http.Request. +*/ +type CancelTestExecutionParams struct { + + /* ExecutionName. + + Test Execution Name + */ + ExecutionName string + + /* OrgName. + + Signadot Org Name + */ + OrgName string + + /* TestName. + + Test Name + */ + TestName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the cancel test execution params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CancelTestExecutionParams) WithDefaults() *CancelTestExecutionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the cancel test execution params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CancelTestExecutionParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the cancel test execution params +func (o *CancelTestExecutionParams) WithTimeout(timeout time.Duration) *CancelTestExecutionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the cancel test execution params +func (o *CancelTestExecutionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the cancel test execution params +func (o *CancelTestExecutionParams) WithContext(ctx context.Context) *CancelTestExecutionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the cancel test execution params +func (o *CancelTestExecutionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the cancel test execution params +func (o *CancelTestExecutionParams) WithHTTPClient(client *http.Client) *CancelTestExecutionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the cancel test execution params +func (o *CancelTestExecutionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExecutionName adds the executionName to the cancel test execution params +func (o *CancelTestExecutionParams) WithExecutionName(executionName string) *CancelTestExecutionParams { + o.SetExecutionName(executionName) + return o +} + +// SetExecutionName adds the executionName to the cancel test execution params +func (o *CancelTestExecutionParams) SetExecutionName(executionName string) { + o.ExecutionName = executionName +} + +// WithOrgName adds the orgName to the cancel test execution params +func (o *CancelTestExecutionParams) WithOrgName(orgName string) *CancelTestExecutionParams { + o.SetOrgName(orgName) + return o +} + +// SetOrgName adds the orgName to the cancel test execution params +func (o *CancelTestExecutionParams) SetOrgName(orgName string) { + o.OrgName = orgName +} + +// WithTestName adds the testName to the cancel test execution params +func (o *CancelTestExecutionParams) WithTestName(testName string) *CancelTestExecutionParams { + o.SetTestName(testName) + return o +} + +// SetTestName adds the testName to the cancel test execution params +func (o *CancelTestExecutionParams) SetTestName(testName string) { + o.TestName = testName +} + +// WriteToRequest writes these params to a swagger request +func (o *CancelTestExecutionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param executionName + if err := r.SetPathParam("executionName", o.ExecutionName); err != nil { + return err + } + + // path param orgName + if err := r.SetPathParam("orgName", o.OrgName); err != nil { + return err + } + + // path param testName + if err := r.SetPathParam("testName", o.TestName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/test_executions/cancel_test_execution_responses.go b/client/test_executions/cancel_test_execution_responses.go new file mode 100644 index 0000000..508dc1c --- /dev/null +++ b/client/test_executions/cancel_test_execution_responses.go @@ -0,0 +1,332 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package test_executions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/signadot/go-sdk/models" +) + +// CancelTestExecutionReader is a Reader for the CancelTestExecution structure. +type CancelTestExecutionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CancelTestExecutionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCancelTestExecutionOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewCancelTestExecutionBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewCancelTestExecutionUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 502: + result := NewCancelTestExecutionBadGateway() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /orgs/{orgName}/tests/{testName}/executions/{executionName}/cancel] cancel-test-execution", response, response.Code()) + } +} + +// NewCancelTestExecutionOK creates a CancelTestExecutionOK with default headers values +func NewCancelTestExecutionOK() *CancelTestExecutionOK { + return &CancelTestExecutionOK{} +} + +/* +CancelTestExecutionOK describes a response with status code 200, with default header values. + +OK +*/ +type CancelTestExecutionOK struct { + Payload models.EmptyResponse +} + +// IsSuccess returns true when this cancel test execution o k response has a 2xx status code +func (o *CancelTestExecutionOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this cancel test execution o k response has a 3xx status code +func (o *CancelTestExecutionOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this cancel test execution o k response has a 4xx status code +func (o *CancelTestExecutionOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this cancel test execution o k response has a 5xx status code +func (o *CancelTestExecutionOK) IsServerError() bool { + return false +} + +// IsCode returns true when this cancel test execution o k response a status code equal to that given +func (o *CancelTestExecutionOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the cancel test execution o k response +func (o *CancelTestExecutionOK) Code() int { + return 200 +} + +func (o *CancelTestExecutionOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/{executionName}/cancel][%d] cancelTestExecutionOK %s", 200, payload) +} + +func (o *CancelTestExecutionOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/{executionName}/cancel][%d] cancelTestExecutionOK %s", 200, payload) +} + +func (o *CancelTestExecutionOK) GetPayload() models.EmptyResponse { + return o.Payload +} + +func (o *CancelTestExecutionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCancelTestExecutionBadRequest creates a CancelTestExecutionBadRequest with default headers values +func NewCancelTestExecutionBadRequest() *CancelTestExecutionBadRequest { + return &CancelTestExecutionBadRequest{} +} + +/* +CancelTestExecutionBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type CancelTestExecutionBadRequest struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this cancel test execution bad request response has a 2xx status code +func (o *CancelTestExecutionBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this cancel test execution bad request response has a 3xx status code +func (o *CancelTestExecutionBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this cancel test execution bad request response has a 4xx status code +func (o *CancelTestExecutionBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this cancel test execution bad request response has a 5xx status code +func (o *CancelTestExecutionBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this cancel test execution bad request response a status code equal to that given +func (o *CancelTestExecutionBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the cancel test execution bad request response +func (o *CancelTestExecutionBadRequest) Code() int { + return 400 +} + +func (o *CancelTestExecutionBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/{executionName}/cancel][%d] cancelTestExecutionBadRequest %s", 400, payload) +} + +func (o *CancelTestExecutionBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/{executionName}/cancel][%d] cancelTestExecutionBadRequest %s", 400, payload) +} + +func (o *CancelTestExecutionBadRequest) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *CancelTestExecutionBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCancelTestExecutionUnauthorized creates a CancelTestExecutionUnauthorized with default headers values +func NewCancelTestExecutionUnauthorized() *CancelTestExecutionUnauthorized { + return &CancelTestExecutionUnauthorized{} +} + +/* +CancelTestExecutionUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type CancelTestExecutionUnauthorized struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this cancel test execution unauthorized response has a 2xx status code +func (o *CancelTestExecutionUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this cancel test execution unauthorized response has a 3xx status code +func (o *CancelTestExecutionUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this cancel test execution unauthorized response has a 4xx status code +func (o *CancelTestExecutionUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this cancel test execution unauthorized response has a 5xx status code +func (o *CancelTestExecutionUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this cancel test execution unauthorized response a status code equal to that given +func (o *CancelTestExecutionUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the cancel test execution unauthorized response +func (o *CancelTestExecutionUnauthorized) Code() int { + return 401 +} + +func (o *CancelTestExecutionUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/{executionName}/cancel][%d] cancelTestExecutionUnauthorized %s", 401, payload) +} + +func (o *CancelTestExecutionUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/{executionName}/cancel][%d] cancelTestExecutionUnauthorized %s", 401, payload) +} + +func (o *CancelTestExecutionUnauthorized) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *CancelTestExecutionUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCancelTestExecutionBadGateway creates a CancelTestExecutionBadGateway with default headers values +func NewCancelTestExecutionBadGateway() *CancelTestExecutionBadGateway { + return &CancelTestExecutionBadGateway{} +} + +/* +CancelTestExecutionBadGateway describes a response with status code 502, with default header values. + +Bad Gateway +*/ +type CancelTestExecutionBadGateway struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this cancel test execution bad gateway response has a 2xx status code +func (o *CancelTestExecutionBadGateway) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this cancel test execution bad gateway response has a 3xx status code +func (o *CancelTestExecutionBadGateway) IsRedirect() bool { + return false +} + +// IsClientError returns true when this cancel test execution bad gateway response has a 4xx status code +func (o *CancelTestExecutionBadGateway) IsClientError() bool { + return false +} + +// IsServerError returns true when this cancel test execution bad gateway response has a 5xx status code +func (o *CancelTestExecutionBadGateway) IsServerError() bool { + return true +} + +// IsCode returns true when this cancel test execution bad gateway response a status code equal to that given +func (o *CancelTestExecutionBadGateway) IsCode(code int) bool { + return code == 502 +} + +// Code gets the status code for the cancel test execution bad gateway response +func (o *CancelTestExecutionBadGateway) Code() int { + return 502 +} + +func (o *CancelTestExecutionBadGateway) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/{executionName}/cancel][%d] cancelTestExecutionBadGateway %s", 502, payload) +} + +func (o *CancelTestExecutionBadGateway) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/{executionName}/cancel][%d] cancelTestExecutionBadGateway %s", 502, payload) +} + +func (o *CancelTestExecutionBadGateway) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *CancelTestExecutionBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/test_executions/create_test_execution_parameters.go b/client/test_executions/create_test_execution_parameters.go new file mode 100644 index 0000000..cfa883b --- /dev/null +++ b/client/test_executions/create_test_execution_parameters.go @@ -0,0 +1,197 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package test_executions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/signadot/go-sdk/models" +) + +// NewCreateTestExecutionParams creates a new CreateTestExecutionParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewCreateTestExecutionParams() *CreateTestExecutionParams { + return &CreateTestExecutionParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCreateTestExecutionParamsWithTimeout creates a new CreateTestExecutionParams object +// with the ability to set a timeout on a request. +func NewCreateTestExecutionParamsWithTimeout(timeout time.Duration) *CreateTestExecutionParams { + return &CreateTestExecutionParams{ + timeout: timeout, + } +} + +// NewCreateTestExecutionParamsWithContext creates a new CreateTestExecutionParams object +// with the ability to set a context for a request. +func NewCreateTestExecutionParamsWithContext(ctx context.Context) *CreateTestExecutionParams { + return &CreateTestExecutionParams{ + Context: ctx, + } +} + +// NewCreateTestExecutionParamsWithHTTPClient creates a new CreateTestExecutionParams object +// with the ability to set a custom HTTPClient for a request. +func NewCreateTestExecutionParamsWithHTTPClient(client *http.Client) *CreateTestExecutionParams { + return &CreateTestExecutionParams{ + HTTPClient: client, + } +} + +/* +CreateTestExecutionParams contains all the parameters to send to the API endpoint + + for the create test execution operation. + + Typically these are written to a http.Request. +*/ +type CreateTestExecutionParams struct { + + /* Data. + + Request to create a test execution + */ + Data *models.TestExecutionSpec + + /* OrgName. + + Signadot Org Name + */ + OrgName string + + /* TestName. + + Test name + */ + TestName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the create test execution params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateTestExecutionParams) WithDefaults() *CreateTestExecutionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the create test execution params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateTestExecutionParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the create test execution params +func (o *CreateTestExecutionParams) WithTimeout(timeout time.Duration) *CreateTestExecutionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create test execution params +func (o *CreateTestExecutionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create test execution params +func (o *CreateTestExecutionParams) WithContext(ctx context.Context) *CreateTestExecutionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create test execution params +func (o *CreateTestExecutionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create test execution params +func (o *CreateTestExecutionParams) WithHTTPClient(client *http.Client) *CreateTestExecutionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create test execution params +func (o *CreateTestExecutionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithData adds the data to the create test execution params +func (o *CreateTestExecutionParams) WithData(data *models.TestExecutionSpec) *CreateTestExecutionParams { + o.SetData(data) + return o +} + +// SetData adds the data to the create test execution params +func (o *CreateTestExecutionParams) SetData(data *models.TestExecutionSpec) { + o.Data = data +} + +// WithOrgName adds the orgName to the create test execution params +func (o *CreateTestExecutionParams) WithOrgName(orgName string) *CreateTestExecutionParams { + o.SetOrgName(orgName) + return o +} + +// SetOrgName adds the orgName to the create test execution params +func (o *CreateTestExecutionParams) SetOrgName(orgName string) { + o.OrgName = orgName +} + +// WithTestName adds the testName to the create test execution params +func (o *CreateTestExecutionParams) WithTestName(testName string) *CreateTestExecutionParams { + o.SetTestName(testName) + return o +} + +// SetTestName adds the testName to the create test execution params +func (o *CreateTestExecutionParams) SetTestName(testName string) { + o.TestName = testName +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateTestExecutionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Data != nil { + if err := r.SetBodyParam(o.Data); err != nil { + return err + } + } + + // path param orgName + if err := r.SetPathParam("orgName", o.OrgName); err != nil { + return err + } + + // path param testName + if err := r.SetPathParam("testName", o.TestName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/test_executions/create_test_execution_responses.go b/client/test_executions/create_test_execution_responses.go new file mode 100644 index 0000000..7a958f6 --- /dev/null +++ b/client/test_executions/create_test_execution_responses.go @@ -0,0 +1,334 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package test_executions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/signadot/go-sdk/models" +) + +// CreateTestExecutionReader is a Reader for the CreateTestExecution structure. +type CreateTestExecutionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateTestExecutionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateTestExecutionOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewCreateTestExecutionBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewCreateTestExecutionUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 502: + result := NewCreateTestExecutionBadGateway() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /orgs/{orgName}/tests/{testName}/executions/] create-test-execution", response, response.Code()) + } +} + +// NewCreateTestExecutionOK creates a CreateTestExecutionOK with default headers values +func NewCreateTestExecutionOK() *CreateTestExecutionOK { + return &CreateTestExecutionOK{} +} + +/* +CreateTestExecutionOK describes a response with status code 200, with default header values. + +OK +*/ +type CreateTestExecutionOK struct { + Payload *models.TestExecution +} + +// IsSuccess returns true when this create test execution o k response has a 2xx status code +func (o *CreateTestExecutionOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this create test execution o k response has a 3xx status code +func (o *CreateTestExecutionOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create test execution o k response has a 4xx status code +func (o *CreateTestExecutionOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this create test execution o k response has a 5xx status code +func (o *CreateTestExecutionOK) IsServerError() bool { + return false +} + +// IsCode returns true when this create test execution o k response a status code equal to that given +func (o *CreateTestExecutionOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the create test execution o k response +func (o *CreateTestExecutionOK) Code() int { + return 200 +} + +func (o *CreateTestExecutionOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/][%d] createTestExecutionOK %s", 200, payload) +} + +func (o *CreateTestExecutionOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/][%d] createTestExecutionOK %s", 200, payload) +} + +func (o *CreateTestExecutionOK) GetPayload() *models.TestExecution { + return o.Payload +} + +func (o *CreateTestExecutionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TestExecution) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCreateTestExecutionBadRequest creates a CreateTestExecutionBadRequest with default headers values +func NewCreateTestExecutionBadRequest() *CreateTestExecutionBadRequest { + return &CreateTestExecutionBadRequest{} +} + +/* +CreateTestExecutionBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type CreateTestExecutionBadRequest struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this create test execution bad request response has a 2xx status code +func (o *CreateTestExecutionBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this create test execution bad request response has a 3xx status code +func (o *CreateTestExecutionBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create test execution bad request response has a 4xx status code +func (o *CreateTestExecutionBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this create test execution bad request response has a 5xx status code +func (o *CreateTestExecutionBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this create test execution bad request response a status code equal to that given +func (o *CreateTestExecutionBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the create test execution bad request response +func (o *CreateTestExecutionBadRequest) Code() int { + return 400 +} + +func (o *CreateTestExecutionBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/][%d] createTestExecutionBadRequest %s", 400, payload) +} + +func (o *CreateTestExecutionBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/][%d] createTestExecutionBadRequest %s", 400, payload) +} + +func (o *CreateTestExecutionBadRequest) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *CreateTestExecutionBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCreateTestExecutionUnauthorized creates a CreateTestExecutionUnauthorized with default headers values +func NewCreateTestExecutionUnauthorized() *CreateTestExecutionUnauthorized { + return &CreateTestExecutionUnauthorized{} +} + +/* +CreateTestExecutionUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type CreateTestExecutionUnauthorized struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this create test execution unauthorized response has a 2xx status code +func (o *CreateTestExecutionUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this create test execution unauthorized response has a 3xx status code +func (o *CreateTestExecutionUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create test execution unauthorized response has a 4xx status code +func (o *CreateTestExecutionUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this create test execution unauthorized response has a 5xx status code +func (o *CreateTestExecutionUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this create test execution unauthorized response a status code equal to that given +func (o *CreateTestExecutionUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the create test execution unauthorized response +func (o *CreateTestExecutionUnauthorized) Code() int { + return 401 +} + +func (o *CreateTestExecutionUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/][%d] createTestExecutionUnauthorized %s", 401, payload) +} + +func (o *CreateTestExecutionUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/][%d] createTestExecutionUnauthorized %s", 401, payload) +} + +func (o *CreateTestExecutionUnauthorized) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *CreateTestExecutionUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCreateTestExecutionBadGateway creates a CreateTestExecutionBadGateway with default headers values +func NewCreateTestExecutionBadGateway() *CreateTestExecutionBadGateway { + return &CreateTestExecutionBadGateway{} +} + +/* +CreateTestExecutionBadGateway describes a response with status code 502, with default header values. + +Bad Gateway +*/ +type CreateTestExecutionBadGateway struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this create test execution bad gateway response has a 2xx status code +func (o *CreateTestExecutionBadGateway) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this create test execution bad gateway response has a 3xx status code +func (o *CreateTestExecutionBadGateway) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create test execution bad gateway response has a 4xx status code +func (o *CreateTestExecutionBadGateway) IsClientError() bool { + return false +} + +// IsServerError returns true when this create test execution bad gateway response has a 5xx status code +func (o *CreateTestExecutionBadGateway) IsServerError() bool { + return true +} + +// IsCode returns true when this create test execution bad gateway response a status code equal to that given +func (o *CreateTestExecutionBadGateway) IsCode(code int) bool { + return code == 502 +} + +// Code gets the status code for the create test execution bad gateway response +func (o *CreateTestExecutionBadGateway) Code() int { + return 502 +} + +func (o *CreateTestExecutionBadGateway) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/][%d] createTestExecutionBadGateway %s", 502, payload) +} + +func (o *CreateTestExecutionBadGateway) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /orgs/{orgName}/tests/{testName}/executions/][%d] createTestExecutionBadGateway %s", 502, payload) +} + +func (o *CreateTestExecutionBadGateway) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *CreateTestExecutionBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/test_executions/get_test_execution_parameters.go b/client/test_executions/get_test_execution_parameters.go new file mode 100644 index 0000000..a2b46a1 --- /dev/null +++ b/client/test_executions/get_test_execution_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package test_executions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGetTestExecutionParams creates a new GetTestExecutionParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetTestExecutionParams() *GetTestExecutionParams { + return &GetTestExecutionParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetTestExecutionParamsWithTimeout creates a new GetTestExecutionParams object +// with the ability to set a timeout on a request. +func NewGetTestExecutionParamsWithTimeout(timeout time.Duration) *GetTestExecutionParams { + return &GetTestExecutionParams{ + timeout: timeout, + } +} + +// NewGetTestExecutionParamsWithContext creates a new GetTestExecutionParams object +// with the ability to set a context for a request. +func NewGetTestExecutionParamsWithContext(ctx context.Context) *GetTestExecutionParams { + return &GetTestExecutionParams{ + Context: ctx, + } +} + +// NewGetTestExecutionParamsWithHTTPClient creates a new GetTestExecutionParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetTestExecutionParamsWithHTTPClient(client *http.Client) *GetTestExecutionParams { + return &GetTestExecutionParams{ + HTTPClient: client, + } +} + +/* +GetTestExecutionParams contains all the parameters to send to the API endpoint + + for the get test execution operation. + + Typically these are written to a http.Request. +*/ +type GetTestExecutionParams struct { + + /* ExecutionName. + + Test Execution Name + */ + ExecutionName string + + /* OrgName. + + Signadot Org Name + */ + OrgName string + + /* TestName. + + Test Name + */ + TestName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get test execution params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTestExecutionParams) WithDefaults() *GetTestExecutionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get test execution params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTestExecutionParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get test execution params +func (o *GetTestExecutionParams) WithTimeout(timeout time.Duration) *GetTestExecutionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get test execution params +func (o *GetTestExecutionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get test execution params +func (o *GetTestExecutionParams) WithContext(ctx context.Context) *GetTestExecutionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get test execution params +func (o *GetTestExecutionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get test execution params +func (o *GetTestExecutionParams) WithHTTPClient(client *http.Client) *GetTestExecutionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get test execution params +func (o *GetTestExecutionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExecutionName adds the executionName to the get test execution params +func (o *GetTestExecutionParams) WithExecutionName(executionName string) *GetTestExecutionParams { + o.SetExecutionName(executionName) + return o +} + +// SetExecutionName adds the executionName to the get test execution params +func (o *GetTestExecutionParams) SetExecutionName(executionName string) { + o.ExecutionName = executionName +} + +// WithOrgName adds the orgName to the get test execution params +func (o *GetTestExecutionParams) WithOrgName(orgName string) *GetTestExecutionParams { + o.SetOrgName(orgName) + return o +} + +// SetOrgName adds the orgName to the get test execution params +func (o *GetTestExecutionParams) SetOrgName(orgName string) { + o.OrgName = orgName +} + +// WithTestName adds the testName to the get test execution params +func (o *GetTestExecutionParams) WithTestName(testName string) *GetTestExecutionParams { + o.SetTestName(testName) + return o +} + +// SetTestName adds the testName to the get test execution params +func (o *GetTestExecutionParams) SetTestName(testName string) { + o.TestName = testName +} + +// WriteToRequest writes these params to a swagger request +func (o *GetTestExecutionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param executionName + if err := r.SetPathParam("executionName", o.ExecutionName); err != nil { + return err + } + + // path param orgName + if err := r.SetPathParam("orgName", o.OrgName); err != nil { + return err + } + + // path param testName + if err := r.SetPathParam("testName", o.TestName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/test_executions/get_test_execution_responses.go b/client/test_executions/get_test_execution_responses.go new file mode 100644 index 0000000..f53006a --- /dev/null +++ b/client/test_executions/get_test_execution_responses.go @@ -0,0 +1,334 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package test_executions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/signadot/go-sdk/models" +) + +// GetTestExecutionReader is a Reader for the GetTestExecution structure. +type GetTestExecutionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetTestExecutionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetTestExecutionOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewGetTestExecutionBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewGetTestExecutionUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 502: + result := NewGetTestExecutionBadGateway() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}] get-test-execution", response, response.Code()) + } +} + +// NewGetTestExecutionOK creates a GetTestExecutionOK with default headers values +func NewGetTestExecutionOK() *GetTestExecutionOK { + return &GetTestExecutionOK{} +} + +/* +GetTestExecutionOK describes a response with status code 200, with default header values. + +OK +*/ +type GetTestExecutionOK struct { + Payload *models.TestExecution +} + +// IsSuccess returns true when this get test execution o k response has a 2xx status code +func (o *GetTestExecutionOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get test execution o k response has a 3xx status code +func (o *GetTestExecutionOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get test execution o k response has a 4xx status code +func (o *GetTestExecutionOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get test execution o k response has a 5xx status code +func (o *GetTestExecutionOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get test execution o k response a status code equal to that given +func (o *GetTestExecutionOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get test execution o k response +func (o *GetTestExecutionOK) Code() int { + return 200 +} + +func (o *GetTestExecutionOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}][%d] getTestExecutionOK %s", 200, payload) +} + +func (o *GetTestExecutionOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}][%d] getTestExecutionOK %s", 200, payload) +} + +func (o *GetTestExecutionOK) GetPayload() *models.TestExecution { + return o.Payload +} + +func (o *GetTestExecutionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TestExecution) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetTestExecutionBadRequest creates a GetTestExecutionBadRequest with default headers values +func NewGetTestExecutionBadRequest() *GetTestExecutionBadRequest { + return &GetTestExecutionBadRequest{} +} + +/* +GetTestExecutionBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type GetTestExecutionBadRequest struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this get test execution bad request response has a 2xx status code +func (o *GetTestExecutionBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get test execution bad request response has a 3xx status code +func (o *GetTestExecutionBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get test execution bad request response has a 4xx status code +func (o *GetTestExecutionBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this get test execution bad request response has a 5xx status code +func (o *GetTestExecutionBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this get test execution bad request response a status code equal to that given +func (o *GetTestExecutionBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the get test execution bad request response +func (o *GetTestExecutionBadRequest) Code() int { + return 400 +} + +func (o *GetTestExecutionBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}][%d] getTestExecutionBadRequest %s", 400, payload) +} + +func (o *GetTestExecutionBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}][%d] getTestExecutionBadRequest %s", 400, payload) +} + +func (o *GetTestExecutionBadRequest) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *GetTestExecutionBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetTestExecutionUnauthorized creates a GetTestExecutionUnauthorized with default headers values +func NewGetTestExecutionUnauthorized() *GetTestExecutionUnauthorized { + return &GetTestExecutionUnauthorized{} +} + +/* +GetTestExecutionUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type GetTestExecutionUnauthorized struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this get test execution unauthorized response has a 2xx status code +func (o *GetTestExecutionUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get test execution unauthorized response has a 3xx status code +func (o *GetTestExecutionUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get test execution unauthorized response has a 4xx status code +func (o *GetTestExecutionUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this get test execution unauthorized response has a 5xx status code +func (o *GetTestExecutionUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this get test execution unauthorized response a status code equal to that given +func (o *GetTestExecutionUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the get test execution unauthorized response +func (o *GetTestExecutionUnauthorized) Code() int { + return 401 +} + +func (o *GetTestExecutionUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}][%d] getTestExecutionUnauthorized %s", 401, payload) +} + +func (o *GetTestExecutionUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}][%d] getTestExecutionUnauthorized %s", 401, payload) +} + +func (o *GetTestExecutionUnauthorized) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *GetTestExecutionUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetTestExecutionBadGateway creates a GetTestExecutionBadGateway with default headers values +func NewGetTestExecutionBadGateway() *GetTestExecutionBadGateway { + return &GetTestExecutionBadGateway{} +} + +/* +GetTestExecutionBadGateway describes a response with status code 502, with default header values. + +Bad Gateway +*/ +type GetTestExecutionBadGateway struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this get test execution bad gateway response has a 2xx status code +func (o *GetTestExecutionBadGateway) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get test execution bad gateway response has a 3xx status code +func (o *GetTestExecutionBadGateway) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get test execution bad gateway response has a 4xx status code +func (o *GetTestExecutionBadGateway) IsClientError() bool { + return false +} + +// IsServerError returns true when this get test execution bad gateway response has a 5xx status code +func (o *GetTestExecutionBadGateway) IsServerError() bool { + return true +} + +// IsCode returns true when this get test execution bad gateway response a status code equal to that given +func (o *GetTestExecutionBadGateway) IsCode(code int) bool { + return code == 502 +} + +// Code gets the status code for the get test execution bad gateway response +func (o *GetTestExecutionBadGateway) Code() int { + return 502 +} + +func (o *GetTestExecutionBadGateway) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}][%d] getTestExecutionBadGateway %s", 502, payload) +} + +func (o *GetTestExecutionBadGateway) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}][%d] getTestExecutionBadGateway %s", 502, payload) +} + +func (o *GetTestExecutionBadGateway) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *GetTestExecutionBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/test_executions/list_test_executions_parameters.go b/client/test_executions/list_test_executions_parameters.go new file mode 100644 index 0000000..d3a1d4b --- /dev/null +++ b/client/test_executions/list_test_executions_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package test_executions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewListTestExecutionsParams creates a new ListTestExecutionsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListTestExecutionsParams() *ListTestExecutionsParams { + return &ListTestExecutionsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListTestExecutionsParamsWithTimeout creates a new ListTestExecutionsParams object +// with the ability to set a timeout on a request. +func NewListTestExecutionsParamsWithTimeout(timeout time.Duration) *ListTestExecutionsParams { + return &ListTestExecutionsParams{ + timeout: timeout, + } +} + +// NewListTestExecutionsParamsWithContext creates a new ListTestExecutionsParams object +// with the ability to set a context for a request. +func NewListTestExecutionsParamsWithContext(ctx context.Context) *ListTestExecutionsParams { + return &ListTestExecutionsParams{ + Context: ctx, + } +} + +// NewListTestExecutionsParamsWithHTTPClient creates a new ListTestExecutionsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListTestExecutionsParamsWithHTTPClient(client *http.Client) *ListTestExecutionsParams { + return &ListTestExecutionsParams{ + HTTPClient: client, + } +} + +/* +ListTestExecutionsParams contains all the parameters to send to the API endpoint + + for the list test executions operation. + + Typically these are written to a http.Request. +*/ +type ListTestExecutionsParams struct { + + /* OrgName. + + Signadot Org Name + */ + OrgName string + + /* TestName. + + Test name + */ + TestName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list test executions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListTestExecutionsParams) WithDefaults() *ListTestExecutionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list test executions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListTestExecutionsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list test executions params +func (o *ListTestExecutionsParams) WithTimeout(timeout time.Duration) *ListTestExecutionsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list test executions params +func (o *ListTestExecutionsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list test executions params +func (o *ListTestExecutionsParams) WithContext(ctx context.Context) *ListTestExecutionsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list test executions params +func (o *ListTestExecutionsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list test executions params +func (o *ListTestExecutionsParams) WithHTTPClient(client *http.Client) *ListTestExecutionsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list test executions params +func (o *ListTestExecutionsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithOrgName adds the orgName to the list test executions params +func (o *ListTestExecutionsParams) WithOrgName(orgName string) *ListTestExecutionsParams { + o.SetOrgName(orgName) + return o +} + +// SetOrgName adds the orgName to the list test executions params +func (o *ListTestExecutionsParams) SetOrgName(orgName string) { + o.OrgName = orgName +} + +// WithTestName adds the testName to the list test executions params +func (o *ListTestExecutionsParams) WithTestName(testName string) *ListTestExecutionsParams { + o.SetTestName(testName) + return o +} + +// SetTestName adds the testName to the list test executions params +func (o *ListTestExecutionsParams) SetTestName(testName string) { + o.TestName = testName +} + +// WriteToRequest writes these params to a swagger request +func (o *ListTestExecutionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param orgName + if err := r.SetPathParam("orgName", o.OrgName); err != nil { + return err + } + + // path param testName + if err := r.SetPathParam("testName", o.TestName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/test_executions/list_test_executions_responses.go b/client/test_executions/list_test_executions_responses.go new file mode 100644 index 0000000..3e1d91b --- /dev/null +++ b/client/test_executions/list_test_executions_responses.go @@ -0,0 +1,332 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package test_executions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/signadot/go-sdk/models" +) + +// ListTestExecutionsReader is a Reader for the ListTestExecutions structure. +type ListTestExecutionsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListTestExecutionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListTestExecutionsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListTestExecutionsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListTestExecutionsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 502: + result := NewListTestExecutionsBadGateway() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /orgs/{orgName}/tests/{testName}/executions/] list-test-executions", response, response.Code()) + } +} + +// NewListTestExecutionsOK creates a ListTestExecutionsOK with default headers values +func NewListTestExecutionsOK() *ListTestExecutionsOK { + return &ListTestExecutionsOK{} +} + +/* +ListTestExecutionsOK describes a response with status code 200, with default header values. + +OK +*/ +type ListTestExecutionsOK struct { + Payload []*models.TestExecution +} + +// IsSuccess returns true when this list test executions o k response has a 2xx status code +func (o *ListTestExecutionsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list test executions o k response has a 3xx status code +func (o *ListTestExecutionsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list test executions o k response has a 4xx status code +func (o *ListTestExecutionsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list test executions o k response has a 5xx status code +func (o *ListTestExecutionsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list test executions o k response a status code equal to that given +func (o *ListTestExecutionsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list test executions o k response +func (o *ListTestExecutionsOK) Code() int { + return 200 +} + +func (o *ListTestExecutionsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/][%d] listTestExecutionsOK %s", 200, payload) +} + +func (o *ListTestExecutionsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/][%d] listTestExecutionsOK %s", 200, payload) +} + +func (o *ListTestExecutionsOK) GetPayload() []*models.TestExecution { + return o.Payload +} + +func (o *ListTestExecutionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListTestExecutionsBadRequest creates a ListTestExecutionsBadRequest with default headers values +func NewListTestExecutionsBadRequest() *ListTestExecutionsBadRequest { + return &ListTestExecutionsBadRequest{} +} + +/* +ListTestExecutionsBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ListTestExecutionsBadRequest struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this list test executions bad request response has a 2xx status code +func (o *ListTestExecutionsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list test executions bad request response has a 3xx status code +func (o *ListTestExecutionsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list test executions bad request response has a 4xx status code +func (o *ListTestExecutionsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list test executions bad request response has a 5xx status code +func (o *ListTestExecutionsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list test executions bad request response a status code equal to that given +func (o *ListTestExecutionsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list test executions bad request response +func (o *ListTestExecutionsBadRequest) Code() int { + return 400 +} + +func (o *ListTestExecutionsBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/][%d] listTestExecutionsBadRequest %s", 400, payload) +} + +func (o *ListTestExecutionsBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/][%d] listTestExecutionsBadRequest %s", 400, payload) +} + +func (o *ListTestExecutionsBadRequest) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListTestExecutionsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListTestExecutionsUnauthorized creates a ListTestExecutionsUnauthorized with default headers values +func NewListTestExecutionsUnauthorized() *ListTestExecutionsUnauthorized { + return &ListTestExecutionsUnauthorized{} +} + +/* +ListTestExecutionsUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type ListTestExecutionsUnauthorized struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this list test executions unauthorized response has a 2xx status code +func (o *ListTestExecutionsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list test executions unauthorized response has a 3xx status code +func (o *ListTestExecutionsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list test executions unauthorized response has a 4xx status code +func (o *ListTestExecutionsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list test executions unauthorized response has a 5xx status code +func (o *ListTestExecutionsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list test executions unauthorized response a status code equal to that given +func (o *ListTestExecutionsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list test executions unauthorized response +func (o *ListTestExecutionsUnauthorized) Code() int { + return 401 +} + +func (o *ListTestExecutionsUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/][%d] listTestExecutionsUnauthorized %s", 401, payload) +} + +func (o *ListTestExecutionsUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/][%d] listTestExecutionsUnauthorized %s", 401, payload) +} + +func (o *ListTestExecutionsUnauthorized) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListTestExecutionsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListTestExecutionsBadGateway creates a ListTestExecutionsBadGateway with default headers values +func NewListTestExecutionsBadGateway() *ListTestExecutionsBadGateway { + return &ListTestExecutionsBadGateway{} +} + +/* +ListTestExecutionsBadGateway describes a response with status code 502, with default header values. + +Bad Gateway +*/ +type ListTestExecutionsBadGateway struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this list test executions bad gateway response has a 2xx status code +func (o *ListTestExecutionsBadGateway) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list test executions bad gateway response has a 3xx status code +func (o *ListTestExecutionsBadGateway) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list test executions bad gateway response has a 4xx status code +func (o *ListTestExecutionsBadGateway) IsClientError() bool { + return false +} + +// IsServerError returns true when this list test executions bad gateway response has a 5xx status code +func (o *ListTestExecutionsBadGateway) IsServerError() bool { + return true +} + +// IsCode returns true when this list test executions bad gateway response a status code equal to that given +func (o *ListTestExecutionsBadGateway) IsCode(code int) bool { + return code == 502 +} + +// Code gets the status code for the list test executions bad gateway response +func (o *ListTestExecutionsBadGateway) Code() int { + return 502 +} + +func (o *ListTestExecutionsBadGateway) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/][%d] listTestExecutionsBadGateway %s", 502, payload) +} + +func (o *ListTestExecutionsBadGateway) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/][%d] listTestExecutionsBadGateway %s", 502, payload) +} + +func (o *ListTestExecutionsBadGateway) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListTestExecutionsBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/test_executions/query_test_executions_parameters.go b/client/test_executions/query_test_executions_parameters.go new file mode 100644 index 0000000..3a4db02 --- /dev/null +++ b/client/test_executions/query_test_executions_parameters.go @@ -0,0 +1,627 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package test_executions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewQueryTestExecutionsParams creates a new QueryTestExecutionsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewQueryTestExecutionsParams() *QueryTestExecutionsParams { + return &QueryTestExecutionsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewQueryTestExecutionsParamsWithTimeout creates a new QueryTestExecutionsParams object +// with the ability to set a timeout on a request. +func NewQueryTestExecutionsParamsWithTimeout(timeout time.Duration) *QueryTestExecutionsParams { + return &QueryTestExecutionsParams{ + timeout: timeout, + } +} + +// NewQueryTestExecutionsParamsWithContext creates a new QueryTestExecutionsParams object +// with the ability to set a context for a request. +func NewQueryTestExecutionsParamsWithContext(ctx context.Context) *QueryTestExecutionsParams { + return &QueryTestExecutionsParams{ + Context: ctx, + } +} + +// NewQueryTestExecutionsParamsWithHTTPClient creates a new QueryTestExecutionsParams object +// with the ability to set a custom HTTPClient for a request. +func NewQueryTestExecutionsParamsWithHTTPClient(client *http.Client) *QueryTestExecutionsParams { + return &QueryTestExecutionsParams{ + HTTPClient: client, + } +} + +/* +QueryTestExecutionsParams contains all the parameters to send to the API endpoint + + for the query test executions operation. + + Typically these are written to a http.Request. +*/ +type QueryTestExecutionsParams struct { + + /* ClusterName. + + Cluster name + */ + ClusterName *string + + /* Cursor. + + Start sending results from this cursor + */ + Cursor *string + + /* ExecutionPhase. + + Test execution phase + */ + ExecutionPhase *string + + /* From. + + Filter results starting from this time + */ + From *string + + /* GroupBy. + + Group results by entity (so far, only triggers is supported) + */ + GroupBy *string + + /* OrderDir. + + Sorting direction + */ + OrderDir *string + + /* OrgName. + + Signadot Org name + */ + OrgName string + + /* PageSize. + + Number of rows to be included in the response + */ + PageSize *string + + /* TargetRevision. + + Revision of the target routing context + */ + TargetRevision *string + + /* TargetRouteGroupName. + + Target route group name + */ + TargetRouteGroupName *string + + /* TargetSandboxName. + + Target sandbox name + */ + TargetSandboxName *string + + /* TestName. + + Test name + */ + TestName *string + + /* To. + + Filter results until this time + */ + To *string + + /* TriggerName. + + Trigger name + */ + TriggerName *string + + /* TriggerWorkload. + + Trigger workload in JSON format + */ + TriggerWorkload *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the query test executions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *QueryTestExecutionsParams) WithDefaults() *QueryTestExecutionsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the query test executions params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *QueryTestExecutionsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the query test executions params +func (o *QueryTestExecutionsParams) WithTimeout(timeout time.Duration) *QueryTestExecutionsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the query test executions params +func (o *QueryTestExecutionsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the query test executions params +func (o *QueryTestExecutionsParams) WithContext(ctx context.Context) *QueryTestExecutionsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the query test executions params +func (o *QueryTestExecutionsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the query test executions params +func (o *QueryTestExecutionsParams) WithHTTPClient(client *http.Client) *QueryTestExecutionsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the query test executions params +func (o *QueryTestExecutionsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithClusterName adds the clusterName to the query test executions params +func (o *QueryTestExecutionsParams) WithClusterName(clusterName *string) *QueryTestExecutionsParams { + o.SetClusterName(clusterName) + return o +} + +// SetClusterName adds the clusterName to the query test executions params +func (o *QueryTestExecutionsParams) SetClusterName(clusterName *string) { + o.ClusterName = clusterName +} + +// WithCursor adds the cursor to the query test executions params +func (o *QueryTestExecutionsParams) WithCursor(cursor *string) *QueryTestExecutionsParams { + o.SetCursor(cursor) + return o +} + +// SetCursor adds the cursor to the query test executions params +func (o *QueryTestExecutionsParams) SetCursor(cursor *string) { + o.Cursor = cursor +} + +// WithExecutionPhase adds the executionPhase to the query test executions params +func (o *QueryTestExecutionsParams) WithExecutionPhase(executionPhase *string) *QueryTestExecutionsParams { + o.SetExecutionPhase(executionPhase) + return o +} + +// SetExecutionPhase adds the executionPhase to the query test executions params +func (o *QueryTestExecutionsParams) SetExecutionPhase(executionPhase *string) { + o.ExecutionPhase = executionPhase +} + +// WithFrom adds the from to the query test executions params +func (o *QueryTestExecutionsParams) WithFrom(from *string) *QueryTestExecutionsParams { + o.SetFrom(from) + return o +} + +// SetFrom adds the from to the query test executions params +func (o *QueryTestExecutionsParams) SetFrom(from *string) { + o.From = from +} + +// WithGroupBy adds the groupBy to the query test executions params +func (o *QueryTestExecutionsParams) WithGroupBy(groupBy *string) *QueryTestExecutionsParams { + o.SetGroupBy(groupBy) + return o +} + +// SetGroupBy adds the groupBy to the query test executions params +func (o *QueryTestExecutionsParams) SetGroupBy(groupBy *string) { + o.GroupBy = groupBy +} + +// WithOrderDir adds the orderDir to the query test executions params +func (o *QueryTestExecutionsParams) WithOrderDir(orderDir *string) *QueryTestExecutionsParams { + o.SetOrderDir(orderDir) + return o +} + +// SetOrderDir adds the orderDir to the query test executions params +func (o *QueryTestExecutionsParams) SetOrderDir(orderDir *string) { + o.OrderDir = orderDir +} + +// WithOrgName adds the orgName to the query test executions params +func (o *QueryTestExecutionsParams) WithOrgName(orgName string) *QueryTestExecutionsParams { + o.SetOrgName(orgName) + return o +} + +// SetOrgName adds the orgName to the query test executions params +func (o *QueryTestExecutionsParams) SetOrgName(orgName string) { + o.OrgName = orgName +} + +// WithPageSize adds the pageSize to the query test executions params +func (o *QueryTestExecutionsParams) WithPageSize(pageSize *string) *QueryTestExecutionsParams { + o.SetPageSize(pageSize) + return o +} + +// SetPageSize adds the pageSize to the query test executions params +func (o *QueryTestExecutionsParams) SetPageSize(pageSize *string) { + o.PageSize = pageSize +} + +// WithTargetRevision adds the targetRevision to the query test executions params +func (o *QueryTestExecutionsParams) WithTargetRevision(targetRevision *string) *QueryTestExecutionsParams { + o.SetTargetRevision(targetRevision) + return o +} + +// SetTargetRevision adds the targetRevision to the query test executions params +func (o *QueryTestExecutionsParams) SetTargetRevision(targetRevision *string) { + o.TargetRevision = targetRevision +} + +// WithTargetRouteGroupName adds the targetRouteGroupName to the query test executions params +func (o *QueryTestExecutionsParams) WithTargetRouteGroupName(targetRouteGroupName *string) *QueryTestExecutionsParams { + o.SetTargetRouteGroupName(targetRouteGroupName) + return o +} + +// SetTargetRouteGroupName adds the targetRouteGroupName to the query test executions params +func (o *QueryTestExecutionsParams) SetTargetRouteGroupName(targetRouteGroupName *string) { + o.TargetRouteGroupName = targetRouteGroupName +} + +// WithTargetSandboxName adds the targetSandboxName to the query test executions params +func (o *QueryTestExecutionsParams) WithTargetSandboxName(targetSandboxName *string) *QueryTestExecutionsParams { + o.SetTargetSandboxName(targetSandboxName) + return o +} + +// SetTargetSandboxName adds the targetSandboxName to the query test executions params +func (o *QueryTestExecutionsParams) SetTargetSandboxName(targetSandboxName *string) { + o.TargetSandboxName = targetSandboxName +} + +// WithTestName adds the testName to the query test executions params +func (o *QueryTestExecutionsParams) WithTestName(testName *string) *QueryTestExecutionsParams { + o.SetTestName(testName) + return o +} + +// SetTestName adds the testName to the query test executions params +func (o *QueryTestExecutionsParams) SetTestName(testName *string) { + o.TestName = testName +} + +// WithTo adds the to to the query test executions params +func (o *QueryTestExecutionsParams) WithTo(to *string) *QueryTestExecutionsParams { + o.SetTo(to) + return o +} + +// SetTo adds the to to the query test executions params +func (o *QueryTestExecutionsParams) SetTo(to *string) { + o.To = to +} + +// WithTriggerName adds the triggerName to the query test executions params +func (o *QueryTestExecutionsParams) WithTriggerName(triggerName *string) *QueryTestExecutionsParams { + o.SetTriggerName(triggerName) + return o +} + +// SetTriggerName adds the triggerName to the query test executions params +func (o *QueryTestExecutionsParams) SetTriggerName(triggerName *string) { + o.TriggerName = triggerName +} + +// WithTriggerWorkload adds the triggerWorkload to the query test executions params +func (o *QueryTestExecutionsParams) WithTriggerWorkload(triggerWorkload *string) *QueryTestExecutionsParams { + o.SetTriggerWorkload(triggerWorkload) + return o +} + +// SetTriggerWorkload adds the triggerWorkload to the query test executions params +func (o *QueryTestExecutionsParams) SetTriggerWorkload(triggerWorkload *string) { + o.TriggerWorkload = triggerWorkload +} + +// WriteToRequest writes these params to a swagger request +func (o *QueryTestExecutionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ClusterName != nil { + + // query param clusterName + var qrClusterName string + + if o.ClusterName != nil { + qrClusterName = *o.ClusterName + } + qClusterName := qrClusterName + if qClusterName != "" { + + if err := r.SetQueryParam("clusterName", qClusterName); err != nil { + return err + } + } + } + + if o.Cursor != nil { + + // query param cursor + var qrCursor string + + if o.Cursor != nil { + qrCursor = *o.Cursor + } + qCursor := qrCursor + if qCursor != "" { + + if err := r.SetQueryParam("cursor", qCursor); err != nil { + return err + } + } + } + + if o.ExecutionPhase != nil { + + // query param executionPhase + var qrExecutionPhase string + + if o.ExecutionPhase != nil { + qrExecutionPhase = *o.ExecutionPhase + } + qExecutionPhase := qrExecutionPhase + if qExecutionPhase != "" { + + if err := r.SetQueryParam("executionPhase", qExecutionPhase); err != nil { + return err + } + } + } + + if o.From != nil { + + // query param from + var qrFrom string + + if o.From != nil { + qrFrom = *o.From + } + qFrom := qrFrom + if qFrom != "" { + + if err := r.SetQueryParam("from", qFrom); err != nil { + return err + } + } + } + + if o.GroupBy != nil { + + // query param groupBy + var qrGroupBy string + + if o.GroupBy != nil { + qrGroupBy = *o.GroupBy + } + qGroupBy := qrGroupBy + if qGroupBy != "" { + + if err := r.SetQueryParam("groupBy", qGroupBy); err != nil { + return err + } + } + } + + if o.OrderDir != nil { + + // query param orderDir + var qrOrderDir string + + if o.OrderDir != nil { + qrOrderDir = *o.OrderDir + } + qOrderDir := qrOrderDir + if qOrderDir != "" { + + if err := r.SetQueryParam("orderDir", qOrderDir); err != nil { + return err + } + } + } + + // path param orgName + if err := r.SetPathParam("orgName", o.OrgName); err != nil { + return err + } + + if o.PageSize != nil { + + // query param pageSize + var qrPageSize string + + if o.PageSize != nil { + qrPageSize = *o.PageSize + } + qPageSize := qrPageSize + if qPageSize != "" { + + if err := r.SetQueryParam("pageSize", qPageSize); err != nil { + return err + } + } + } + + if o.TargetRevision != nil { + + // query param targetRevision + var qrTargetRevision string + + if o.TargetRevision != nil { + qrTargetRevision = *o.TargetRevision + } + qTargetRevision := qrTargetRevision + if qTargetRevision != "" { + + if err := r.SetQueryParam("targetRevision", qTargetRevision); err != nil { + return err + } + } + } + + if o.TargetRouteGroupName != nil { + + // query param targetRouteGroupName + var qrTargetRouteGroupName string + + if o.TargetRouteGroupName != nil { + qrTargetRouteGroupName = *o.TargetRouteGroupName + } + qTargetRouteGroupName := qrTargetRouteGroupName + if qTargetRouteGroupName != "" { + + if err := r.SetQueryParam("targetRouteGroupName", qTargetRouteGroupName); err != nil { + return err + } + } + } + + if o.TargetSandboxName != nil { + + // query param targetSandboxName + var qrTargetSandboxName string + + if o.TargetSandboxName != nil { + qrTargetSandboxName = *o.TargetSandboxName + } + qTargetSandboxName := qrTargetSandboxName + if qTargetSandboxName != "" { + + if err := r.SetQueryParam("targetSandboxName", qTargetSandboxName); err != nil { + return err + } + } + } + + if o.TestName != nil { + + // query param testName + var qrTestName string + + if o.TestName != nil { + qrTestName = *o.TestName + } + qTestName := qrTestName + if qTestName != "" { + + if err := r.SetQueryParam("testName", qTestName); err != nil { + return err + } + } + } + + if o.To != nil { + + // query param to + var qrTo string + + if o.To != nil { + qrTo = *o.To + } + qTo := qrTo + if qTo != "" { + + if err := r.SetQueryParam("to", qTo); err != nil { + return err + } + } + } + + if o.TriggerName != nil { + + // query param triggerName + var qrTriggerName string + + if o.TriggerName != nil { + qrTriggerName = *o.TriggerName + } + qTriggerName := qrTriggerName + if qTriggerName != "" { + + if err := r.SetQueryParam("triggerName", qTriggerName); err != nil { + return err + } + } + } + + if o.TriggerWorkload != nil { + + // query param triggerWorkload + var qrTriggerWorkload string + + if o.TriggerWorkload != nil { + qrTriggerWorkload = *o.TriggerWorkload + } + qTriggerWorkload := qrTriggerWorkload + if qTriggerWorkload != "" { + + if err := r.SetQueryParam("triggerWorkload", qTriggerWorkload); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/test_executions/query_test_executions_responses.go b/client/test_executions/query_test_executions_responses.go new file mode 100644 index 0000000..a341070 --- /dev/null +++ b/client/test_executions/query_test_executions_responses.go @@ -0,0 +1,332 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package test_executions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/signadot/go-sdk/models" +) + +// QueryTestExecutionsReader is a Reader for the QueryTestExecutions structure. +type QueryTestExecutionsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *QueryTestExecutionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewQueryTestExecutionsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewQueryTestExecutionsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewQueryTestExecutionsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 502: + result := NewQueryTestExecutionsBadGateway() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /orgs/{orgName}/tests/executions/] query-test-executions", response, response.Code()) + } +} + +// NewQueryTestExecutionsOK creates a QueryTestExecutionsOK with default headers values +func NewQueryTestExecutionsOK() *QueryTestExecutionsOK { + return &QueryTestExecutionsOK{} +} + +/* +QueryTestExecutionsOK describes a response with status code 200, with default header values. + +OK +*/ +type QueryTestExecutionsOK struct { + Payload []*models.TestexecutionsQueryResult +} + +// IsSuccess returns true when this query test executions o k response has a 2xx status code +func (o *QueryTestExecutionsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this query test executions o k response has a 3xx status code +func (o *QueryTestExecutionsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this query test executions o k response has a 4xx status code +func (o *QueryTestExecutionsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this query test executions o k response has a 5xx status code +func (o *QueryTestExecutionsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this query test executions o k response a status code equal to that given +func (o *QueryTestExecutionsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the query test executions o k response +func (o *QueryTestExecutionsOK) Code() int { + return 200 +} + +func (o *QueryTestExecutionsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/executions/][%d] queryTestExecutionsOK %s", 200, payload) +} + +func (o *QueryTestExecutionsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/executions/][%d] queryTestExecutionsOK %s", 200, payload) +} + +func (o *QueryTestExecutionsOK) GetPayload() []*models.TestexecutionsQueryResult { + return o.Payload +} + +func (o *QueryTestExecutionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewQueryTestExecutionsBadRequest creates a QueryTestExecutionsBadRequest with default headers values +func NewQueryTestExecutionsBadRequest() *QueryTestExecutionsBadRequest { + return &QueryTestExecutionsBadRequest{} +} + +/* +QueryTestExecutionsBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type QueryTestExecutionsBadRequest struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this query test executions bad request response has a 2xx status code +func (o *QueryTestExecutionsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this query test executions bad request response has a 3xx status code +func (o *QueryTestExecutionsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this query test executions bad request response has a 4xx status code +func (o *QueryTestExecutionsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this query test executions bad request response has a 5xx status code +func (o *QueryTestExecutionsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this query test executions bad request response a status code equal to that given +func (o *QueryTestExecutionsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the query test executions bad request response +func (o *QueryTestExecutionsBadRequest) Code() int { + return 400 +} + +func (o *QueryTestExecutionsBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/executions/][%d] queryTestExecutionsBadRequest %s", 400, payload) +} + +func (o *QueryTestExecutionsBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/executions/][%d] queryTestExecutionsBadRequest %s", 400, payload) +} + +func (o *QueryTestExecutionsBadRequest) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *QueryTestExecutionsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewQueryTestExecutionsUnauthorized creates a QueryTestExecutionsUnauthorized with default headers values +func NewQueryTestExecutionsUnauthorized() *QueryTestExecutionsUnauthorized { + return &QueryTestExecutionsUnauthorized{} +} + +/* +QueryTestExecutionsUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type QueryTestExecutionsUnauthorized struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this query test executions unauthorized response has a 2xx status code +func (o *QueryTestExecutionsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this query test executions unauthorized response has a 3xx status code +func (o *QueryTestExecutionsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this query test executions unauthorized response has a 4xx status code +func (o *QueryTestExecutionsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this query test executions unauthorized response has a 5xx status code +func (o *QueryTestExecutionsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this query test executions unauthorized response a status code equal to that given +func (o *QueryTestExecutionsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the query test executions unauthorized response +func (o *QueryTestExecutionsUnauthorized) Code() int { + return 401 +} + +func (o *QueryTestExecutionsUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/executions/][%d] queryTestExecutionsUnauthorized %s", 401, payload) +} + +func (o *QueryTestExecutionsUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/executions/][%d] queryTestExecutionsUnauthorized %s", 401, payload) +} + +func (o *QueryTestExecutionsUnauthorized) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *QueryTestExecutionsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewQueryTestExecutionsBadGateway creates a QueryTestExecutionsBadGateway with default headers values +func NewQueryTestExecutionsBadGateway() *QueryTestExecutionsBadGateway { + return &QueryTestExecutionsBadGateway{} +} + +/* +QueryTestExecutionsBadGateway describes a response with status code 502, with default header values. + +Bad Gateway +*/ +type QueryTestExecutionsBadGateway struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this query test executions bad gateway response has a 2xx status code +func (o *QueryTestExecutionsBadGateway) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this query test executions bad gateway response has a 3xx status code +func (o *QueryTestExecutionsBadGateway) IsRedirect() bool { + return false +} + +// IsClientError returns true when this query test executions bad gateway response has a 4xx status code +func (o *QueryTestExecutionsBadGateway) IsClientError() bool { + return false +} + +// IsServerError returns true when this query test executions bad gateway response has a 5xx status code +func (o *QueryTestExecutionsBadGateway) IsServerError() bool { + return true +} + +// IsCode returns true when this query test executions bad gateway response a status code equal to that given +func (o *QueryTestExecutionsBadGateway) IsCode(code int) bool { + return code == 502 +} + +// Code gets the status code for the query test executions bad gateway response +func (o *QueryTestExecutionsBadGateway) Code() int { + return 502 +} + +func (o *QueryTestExecutionsBadGateway) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/executions/][%d] queryTestExecutionsBadGateway %s", 502, payload) +} + +func (o *QueryTestExecutionsBadGateway) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/executions/][%d] queryTestExecutionsBadGateway %s", 502, payload) +} + +func (o *QueryTestExecutionsBadGateway) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *QueryTestExecutionsBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/test_executions/test_execution_traffic_diff_parameters.go b/client/test_executions/test_execution_traffic_diff_parameters.go new file mode 100644 index 0000000..80f0cb7 --- /dev/null +++ b/client/test_executions/test_execution_traffic_diff_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package test_executions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewTestExecutionTrafficDiffParams creates a new TestExecutionTrafficDiffParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewTestExecutionTrafficDiffParams() *TestExecutionTrafficDiffParams { + return &TestExecutionTrafficDiffParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTestExecutionTrafficDiffParamsWithTimeout creates a new TestExecutionTrafficDiffParams object +// with the ability to set a timeout on a request. +func NewTestExecutionTrafficDiffParamsWithTimeout(timeout time.Duration) *TestExecutionTrafficDiffParams { + return &TestExecutionTrafficDiffParams{ + timeout: timeout, + } +} + +// NewTestExecutionTrafficDiffParamsWithContext creates a new TestExecutionTrafficDiffParams object +// with the ability to set a context for a request. +func NewTestExecutionTrafficDiffParamsWithContext(ctx context.Context) *TestExecutionTrafficDiffParams { + return &TestExecutionTrafficDiffParams{ + Context: ctx, + } +} + +// NewTestExecutionTrafficDiffParamsWithHTTPClient creates a new TestExecutionTrafficDiffParams object +// with the ability to set a custom HTTPClient for a request. +func NewTestExecutionTrafficDiffParamsWithHTTPClient(client *http.Client) *TestExecutionTrafficDiffParams { + return &TestExecutionTrafficDiffParams{ + HTTPClient: client, + } +} + +/* +TestExecutionTrafficDiffParams contains all the parameters to send to the API endpoint + + for the test execution traffic diff operation. + + Typically these are written to a http.Request. +*/ +type TestExecutionTrafficDiffParams struct { + + /* ExecutionName. + + Test Execution Name + */ + ExecutionName string + + /* OrgName. + + Signadot Org Name + */ + OrgName string + + /* TestName. + + Test Name + */ + TestName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the test execution traffic diff params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TestExecutionTrafficDiffParams) WithDefaults() *TestExecutionTrafficDiffParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the test execution traffic diff params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TestExecutionTrafficDiffParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the test execution traffic diff params +func (o *TestExecutionTrafficDiffParams) WithTimeout(timeout time.Duration) *TestExecutionTrafficDiffParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the test execution traffic diff params +func (o *TestExecutionTrafficDiffParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the test execution traffic diff params +func (o *TestExecutionTrafficDiffParams) WithContext(ctx context.Context) *TestExecutionTrafficDiffParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the test execution traffic diff params +func (o *TestExecutionTrafficDiffParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the test execution traffic diff params +func (o *TestExecutionTrafficDiffParams) WithHTTPClient(client *http.Client) *TestExecutionTrafficDiffParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the test execution traffic diff params +func (o *TestExecutionTrafficDiffParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExecutionName adds the executionName to the test execution traffic diff params +func (o *TestExecutionTrafficDiffParams) WithExecutionName(executionName string) *TestExecutionTrafficDiffParams { + o.SetExecutionName(executionName) + return o +} + +// SetExecutionName adds the executionName to the test execution traffic diff params +func (o *TestExecutionTrafficDiffParams) SetExecutionName(executionName string) { + o.ExecutionName = executionName +} + +// WithOrgName adds the orgName to the test execution traffic diff params +func (o *TestExecutionTrafficDiffParams) WithOrgName(orgName string) *TestExecutionTrafficDiffParams { + o.SetOrgName(orgName) + return o +} + +// SetOrgName adds the orgName to the test execution traffic diff params +func (o *TestExecutionTrafficDiffParams) SetOrgName(orgName string) { + o.OrgName = orgName +} + +// WithTestName adds the testName to the test execution traffic diff params +func (o *TestExecutionTrafficDiffParams) WithTestName(testName string) *TestExecutionTrafficDiffParams { + o.SetTestName(testName) + return o +} + +// SetTestName adds the testName to the test execution traffic diff params +func (o *TestExecutionTrafficDiffParams) SetTestName(testName string) { + o.TestName = testName +} + +// WriteToRequest writes these params to a swagger request +func (o *TestExecutionTrafficDiffParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param executionName + if err := r.SetPathParam("executionName", o.ExecutionName); err != nil { + return err + } + + // path param orgName + if err := r.SetPathParam("orgName", o.OrgName); err != nil { + return err + } + + // path param testName + if err := r.SetPathParam("testName", o.TestName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/test_executions/test_execution_traffic_diff_responses.go b/client/test_executions/test_execution_traffic_diff_responses.go new file mode 100644 index 0000000..e8c516d --- /dev/null +++ b/client/test_executions/test_execution_traffic_diff_responses.go @@ -0,0 +1,334 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package test_executions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/signadot/go-sdk/models" +) + +// TestExecutionTrafficDiffReader is a Reader for the TestExecutionTrafficDiff structure. +type TestExecutionTrafficDiffReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TestExecutionTrafficDiffReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTestExecutionTrafficDiffOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewTestExecutionTrafficDiffBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewTestExecutionTrafficDiffUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 502: + result := NewTestExecutionTrafficDiffBadGateway() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}/traffic-diff] test-execution-traffic-diff", response, response.Code()) + } +} + +// NewTestExecutionTrafficDiffOK creates a TestExecutionTrafficDiffOK with default headers values +func NewTestExecutionTrafficDiffOK() *TestExecutionTrafficDiffOK { + return &TestExecutionTrafficDiffOK{} +} + +/* +TestExecutionTrafficDiffOK describes a response with status code 200, with default header values. + +OK +*/ +type TestExecutionTrafficDiffOK struct { + Payload *models.TrafficDiffResult +} + +// IsSuccess returns true when this test execution traffic diff o k response has a 2xx status code +func (o *TestExecutionTrafficDiffOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this test execution traffic diff o k response has a 3xx status code +func (o *TestExecutionTrafficDiffOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test execution traffic diff o k response has a 4xx status code +func (o *TestExecutionTrafficDiffOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this test execution traffic diff o k response has a 5xx status code +func (o *TestExecutionTrafficDiffOK) IsServerError() bool { + return false +} + +// IsCode returns true when this test execution traffic diff o k response a status code equal to that given +func (o *TestExecutionTrafficDiffOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the test execution traffic diff o k response +func (o *TestExecutionTrafficDiffOK) Code() int { + return 200 +} + +func (o *TestExecutionTrafficDiffOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}/traffic-diff][%d] testExecutionTrafficDiffOK %s", 200, payload) +} + +func (o *TestExecutionTrafficDiffOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}/traffic-diff][%d] testExecutionTrafficDiffOK %s", 200, payload) +} + +func (o *TestExecutionTrafficDiffOK) GetPayload() *models.TrafficDiffResult { + return o.Payload +} + +func (o *TestExecutionTrafficDiffOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TrafficDiffResult) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTestExecutionTrafficDiffBadRequest creates a TestExecutionTrafficDiffBadRequest with default headers values +func NewTestExecutionTrafficDiffBadRequest() *TestExecutionTrafficDiffBadRequest { + return &TestExecutionTrafficDiffBadRequest{} +} + +/* +TestExecutionTrafficDiffBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type TestExecutionTrafficDiffBadRequest struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this test execution traffic diff bad request response has a 2xx status code +func (o *TestExecutionTrafficDiffBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test execution traffic diff bad request response has a 3xx status code +func (o *TestExecutionTrafficDiffBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test execution traffic diff bad request response has a 4xx status code +func (o *TestExecutionTrafficDiffBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this test execution traffic diff bad request response has a 5xx status code +func (o *TestExecutionTrafficDiffBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this test execution traffic diff bad request response a status code equal to that given +func (o *TestExecutionTrafficDiffBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the test execution traffic diff bad request response +func (o *TestExecutionTrafficDiffBadRequest) Code() int { + return 400 +} + +func (o *TestExecutionTrafficDiffBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}/traffic-diff][%d] testExecutionTrafficDiffBadRequest %s", 400, payload) +} + +func (o *TestExecutionTrafficDiffBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}/traffic-diff][%d] testExecutionTrafficDiffBadRequest %s", 400, payload) +} + +func (o *TestExecutionTrafficDiffBadRequest) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *TestExecutionTrafficDiffBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTestExecutionTrafficDiffUnauthorized creates a TestExecutionTrafficDiffUnauthorized with default headers values +func NewTestExecutionTrafficDiffUnauthorized() *TestExecutionTrafficDiffUnauthorized { + return &TestExecutionTrafficDiffUnauthorized{} +} + +/* +TestExecutionTrafficDiffUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type TestExecutionTrafficDiffUnauthorized struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this test execution traffic diff unauthorized response has a 2xx status code +func (o *TestExecutionTrafficDiffUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test execution traffic diff unauthorized response has a 3xx status code +func (o *TestExecutionTrafficDiffUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test execution traffic diff unauthorized response has a 4xx status code +func (o *TestExecutionTrafficDiffUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this test execution traffic diff unauthorized response has a 5xx status code +func (o *TestExecutionTrafficDiffUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this test execution traffic diff unauthorized response a status code equal to that given +func (o *TestExecutionTrafficDiffUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the test execution traffic diff unauthorized response +func (o *TestExecutionTrafficDiffUnauthorized) Code() int { + return 401 +} + +func (o *TestExecutionTrafficDiffUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}/traffic-diff][%d] testExecutionTrafficDiffUnauthorized %s", 401, payload) +} + +func (o *TestExecutionTrafficDiffUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}/traffic-diff][%d] testExecutionTrafficDiffUnauthorized %s", 401, payload) +} + +func (o *TestExecutionTrafficDiffUnauthorized) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *TestExecutionTrafficDiffUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTestExecutionTrafficDiffBadGateway creates a TestExecutionTrafficDiffBadGateway with default headers values +func NewTestExecutionTrafficDiffBadGateway() *TestExecutionTrafficDiffBadGateway { + return &TestExecutionTrafficDiffBadGateway{} +} + +/* +TestExecutionTrafficDiffBadGateway describes a response with status code 502, with default header values. + +Bad Gateway +*/ +type TestExecutionTrafficDiffBadGateway struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this test execution traffic diff bad gateway response has a 2xx status code +func (o *TestExecutionTrafficDiffBadGateway) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test execution traffic diff bad gateway response has a 3xx status code +func (o *TestExecutionTrafficDiffBadGateway) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test execution traffic diff bad gateway response has a 4xx status code +func (o *TestExecutionTrafficDiffBadGateway) IsClientError() bool { + return false +} + +// IsServerError returns true when this test execution traffic diff bad gateway response has a 5xx status code +func (o *TestExecutionTrafficDiffBadGateway) IsServerError() bool { + return true +} + +// IsCode returns true when this test execution traffic diff bad gateway response a status code equal to that given +func (o *TestExecutionTrafficDiffBadGateway) IsCode(code int) bool { + return code == 502 +} + +// Code gets the status code for the test execution traffic diff bad gateway response +func (o *TestExecutionTrafficDiffBadGateway) Code() int { + return 502 +} + +func (o *TestExecutionTrafficDiffBadGateway) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}/traffic-diff][%d] testExecutionTrafficDiffBadGateway %s", 502, payload) +} + +func (o *TestExecutionTrafficDiffBadGateway) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}/executions/{executionName}/traffic-diff][%d] testExecutionTrafficDiffBadGateway %s", 502, payload) +} + +func (o *TestExecutionTrafficDiffBadGateway) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *TestExecutionTrafficDiffBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/test_executions/test_executions_client.go b/client/test_executions/test_executions_client.go new file mode 100644 index 0000000..f3e1481 --- /dev/null +++ b/client/test_executions/test_executions_client.go @@ -0,0 +1,323 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package test_executions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new test executions API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new test executions API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new test executions API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for test executions API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + CancelTestExecution(params *CancelTestExecutionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CancelTestExecutionOK, error) + + CreateTestExecution(params *CreateTestExecutionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateTestExecutionOK, error) + + GetTestExecution(params *GetTestExecutionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTestExecutionOK, error) + + ListTestExecutions(params *ListTestExecutionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListTestExecutionsOK, error) + + QueryTestExecutions(params *QueryTestExecutionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*QueryTestExecutionsOK, error) + + TestExecutionTrafficDiff(params *TestExecutionTrafficDiffParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TestExecutionTrafficDiffOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +CancelTestExecution cancels a test execution + +Cancel a given test execution. +*/ +func (a *Client) CancelTestExecution(params *CancelTestExecutionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CancelTestExecutionOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCancelTestExecutionParams() + } + op := &runtime.ClientOperation{ + ID: "cancel-test-execution", + Method: "POST", + PathPattern: "/orgs/{orgName}/tests/{testName}/executions/{executionName}/cancel", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &CancelTestExecutionReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*CancelTestExecutionOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for cancel-test-execution: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +CreateTestExecution creates a test execution + +Creates a test with the provided parameters. +*/ +func (a *Client) CreateTestExecution(params *CreateTestExecutionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateTestExecutionOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateTestExecutionParams() + } + op := &runtime.ClientOperation{ + ID: "create-test-execution", + Method: "POST", + PathPattern: "/orgs/{orgName}/tests/{testName}/executions/", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &CreateTestExecutionReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*CreateTestExecutionOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for create-test-execution: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetTestExecution gets a test execution + +Fetch the details about a given test execution. +*/ +func (a *Client) GetTestExecution(params *GetTestExecutionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTestExecutionOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetTestExecutionParams() + } + op := &runtime.ClientOperation{ + ID: "get-test-execution", + Method: "GET", + PathPattern: "/orgs/{orgName}/tests/{testName}/executions/{executionName}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetTestExecutionReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetTestExecutionOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for get-test-execution: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ListTestExecutions lists test executions + +List test executions for a given test +*/ +func (a *Client) ListTestExecutions(params *ListTestExecutionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListTestExecutionsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListTestExecutionsParams() + } + op := &runtime.ClientOperation{ + ID: "list-test-executions", + Method: "GET", + PathPattern: "/orgs/{orgName}/tests/{testName}/executions/", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListTestExecutionsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListTestExecutionsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for list-test-executions: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +QueryTestExecutions queries test executions + +Query test executions based on different criteria +*/ +func (a *Client) QueryTestExecutions(params *QueryTestExecutionsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*QueryTestExecutionsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewQueryTestExecutionsParams() + } + op := &runtime.ClientOperation{ + ID: "query-test-executions", + Method: "GET", + PathPattern: "/orgs/{orgName}/tests/executions/", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &QueryTestExecutionsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*QueryTestExecutionsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for query-test-executions: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +TestExecutionTrafficDiff gets the full traffic diff of a test execution + +Get the full traffic diff of a test execution +*/ +func (a *Client) TestExecutionTrafficDiff(params *TestExecutionTrafficDiffParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TestExecutionTrafficDiffOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTestExecutionTrafficDiffParams() + } + op := &runtime.ClientOperation{ + ID: "test-execution-traffic-diff", + Method: "GET", + PathPattern: "/orgs/{orgName}/tests/{testName}/executions/{executionName}/traffic-diff", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &TestExecutionTrafficDiffReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TestExecutionTrafficDiffOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for test-execution-traffic-diff: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/tests/apply_test_swagger_parameters.go b/client/tests/apply_test_swagger_parameters.go new file mode 100644 index 0000000..89cb29d --- /dev/null +++ b/client/tests/apply_test_swagger_parameters.go @@ -0,0 +1,197 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/signadot/go-sdk/models" +) + +// NewApplyTestParams creates a new ApplyTestParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplyTestParams() *ApplyTestParams { + return &ApplyTestParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplyTestParamsWithTimeout creates a new ApplyTestParams object +// with the ability to set a timeout on a request. +func NewApplyTestParamsWithTimeout(timeout time.Duration) *ApplyTestParams { + return &ApplyTestParams{ + timeout: timeout, + } +} + +// NewApplyTestParamsWithContext creates a new ApplyTestParams object +// with the ability to set a context for a request. +func NewApplyTestParamsWithContext(ctx context.Context) *ApplyTestParams { + return &ApplyTestParams{ + Context: ctx, + } +} + +// NewApplyTestParamsWithHTTPClient creates a new ApplyTestParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplyTestParamsWithHTTPClient(client *http.Client) *ApplyTestParams { + return &ApplyTestParams{ + HTTPClient: client, + } +} + +/* +ApplyTestParams contains all the parameters to send to the API endpoint + + for the apply test operation. + + Typically these are written to a http.Request. +*/ +type ApplyTestParams struct { + + /* Data. + + Test Spec + */ + Data *models.TestSpec + + /* OrgName. + + Signadot Org Name + */ + OrgName string + + /* TestName. + + Test Name + */ + TestName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the apply test params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplyTestParams) WithDefaults() *ApplyTestParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the apply test params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplyTestParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the apply test params +func (o *ApplyTestParams) WithTimeout(timeout time.Duration) *ApplyTestParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the apply test params +func (o *ApplyTestParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the apply test params +func (o *ApplyTestParams) WithContext(ctx context.Context) *ApplyTestParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the apply test params +func (o *ApplyTestParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the apply test params +func (o *ApplyTestParams) WithHTTPClient(client *http.Client) *ApplyTestParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the apply test params +func (o *ApplyTestParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithData adds the data to the apply test params +func (o *ApplyTestParams) WithData(data *models.TestSpec) *ApplyTestParams { + o.SetData(data) + return o +} + +// SetData adds the data to the apply test params +func (o *ApplyTestParams) SetData(data *models.TestSpec) { + o.Data = data +} + +// WithOrgName adds the orgName to the apply test params +func (o *ApplyTestParams) WithOrgName(orgName string) *ApplyTestParams { + o.SetOrgName(orgName) + return o +} + +// SetOrgName adds the orgName to the apply test params +func (o *ApplyTestParams) SetOrgName(orgName string) { + o.OrgName = orgName +} + +// WithTestName adds the testName to the apply test params +func (o *ApplyTestParams) WithTestName(testName string) *ApplyTestParams { + o.SetTestName(testName) + return o +} + +// SetTestName adds the testName to the apply test params +func (o *ApplyTestParams) SetTestName(testName string) { + o.TestName = testName +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplyTestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Data != nil { + if err := r.SetBodyParam(o.Data); err != nil { + return err + } + } + + // path param orgName + if err := r.SetPathParam("orgName", o.OrgName); err != nil { + return err + } + + // path param testName + if err := r.SetPathParam("testName", o.TestName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/tests/apply_test_swagger_responses.go b/client/tests/apply_test_swagger_responses.go new file mode 100644 index 0000000..373d705 --- /dev/null +++ b/client/tests/apply_test_swagger_responses.go @@ -0,0 +1,334 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/signadot/go-sdk/models" +) + +// ApplyTestReader is a Reader for the ApplyTest structure. +type ApplyTestReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplyTestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplyTestOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewApplyTestBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewApplyTestUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 502: + result := NewApplyTestBadGateway() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /orgs/{orgName}/tests/{testName}] apply-test", response, response.Code()) + } +} + +// NewApplyTestOK creates a ApplyTestOK with default headers values +func NewApplyTestOK() *ApplyTestOK { + return &ApplyTestOK{} +} + +/* +ApplyTestOK describes a response with status code 200, with default header values. + +OK +*/ +type ApplyTestOK struct { + Payload *models.Test +} + +// IsSuccess returns true when this apply test o k response has a 2xx status code +func (o *ApplyTestOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this apply test o k response has a 3xx status code +func (o *ApplyTestOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this apply test o k response has a 4xx status code +func (o *ApplyTestOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this apply test o k response has a 5xx status code +func (o *ApplyTestOK) IsServerError() bool { + return false +} + +// IsCode returns true when this apply test o k response a status code equal to that given +func (o *ApplyTestOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the apply test o k response +func (o *ApplyTestOK) Code() int { + return 200 +} + +func (o *ApplyTestOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /orgs/{orgName}/tests/{testName}][%d] applyTestOK %s", 200, payload) +} + +func (o *ApplyTestOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /orgs/{orgName}/tests/{testName}][%d] applyTestOK %s", 200, payload) +} + +func (o *ApplyTestOK) GetPayload() *models.Test { + return o.Payload +} + +func (o *ApplyTestOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Test) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplyTestBadRequest creates a ApplyTestBadRequest with default headers values +func NewApplyTestBadRequest() *ApplyTestBadRequest { + return &ApplyTestBadRequest{} +} + +/* +ApplyTestBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ApplyTestBadRequest struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this apply test bad request response has a 2xx status code +func (o *ApplyTestBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this apply test bad request response has a 3xx status code +func (o *ApplyTestBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this apply test bad request response has a 4xx status code +func (o *ApplyTestBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this apply test bad request response has a 5xx status code +func (o *ApplyTestBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this apply test bad request response a status code equal to that given +func (o *ApplyTestBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the apply test bad request response +func (o *ApplyTestBadRequest) Code() int { + return 400 +} + +func (o *ApplyTestBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /orgs/{orgName}/tests/{testName}][%d] applyTestBadRequest %s", 400, payload) +} + +func (o *ApplyTestBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /orgs/{orgName}/tests/{testName}][%d] applyTestBadRequest %s", 400, payload) +} + +func (o *ApplyTestBadRequest) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ApplyTestBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplyTestUnauthorized creates a ApplyTestUnauthorized with default headers values +func NewApplyTestUnauthorized() *ApplyTestUnauthorized { + return &ApplyTestUnauthorized{} +} + +/* +ApplyTestUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type ApplyTestUnauthorized struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this apply test unauthorized response has a 2xx status code +func (o *ApplyTestUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this apply test unauthorized response has a 3xx status code +func (o *ApplyTestUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this apply test unauthorized response has a 4xx status code +func (o *ApplyTestUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this apply test unauthorized response has a 5xx status code +func (o *ApplyTestUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this apply test unauthorized response a status code equal to that given +func (o *ApplyTestUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the apply test unauthorized response +func (o *ApplyTestUnauthorized) Code() int { + return 401 +} + +func (o *ApplyTestUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /orgs/{orgName}/tests/{testName}][%d] applyTestUnauthorized %s", 401, payload) +} + +func (o *ApplyTestUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /orgs/{orgName}/tests/{testName}][%d] applyTestUnauthorized %s", 401, payload) +} + +func (o *ApplyTestUnauthorized) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ApplyTestUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplyTestBadGateway creates a ApplyTestBadGateway with default headers values +func NewApplyTestBadGateway() *ApplyTestBadGateway { + return &ApplyTestBadGateway{} +} + +/* +ApplyTestBadGateway describes a response with status code 502, with default header values. + +Bad Gateway +*/ +type ApplyTestBadGateway struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this apply test bad gateway response has a 2xx status code +func (o *ApplyTestBadGateway) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this apply test bad gateway response has a 3xx status code +func (o *ApplyTestBadGateway) IsRedirect() bool { + return false +} + +// IsClientError returns true when this apply test bad gateway response has a 4xx status code +func (o *ApplyTestBadGateway) IsClientError() bool { + return false +} + +// IsServerError returns true when this apply test bad gateway response has a 5xx status code +func (o *ApplyTestBadGateway) IsServerError() bool { + return true +} + +// IsCode returns true when this apply test bad gateway response a status code equal to that given +func (o *ApplyTestBadGateway) IsCode(code int) bool { + return code == 502 +} + +// Code gets the status code for the apply test bad gateway response +func (o *ApplyTestBadGateway) Code() int { + return 502 +} + +func (o *ApplyTestBadGateway) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /orgs/{orgName}/tests/{testName}][%d] applyTestBadGateway %s", 502, payload) +} + +func (o *ApplyTestBadGateway) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /orgs/{orgName}/tests/{testName}][%d] applyTestBadGateway %s", 502, payload) +} + +func (o *ApplyTestBadGateway) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ApplyTestBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/tests/delete_test_swagger_parameters.go b/client/tests/delete_test_swagger_parameters.go new file mode 100644 index 0000000..ac4d9ac --- /dev/null +++ b/client/tests/delete_test_swagger_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeleteTestParams creates a new DeleteTestParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteTestParams() *DeleteTestParams { + return &DeleteTestParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteTestParamsWithTimeout creates a new DeleteTestParams object +// with the ability to set a timeout on a request. +func NewDeleteTestParamsWithTimeout(timeout time.Duration) *DeleteTestParams { + return &DeleteTestParams{ + timeout: timeout, + } +} + +// NewDeleteTestParamsWithContext creates a new DeleteTestParams object +// with the ability to set a context for a request. +func NewDeleteTestParamsWithContext(ctx context.Context) *DeleteTestParams { + return &DeleteTestParams{ + Context: ctx, + } +} + +// NewDeleteTestParamsWithHTTPClient creates a new DeleteTestParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteTestParamsWithHTTPClient(client *http.Client) *DeleteTestParams { + return &DeleteTestParams{ + HTTPClient: client, + } +} + +/* +DeleteTestParams contains all the parameters to send to the API endpoint + + for the delete test operation. + + Typically these are written to a http.Request. +*/ +type DeleteTestParams struct { + + /* OrgName. + + Signadot Org Name + */ + OrgName string + + /* TestName. + + Test Name + */ + TestName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete test params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteTestParams) WithDefaults() *DeleteTestParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete test params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteTestParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete test params +func (o *DeleteTestParams) WithTimeout(timeout time.Duration) *DeleteTestParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete test params +func (o *DeleteTestParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete test params +func (o *DeleteTestParams) WithContext(ctx context.Context) *DeleteTestParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete test params +func (o *DeleteTestParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete test params +func (o *DeleteTestParams) WithHTTPClient(client *http.Client) *DeleteTestParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete test params +func (o *DeleteTestParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithOrgName adds the orgName to the delete test params +func (o *DeleteTestParams) WithOrgName(orgName string) *DeleteTestParams { + o.SetOrgName(orgName) + return o +} + +// SetOrgName adds the orgName to the delete test params +func (o *DeleteTestParams) SetOrgName(orgName string) { + o.OrgName = orgName +} + +// WithTestName adds the testName to the delete test params +func (o *DeleteTestParams) WithTestName(testName string) *DeleteTestParams { + o.SetTestName(testName) + return o +} + +// SetTestName adds the testName to the delete test params +func (o *DeleteTestParams) SetTestName(testName string) { + o.TestName = testName +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteTestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param orgName + if err := r.SetPathParam("orgName", o.OrgName); err != nil { + return err + } + + // path param testName + if err := r.SetPathParam("testName", o.TestName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/tests/delete_test_swagger_responses.go b/client/tests/delete_test_swagger_responses.go new file mode 100644 index 0000000..7eaa7f8 --- /dev/null +++ b/client/tests/delete_test_swagger_responses.go @@ -0,0 +1,332 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/signadot/go-sdk/models" +) + +// DeleteTestReader is a Reader for the DeleteTest structure. +type DeleteTestReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteTestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteTestOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDeleteTestBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDeleteTestUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 502: + result := NewDeleteTestBadGateway() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /orgs/{orgName}/tests/{testName}] delete-test", response, response.Code()) + } +} + +// NewDeleteTestOK creates a DeleteTestOK with default headers values +func NewDeleteTestOK() *DeleteTestOK { + return &DeleteTestOK{} +} + +/* +DeleteTestOK describes a response with status code 200, with default header values. + +OK +*/ +type DeleteTestOK struct { + Payload models.EmptyResponse +} + +// IsSuccess returns true when this delete test o k response has a 2xx status code +func (o *DeleteTestOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete test o k response has a 3xx status code +func (o *DeleteTestOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete test o k response has a 4xx status code +func (o *DeleteTestOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete test o k response has a 5xx status code +func (o *DeleteTestOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete test o k response a status code equal to that given +func (o *DeleteTestOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the delete test o k response +func (o *DeleteTestOK) Code() int { + return 200 +} + +func (o *DeleteTestOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /orgs/{orgName}/tests/{testName}][%d] deleteTestOK %s", 200, payload) +} + +func (o *DeleteTestOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /orgs/{orgName}/tests/{testName}][%d] deleteTestOK %s", 200, payload) +} + +func (o *DeleteTestOK) GetPayload() models.EmptyResponse { + return o.Payload +} + +func (o *DeleteTestOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeleteTestBadRequest creates a DeleteTestBadRequest with default headers values +func NewDeleteTestBadRequest() *DeleteTestBadRequest { + return &DeleteTestBadRequest{} +} + +/* +DeleteTestBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type DeleteTestBadRequest struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this delete test bad request response has a 2xx status code +func (o *DeleteTestBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete test bad request response has a 3xx status code +func (o *DeleteTestBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete test bad request response has a 4xx status code +func (o *DeleteTestBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this delete test bad request response has a 5xx status code +func (o *DeleteTestBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this delete test bad request response a status code equal to that given +func (o *DeleteTestBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the delete test bad request response +func (o *DeleteTestBadRequest) Code() int { + return 400 +} + +func (o *DeleteTestBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /orgs/{orgName}/tests/{testName}][%d] deleteTestBadRequest %s", 400, payload) +} + +func (o *DeleteTestBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /orgs/{orgName}/tests/{testName}][%d] deleteTestBadRequest %s", 400, payload) +} + +func (o *DeleteTestBadRequest) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *DeleteTestBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeleteTestUnauthorized creates a DeleteTestUnauthorized with default headers values +func NewDeleteTestUnauthorized() *DeleteTestUnauthorized { + return &DeleteTestUnauthorized{} +} + +/* +DeleteTestUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type DeleteTestUnauthorized struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this delete test unauthorized response has a 2xx status code +func (o *DeleteTestUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete test unauthorized response has a 3xx status code +func (o *DeleteTestUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete test unauthorized response has a 4xx status code +func (o *DeleteTestUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this delete test unauthorized response has a 5xx status code +func (o *DeleteTestUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this delete test unauthorized response a status code equal to that given +func (o *DeleteTestUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the delete test unauthorized response +func (o *DeleteTestUnauthorized) Code() int { + return 401 +} + +func (o *DeleteTestUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /orgs/{orgName}/tests/{testName}][%d] deleteTestUnauthorized %s", 401, payload) +} + +func (o *DeleteTestUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /orgs/{orgName}/tests/{testName}][%d] deleteTestUnauthorized %s", 401, payload) +} + +func (o *DeleteTestUnauthorized) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *DeleteTestUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeleteTestBadGateway creates a DeleteTestBadGateway with default headers values +func NewDeleteTestBadGateway() *DeleteTestBadGateway { + return &DeleteTestBadGateway{} +} + +/* +DeleteTestBadGateway describes a response with status code 502, with default header values. + +Bad Gateway +*/ +type DeleteTestBadGateway struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this delete test bad gateway response has a 2xx status code +func (o *DeleteTestBadGateway) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete test bad gateway response has a 3xx status code +func (o *DeleteTestBadGateway) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete test bad gateway response has a 4xx status code +func (o *DeleteTestBadGateway) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete test bad gateway response has a 5xx status code +func (o *DeleteTestBadGateway) IsServerError() bool { + return true +} + +// IsCode returns true when this delete test bad gateway response a status code equal to that given +func (o *DeleteTestBadGateway) IsCode(code int) bool { + return code == 502 +} + +// Code gets the status code for the delete test bad gateway response +func (o *DeleteTestBadGateway) Code() int { + return 502 +} + +func (o *DeleteTestBadGateway) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /orgs/{orgName}/tests/{testName}][%d] deleteTestBadGateway %s", 502, payload) +} + +func (o *DeleteTestBadGateway) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /orgs/{orgName}/tests/{testName}][%d] deleteTestBadGateway %s", 502, payload) +} + +func (o *DeleteTestBadGateway) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *DeleteTestBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/tests/get_test_swagger_parameters.go b/client/tests/get_test_swagger_parameters.go new file mode 100644 index 0000000..5d56ab7 --- /dev/null +++ b/client/tests/get_test_swagger_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGetTestParams creates a new GetTestParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetTestParams() *GetTestParams { + return &GetTestParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetTestParamsWithTimeout creates a new GetTestParams object +// with the ability to set a timeout on a request. +func NewGetTestParamsWithTimeout(timeout time.Duration) *GetTestParams { + return &GetTestParams{ + timeout: timeout, + } +} + +// NewGetTestParamsWithContext creates a new GetTestParams object +// with the ability to set a context for a request. +func NewGetTestParamsWithContext(ctx context.Context) *GetTestParams { + return &GetTestParams{ + Context: ctx, + } +} + +// NewGetTestParamsWithHTTPClient creates a new GetTestParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetTestParamsWithHTTPClient(client *http.Client) *GetTestParams { + return &GetTestParams{ + HTTPClient: client, + } +} + +/* +GetTestParams contains all the parameters to send to the API endpoint + + for the get test operation. + + Typically these are written to a http.Request. +*/ +type GetTestParams struct { + + /* OrgName. + + Signadot Org Name + */ + OrgName string + + /* TestName. + + Test Name + */ + TestName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get test params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTestParams) WithDefaults() *GetTestParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get test params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTestParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get test params +func (o *GetTestParams) WithTimeout(timeout time.Duration) *GetTestParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get test params +func (o *GetTestParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get test params +func (o *GetTestParams) WithContext(ctx context.Context) *GetTestParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get test params +func (o *GetTestParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get test params +func (o *GetTestParams) WithHTTPClient(client *http.Client) *GetTestParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get test params +func (o *GetTestParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithOrgName adds the orgName to the get test params +func (o *GetTestParams) WithOrgName(orgName string) *GetTestParams { + o.SetOrgName(orgName) + return o +} + +// SetOrgName adds the orgName to the get test params +func (o *GetTestParams) SetOrgName(orgName string) { + o.OrgName = orgName +} + +// WithTestName adds the testName to the get test params +func (o *GetTestParams) WithTestName(testName string) *GetTestParams { + o.SetTestName(testName) + return o +} + +// SetTestName adds the testName to the get test params +func (o *GetTestParams) SetTestName(testName string) { + o.TestName = testName +} + +// WriteToRequest writes these params to a swagger request +func (o *GetTestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param orgName + if err := r.SetPathParam("orgName", o.OrgName); err != nil { + return err + } + + // path param testName + if err := r.SetPathParam("testName", o.TestName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/tests/get_test_swagger_responses.go b/client/tests/get_test_swagger_responses.go new file mode 100644 index 0000000..752c96a --- /dev/null +++ b/client/tests/get_test_swagger_responses.go @@ -0,0 +1,334 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/signadot/go-sdk/models" +) + +// GetTestReader is a Reader for the GetTest structure. +type GetTestReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetTestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetTestOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewGetTestBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewGetTestUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 502: + result := NewGetTestBadGateway() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /orgs/{orgName}/tests/{testName}] get-test", response, response.Code()) + } +} + +// NewGetTestOK creates a GetTestOK with default headers values +func NewGetTestOK() *GetTestOK { + return &GetTestOK{} +} + +/* +GetTestOK describes a response with status code 200, with default header values. + +OK +*/ +type GetTestOK struct { + Payload *models.Test +} + +// IsSuccess returns true when this get test o k response has a 2xx status code +func (o *GetTestOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get test o k response has a 3xx status code +func (o *GetTestOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get test o k response has a 4xx status code +func (o *GetTestOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get test o k response has a 5xx status code +func (o *GetTestOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get test o k response a status code equal to that given +func (o *GetTestOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get test o k response +func (o *GetTestOK) Code() int { + return 200 +} + +func (o *GetTestOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}][%d] getTestOK %s", 200, payload) +} + +func (o *GetTestOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}][%d] getTestOK %s", 200, payload) +} + +func (o *GetTestOK) GetPayload() *models.Test { + return o.Payload +} + +func (o *GetTestOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Test) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetTestBadRequest creates a GetTestBadRequest with default headers values +func NewGetTestBadRequest() *GetTestBadRequest { + return &GetTestBadRequest{} +} + +/* +GetTestBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type GetTestBadRequest struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this get test bad request response has a 2xx status code +func (o *GetTestBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get test bad request response has a 3xx status code +func (o *GetTestBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get test bad request response has a 4xx status code +func (o *GetTestBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this get test bad request response has a 5xx status code +func (o *GetTestBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this get test bad request response a status code equal to that given +func (o *GetTestBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the get test bad request response +func (o *GetTestBadRequest) Code() int { + return 400 +} + +func (o *GetTestBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}][%d] getTestBadRequest %s", 400, payload) +} + +func (o *GetTestBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}][%d] getTestBadRequest %s", 400, payload) +} + +func (o *GetTestBadRequest) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *GetTestBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetTestUnauthorized creates a GetTestUnauthorized with default headers values +func NewGetTestUnauthorized() *GetTestUnauthorized { + return &GetTestUnauthorized{} +} + +/* +GetTestUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type GetTestUnauthorized struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this get test unauthorized response has a 2xx status code +func (o *GetTestUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get test unauthorized response has a 3xx status code +func (o *GetTestUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get test unauthorized response has a 4xx status code +func (o *GetTestUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this get test unauthorized response has a 5xx status code +func (o *GetTestUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this get test unauthorized response a status code equal to that given +func (o *GetTestUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the get test unauthorized response +func (o *GetTestUnauthorized) Code() int { + return 401 +} + +func (o *GetTestUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}][%d] getTestUnauthorized %s", 401, payload) +} + +func (o *GetTestUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}][%d] getTestUnauthorized %s", 401, payload) +} + +func (o *GetTestUnauthorized) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *GetTestUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetTestBadGateway creates a GetTestBadGateway with default headers values +func NewGetTestBadGateway() *GetTestBadGateway { + return &GetTestBadGateway{} +} + +/* +GetTestBadGateway describes a response with status code 502, with default header values. + +Bad Gateway +*/ +type GetTestBadGateway struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this get test bad gateway response has a 2xx status code +func (o *GetTestBadGateway) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get test bad gateway response has a 3xx status code +func (o *GetTestBadGateway) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get test bad gateway response has a 4xx status code +func (o *GetTestBadGateway) IsClientError() bool { + return false +} + +// IsServerError returns true when this get test bad gateway response has a 5xx status code +func (o *GetTestBadGateway) IsServerError() bool { + return true +} + +// IsCode returns true when this get test bad gateway response a status code equal to that given +func (o *GetTestBadGateway) IsCode(code int) bool { + return code == 502 +} + +// Code gets the status code for the get test bad gateway response +func (o *GetTestBadGateway) Code() int { + return 502 +} + +func (o *GetTestBadGateway) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}][%d] getTestBadGateway %s", 502, payload) +} + +func (o *GetTestBadGateway) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests/{testName}][%d] getTestBadGateway %s", 502, payload) +} + +func (o *GetTestBadGateway) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *GetTestBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/tests/list_tests_parameters.go b/client/tests/list_tests_parameters.go new file mode 100644 index 0000000..252601e --- /dev/null +++ b/client/tests/list_tests_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewListTestsParams creates a new ListTestsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListTestsParams() *ListTestsParams { + return &ListTestsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListTestsParamsWithTimeout creates a new ListTestsParams object +// with the ability to set a timeout on a request. +func NewListTestsParamsWithTimeout(timeout time.Duration) *ListTestsParams { + return &ListTestsParams{ + timeout: timeout, + } +} + +// NewListTestsParamsWithContext creates a new ListTestsParams object +// with the ability to set a context for a request. +func NewListTestsParamsWithContext(ctx context.Context) *ListTestsParams { + return &ListTestsParams{ + Context: ctx, + } +} + +// NewListTestsParamsWithHTTPClient creates a new ListTestsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListTestsParamsWithHTTPClient(client *http.Client) *ListTestsParams { + return &ListTestsParams{ + HTTPClient: client, + } +} + +/* +ListTestsParams contains all the parameters to send to the API endpoint + + for the list tests operation. + + Typically these are written to a http.Request. +*/ +type ListTestsParams struct { + + /* OrgName. + + Signadot Org Name + */ + OrgName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list tests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListTestsParams) WithDefaults() *ListTestsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list tests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListTestsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list tests params +func (o *ListTestsParams) WithTimeout(timeout time.Duration) *ListTestsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list tests params +func (o *ListTestsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list tests params +func (o *ListTestsParams) WithContext(ctx context.Context) *ListTestsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list tests params +func (o *ListTestsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list tests params +func (o *ListTestsParams) WithHTTPClient(client *http.Client) *ListTestsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list tests params +func (o *ListTestsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithOrgName adds the orgName to the list tests params +func (o *ListTestsParams) WithOrgName(orgName string) *ListTestsParams { + o.SetOrgName(orgName) + return o +} + +// SetOrgName adds the orgName to the list tests params +func (o *ListTestsParams) SetOrgName(orgName string) { + o.OrgName = orgName +} + +// WriteToRequest writes these params to a swagger request +func (o *ListTestsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param orgName + if err := r.SetPathParam("orgName", o.OrgName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/tests/list_tests_responses.go b/client/tests/list_tests_responses.go new file mode 100644 index 0000000..eb97f59 --- /dev/null +++ b/client/tests/list_tests_responses.go @@ -0,0 +1,332 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/signadot/go-sdk/models" +) + +// ListTestsReader is a Reader for the ListTests structure. +type ListTestsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListTestsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListTestsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListTestsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListTestsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 502: + result := NewListTestsBadGateway() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /orgs/{orgName}/tests] list-tests", response, response.Code()) + } +} + +// NewListTestsOK creates a ListTestsOK with default headers values +func NewListTestsOK() *ListTestsOK { + return &ListTestsOK{} +} + +/* +ListTestsOK describes a response with status code 200, with default header values. + +OK +*/ +type ListTestsOK struct { + Payload []*models.Test +} + +// IsSuccess returns true when this list tests o k response has a 2xx status code +func (o *ListTestsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list tests o k response has a 3xx status code +func (o *ListTestsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list tests o k response has a 4xx status code +func (o *ListTestsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list tests o k response has a 5xx status code +func (o *ListTestsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list tests o k response a status code equal to that given +func (o *ListTestsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list tests o k response +func (o *ListTestsOK) Code() int { + return 200 +} + +func (o *ListTestsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests][%d] listTestsOK %s", 200, payload) +} + +func (o *ListTestsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests][%d] listTestsOK %s", 200, payload) +} + +func (o *ListTestsOK) GetPayload() []*models.Test { + return o.Payload +} + +func (o *ListTestsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListTestsBadRequest creates a ListTestsBadRequest with default headers values +func NewListTestsBadRequest() *ListTestsBadRequest { + return &ListTestsBadRequest{} +} + +/* +ListTestsBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ListTestsBadRequest struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this list tests bad request response has a 2xx status code +func (o *ListTestsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list tests bad request response has a 3xx status code +func (o *ListTestsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list tests bad request response has a 4xx status code +func (o *ListTestsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list tests bad request response has a 5xx status code +func (o *ListTestsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list tests bad request response a status code equal to that given +func (o *ListTestsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list tests bad request response +func (o *ListTestsBadRequest) Code() int { + return 400 +} + +func (o *ListTestsBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests][%d] listTestsBadRequest %s", 400, payload) +} + +func (o *ListTestsBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests][%d] listTestsBadRequest %s", 400, payload) +} + +func (o *ListTestsBadRequest) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListTestsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListTestsUnauthorized creates a ListTestsUnauthorized with default headers values +func NewListTestsUnauthorized() *ListTestsUnauthorized { + return &ListTestsUnauthorized{} +} + +/* +ListTestsUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type ListTestsUnauthorized struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this list tests unauthorized response has a 2xx status code +func (o *ListTestsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list tests unauthorized response has a 3xx status code +func (o *ListTestsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list tests unauthorized response has a 4xx status code +func (o *ListTestsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list tests unauthorized response has a 5xx status code +func (o *ListTestsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list tests unauthorized response a status code equal to that given +func (o *ListTestsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list tests unauthorized response +func (o *ListTestsUnauthorized) Code() int { + return 401 +} + +func (o *ListTestsUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests][%d] listTestsUnauthorized %s", 401, payload) +} + +func (o *ListTestsUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests][%d] listTestsUnauthorized %s", 401, payload) +} + +func (o *ListTestsUnauthorized) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListTestsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListTestsBadGateway creates a ListTestsBadGateway with default headers values +func NewListTestsBadGateway() *ListTestsBadGateway { + return &ListTestsBadGateway{} +} + +/* +ListTestsBadGateway describes a response with status code 502, with default header values. + +Bad Gateway +*/ +type ListTestsBadGateway struct { + Payload *models.ErrorResponse +} + +// IsSuccess returns true when this list tests bad gateway response has a 2xx status code +func (o *ListTestsBadGateway) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list tests bad gateway response has a 3xx status code +func (o *ListTestsBadGateway) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list tests bad gateway response has a 4xx status code +func (o *ListTestsBadGateway) IsClientError() bool { + return false +} + +// IsServerError returns true when this list tests bad gateway response has a 5xx status code +func (o *ListTestsBadGateway) IsServerError() bool { + return true +} + +// IsCode returns true when this list tests bad gateway response a status code equal to that given +func (o *ListTestsBadGateway) IsCode(code int) bool { + return code == 502 +} + +// Code gets the status code for the list tests bad gateway response +func (o *ListTestsBadGateway) Code() int { + return 502 +} + +func (o *ListTestsBadGateway) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests][%d] listTestsBadGateway %s", 502, payload) +} + +func (o *ListTestsBadGateway) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /orgs/{orgName}/tests][%d] listTestsBadGateway %s", 502, payload) +} + +func (o *ListTestsBadGateway) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListTestsBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/tests/tests_client.go b/client/tests/tests_client.go new file mode 100644 index 0000000..57a48c3 --- /dev/null +++ b/client/tests/tests_client.go @@ -0,0 +1,237 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new tests API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new tests API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new tests API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for tests API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ApplyTest(params *ApplyTestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplyTestOK, error) + + DeleteTest(params *DeleteTestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteTestOK, error) + + GetTest(params *GetTestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTestOK, error) + + ListTests(params *ListTestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListTestsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +ApplyTest creates or update a test + +Creates or updates a test with the provided parameters. +*/ +func (a *Client) ApplyTest(params *ApplyTestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplyTestOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplyTestParams() + } + op := &runtime.ClientOperation{ + ID: "apply-test", + Method: "PUT", + PathPattern: "/orgs/{orgName}/tests/{testName}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ApplyTestReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplyTestOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for apply-test: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DeleteTest deletes a test + +Delete a given test. +*/ +func (a *Client) DeleteTest(params *DeleteTestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteTestOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteTestParams() + } + op := &runtime.ClientOperation{ + ID: "delete-test", + Method: "DELETE", + PathPattern: "/orgs/{orgName}/tests/{testName}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &DeleteTestReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteTestOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for delete-test: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetTest gets a test + +Fetch the details about a given test. +*/ +func (a *Client) GetTest(params *GetTestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetTestOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetTestParams() + } + op := &runtime.ClientOperation{ + ID: "get-test", + Method: "GET", + PathPattern: "/orgs/{orgName}/tests/{testName}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetTestReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetTestOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for get-test: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ListTests lists tests + +List Tests +*/ +func (a *Client) ListTests(params *ListTestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListTestsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListTestsParams() + } + op := &runtime.ClientOperation{ + ID: "list-tests", + Method: "GET", + PathPattern: "/orgs/{orgName}/tests", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListTestsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListTestsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for list-tests: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/generate/swagger.json b/generate/swagger.json index 56ff826..c5a6a16 100644 --- a/generate/swagger.json +++ b/generate/swagger.json @@ -1,6 +1,36 @@ { "basePath": "/api/v2", "definitions": { + "CapturePointDiffSummary": { + "properties": { + "additions": { + "type": "integer" + }, + "capturedBy": { + "$ref": "#/definitions/trafficmodels.By" + }, + "captures": { + "type": "integer" + }, + "maxRelevance": { + "description": "MaxRelevance indicates a score in 0..1 of the maximally relevant diff\noperation, or 1.0 if either the baseline or target are missing.", + "type": "number" + }, + "removals": { + "type": "integer" + }, + "replacements": { + "type": "integer" + }, + "top": { + "items": { + "$ref": "#/definitions/TrafficDiffPairedDiff" + }, + "type": "array" + } + }, + "type": "object" + }, "Cluster": { "properties": { "createdAt": { @@ -54,6 +84,30 @@ }, "type": "object" }, + "DiffOp": { + "properties": { + "classification": { + "$ref": "#/definitions/DiffOpClassification" + }, + "oldValue": {}, + "op": { + "type": "string" + }, + "path": { + "type": "string" + }, + "value": {} + }, + "type": "object" + }, + "DiffOpClassification": { + "properties": { + "noise": { + "type": "number" + } + }, + "type": "object" + }, "EmptyResponse": { "type": "object" }, @@ -157,6 +211,23 @@ }, "type": "object" }, + "RequestDiff": { + "properties": { + "baseline": { + "$ref": "#/definitions/capture.Request" + }, + "diffOps": { + "items": { + "$ref": "#/definitions/DiffOp" + }, + "type": "array" + }, + "target": { + "$ref": "#/definitions/capture.Request" + } + }, + "type": "object" + }, "ResourceInfo": { "properties": { "cluster": { @@ -197,6 +268,23 @@ }, "type": "object" }, + "ResponseDiff": { + "properties": { + "baseline": { + "$ref": "#/definitions/capture.Response" + }, + "diffOps": { + "items": { + "$ref": "#/definitions/DiffOp" + }, + "type": "array" + }, + "target": { + "$ref": "#/definitions/capture.Response" + } + }, + "type": "object" + }, "RouteGroup": { "properties": { "createdAt": { @@ -263,854 +351,704 @@ }, "type": "object" }, - "cluster.Operator": { + "Test": { "properties": { - "version": { - "description": "The operator version of the cluster. This may be\nnil if the cluster has not yet connected to Signadot.", + "createdAt": { + "type": "string" + }, + "name": { + "type": "string" + }, + "spec": { + "$ref": "#/definitions/TestSpec" + }, + "status": { + "$ref": "#/definitions/TestStatus" + }, + "updatedAt": { "type": "string" } }, "type": "object" }, - "defaults.CompositeDefaults": { - "properties": { - "cluster": { - "items": { - "$ref": "#/definitions/defaults.Default" - }, - "type": "array" - } - }, - "type": "object" - }, - "defaults.Default": { + "TestExecution": { "properties": { - "class": { + "canceledAt": { "type": "string" }, "createdAt": { "type": "string" }, - "resourceKind": { + "name": { "type": "string" }, - "updatedAt": { - "type": "string" + "results": { + "$ref": "#/definitions/TestExecutionResults" }, - "value": {} + "spec": { + "$ref": "#/definitions/TestExecutionSpec" + }, + "status": { + "$ref": "#/definitions/TestExecutionStatus" + } }, "type": "object" }, - "job.EnvItem": { + "TestExecutionAutoDiff": { "properties": { - "name": { - "type": "string" - }, - "value": { - "type": "string" + "enabled": { + "description": "Enabled = true, requires the definition of a valid routing context", + "type": "boolean" } }, "type": "object" }, - "job.RoutingContext": { + "TestExecutionCanceledState": { "properties": { - "routegroup": { + "canceledBy": { "type": "string" }, - "sandbox": { + "message": { "type": "string" } }, "type": "object" }, - "job.Spec": { + "TestExecutionContext": { "properties": { - "command": { - "items": { - "type": "string" - }, - "type": "array" - }, - "env": { - "items": { - "$ref": "#/definitions/job.EnvItem" - }, - "type": "array" - }, - "labels": { - "additionalProperties": { - "type": "string" - }, - "type": "object" + "autoDiff": { + "$ref": "#/definitions/TestExecutionAutoDiff" }, - "namePrefix": { + "cluster": { "type": "string" }, - "routingContext": { + "routing": { "$ref": "#/definitions/job.RoutingContext" - }, - "runnerGroup": { - "type": "string" - }, - "script": { - "type": "string" - }, - "trafficManager": { - "$ref": "#/definitions/job.TrafficManager" - }, - "uploadArtifact": { - "items": { - "$ref": "#/definitions/job.UploadArtifact" - }, - "type": "array" } }, "type": "object" }, - "job.TrafficManager": { + "TestExecutionFailedState": { "properties": { - "injectRoutingKey": { - "description": "InjectRoutingKey indicates if the system should perform automatic\ninjection of routing key headers or not. It may be the empty string,\n\"auto\" or \"disabled\". The empty string defaults to meaning \"disabled\".", - "enum": [ - "disabled", - "auto" - ], + "message": { "type": "string" } }, "type": "object" }, - "job.UploadArtifact": { + "TestExecutionResults": { "properties": { - "meta": { - "additionalProperties": { - "type": "string" - }, - "type": "object" - }, - "path": { - "type": "string" + "trafficDiff": { + "$ref": "#/definitions/TrafficDiff" } }, "type": "object" }, - "jobRunnerGroup.AutoScaling": { + "TestExecutionSpec": { "properties": { - "maxPods": { - "type": "integer" + "executionContext": { + "$ref": "#/definitions/TestExecutionContext" }, - "minPods": { - "type": "integer" + "test": { + "type": "string" } }, "type": "object" }, - "jobRunnerGroup.ExecutionsStatus": { + "TestExecutionState": { "properties": { - "queued": { - "type": "integer" + "canceled": { + "$ref": "#/definitions/TestExecutionCanceledState" }, - "running": { - "type": "integer" + "failed": { + "$ref": "#/definitions/TestExecutionFailedState" } }, "type": "object" }, - "jobRunnerGroup.ManualScaling": { + "TestExecutionStatus": { "properties": { - "desiredPods": { - "type": "integer" + "baselineJob": { + "type": "string" + }, + "finalState": { + "$ref": "#/definitions/TestExecutionState" + }, + "phase": { + "type": "string" + }, + "targetJob": { + "type": "string" + }, + "triggeredBy": { + "$ref": "#/definitions/TestExecutionTriggeredBy" } }, "type": "object" }, - "jobRunnerGroup.PodsStatus": { + "TestExecutionTemplate": { "properties": { - "idle": { - "type": "integer" - }, - "notReady": { - "type": "integer" + "autoDiff": { + "$ref": "#/definitions/TestExecutionAutoDiff" }, - "ready": { - "type": "integer" + "cluster": { + "type": "string" } }, "type": "object" }, - "jobRunnerGroup.Scaling": { + "TestExecutionTriggeredBy": { "properties": { - "auto": { - "$ref": "#/definitions/jobRunnerGroup.AutoScaling" + "sandbox": { + "type": "string" }, - "manual": { - "$ref": "#/definitions/jobRunnerGroup.ManualScaling" + "triggerID": { + "type": "string" } }, "type": "object" }, - "jobRunnerGroup.Spec": { + "TestSpec": { "properties": { - "cluster": { - "type": "string" - }, - "image": { - "type": "string" - }, - "jobTimeout": { - "description": "JobTimeout specifies the max job execution time\nof jobs running with this RunnerGroup. If not\nspecified, it defaults to 30 minutes (\"30m\")", + "script": { "type": "string" }, - "labels": { - "additionalProperties": { - "type": "string" + "triggers": { + "items": { + "$ref": "#/definitions/TestTrigger" }, - "type": "object" - }, - "namespace": { - "type": "string" - }, - "podTemplate": {}, - "scaling": { - "$ref": "#/definitions/jobRunnerGroup.Scaling" + "type": "array" } }, "type": "object" }, - "jobRunnerGroup.Status": { + "TestStatus": { + "type": "object" + }, + "TestTrigger": { "properties": { - "executions": { - "$ref": "#/definitions/jobRunnerGroup.ExecutionsStatus" + "executionTemplate": { + "$ref": "#/definitions/TestExecutionTemplate" }, - "pods": { - "$ref": "#/definitions/jobRunnerGroup.PodsStatus" + "id": { + "type": "string" + }, + "sandboxOf": { + "$ref": "#/definitions/sandbox.ForkOf" } }, "type": "object" }, - "jobs.Attempt": { + "TrafficDiff": { "properties": { - "createdAt": { - "type": "string" - }, - "executionCount": { + "additions": { "type": "integer" }, - "finishedAt": { - "type": "string" + "capturePoints": { + "type": "integer" }, - "id": { + "captures": { "type": "integer" }, - "phase": { - "type": "string" + "green": { + "items": { + "$ref": "#/definitions/CapturePointDiffSummary" + }, + "type": "array" }, - "startedAt": { - "type": "string" + "maxRelevance": { + "description": "MaxRelevance indicates a score in 0..1 of the maximally relevant\ndiff of captures.", + "type": "number" }, - "state": { - "$ref": "#/definitions/jobs.State" - } - }, - "type": "object" - }, - "jobs.CanceledState": { - "properties": { - "canceledAt": { - "type": "string" + "red": { + "items": { + "$ref": "#/definitions/CapturePointDiffSummary" + }, + "type": "array" }, - "canceledBy": { - "type": "string" + "removals": { + "type": "integer" }, - "inCluster": { - "type": "boolean" + "replacements": { + "type": "integer" }, - "message": { - "type": "string" + "yellow": { + "items": { + "$ref": "#/definitions/CapturePointDiffSummary" + }, + "type": "array" } }, "type": "object" }, - "jobs.FailedState": { + "TrafficDiffPairedDiff": { "properties": { - "exitCode": { - "type": "integer", - "x-nullable": true + "request": { + "$ref": "#/definitions/RequestDiff" }, - "message": { - "type": "string" + "response": { + "$ref": "#/definitions/ResponseDiff" + } + }, + "type": "object" + }, + "TrafficDiffPointResult": { + "properties": { + "by": { + "$ref": "#/definitions/trafficmodels.By" }, - "retryAttempt": { - "type": "boolean" + "diffs": { + "items": { + "$ref": "#/definitions/TrafficDiffPairedDiff" + }, + "type": "array" } }, "type": "object" }, - "jobs.QueuedState": { + "TrafficDiffResult": { "properties": { - "lastMessage": { + "baseline": { "type": "string" }, - "message": { + "results": { + "items": { + "$ref": "#/definitions/TrafficDiffPointResult" + }, + "type": "array" + }, + "target": { "type": "string" } }, "type": "object" }, - "jobs.RunningState": { + "capture.Message": { "properties": { - "podName": { + "body": {}, + "finishedAt": { "type": "string" }, - "podNamespace": { + "headers": { + "$ref": "#/definitions/capture.Values" + }, + "startedAt": { "type": "string" } }, "type": "object" }, - "jobs.State": { + "capture.Request": { "properties": { - "canceled": { - "$ref": "#/definitions/jobs.CanceledState" + "host": { + "type": "string" }, - "failed": { - "$ref": "#/definitions/jobs.FailedState" + "message": { + "$ref": "#/definitions/capture.Message" }, - "queued": { - "$ref": "#/definitions/jobs.QueuedState" + "method": { + "type": "string" }, - "running": { - "$ref": "#/definitions/jobs.RunningState" + "proto": { + "type": "string" }, - "succeeded": { - "$ref": "#/definitions/jobs.SucceededState" + "query": { + "$ref": "#/definitions/capture.Values" + }, + "uri": { + "type": "string" } }, "type": "object" }, - "jobs.Status": { + "capture.Response": { "properties": { - "attempts": { - "items": { - "$ref": "#/definitions/jobs.Attempt" - }, - "type": "array" + "error": { + "type": "string" }, - "runnerGroupDeletionCompletedAt": { + "message": { + "$ref": "#/definitions/capture.Message" + }, + "proto": { "type": "string" + }, + "statusCode": { + "type": "integer" } }, "type": "object" }, - "jobs.SucceededState": { + "capture.Values": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "cluster.Operator": { "properties": { - "exitCode": { - "type": "integer" + "version": { + "description": "The operator version of the cluster. This may be\nnil if the cluster has not yet connected to Signadot.", + "type": "string" } }, "type": "object" }, - "local": { + "defaults.CompositeDefaults": { "properties": { - "from": { - "$ref": "#/definitions/local.From" - }, - "mappings": { + "cluster": { "items": { - "$ref": "#/definitions/local.PortMapping" + "$ref": "#/definitions/defaults.Default" }, "type": "array" - }, - "name": { - "type": "string" } }, "type": "object" }, - "local.From": { + "defaults.Default": { "properties": { - "kind": { - "description": "Kind of entity that we want to route to. One of (Service or Deployment or Rollout).", - "example": "Deployment", + "class": { "type": "string" }, - "name": { - "description": "Name of the entity within the Kubernetes cluster.", - "example": "my-frontend", + "createdAt": { "type": "string" }, - "namespace": { - "description": "Namespace within which the entity lives in the Kubernetes cluster.", - "example": "default", + "resourceKind": { "type": "string" - } + }, + "updatedAt": { + "type": "string" + }, + "value": {} }, - "required": [ - "kind", - "name", - "namespace" - ], "type": "object" }, - "local.PortMapping": { + "job.EnvItem": { "properties": { - "port": { - "type": "integer" + "name": { + "type": "string" }, - "toLocal": { + "value": { "type": "string" } }, "type": "object" }, - "resourceplugin.Runner": { + "job.RoutingContext": { "properties": { - "image": { - "description": "Image for the runner instance", - "type": "string" - }, - "namespace": { - "description": "Namespace to create this runner instance in", + "routegroup": { "type": "string" }, - "podTemplateOverlay": { - "description": "Pod template overlay", + "sandbox": { "type": "string" } }, "type": "object" }, - "resourceplugin.Spec": { + "job.Spec": { "properties": { - "create": { - "description": "Create refers to the `create` steps for spinning up the resource", + "command": { "items": { - "$ref": "#/definitions/resourceplugin.Step" + "type": "string" }, "type": "array" }, - "delete": { - "description": "Delete refers to the `delete` steps for spinning up the resource", + "env": { "items": { - "$ref": "#/definitions/resourceplugin.Step" + "$ref": "#/definitions/job.EnvItem" }, "type": "array" }, - "description": { - "description": "Description for the resource", + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "namePrefix": { "type": "string" }, - "runner": { - "$ref": "#/definitions/resourceplugin.Runner" - } - }, - "type": "object" - }, - "resourceplugin.Status": { - "properties": { - "resources": { - "description": "Resources created using the resource plugin", - "items": { - "$ref": "#/definitions/ResourceInfo" - }, - "type": "array" - } - }, - "type": "object" - }, - "resourceplugin.Step": { - "properties": { - "inputs": { - "description": "Inputs for the step", - "items": { - "$ref": "#/definitions/resourceplugin.StepInput" - }, - "type": "array" + "routingContext": { + "$ref": "#/definitions/job.RoutingContext" }, - "name": { - "description": "Name for the step", + "runnerGroup": { "type": "string" }, - "outputs": { - "description": "Outputs for the step", + "script": { + "type": "string" + }, + "trafficManager": { + "$ref": "#/definitions/job.TrafficManager" + }, + "uploadArtifact": { "items": { - "$ref": "#/definitions/resourceplugin.StepOut" + "$ref": "#/definitions/job.UploadArtifact" }, "type": "array" - }, - "script": { - "description": "Script to execute in the step", - "type": "string" } }, "type": "object" }, - "resourceplugin.StepInput": { + "job.TrafficManager": { "properties": { - "as": { - "$ref": "#/definitions/resourceplugin.StepInputTo" - }, - "name": { - "description": "Name for the input", - "type": "string" - }, - "type": { - "description": "Type of input", + "injectRoutingKey": { + "description": "InjectRoutingKey indicates if the system should perform automatic\ninjection of routing key headers or not. It may be the empty string,\n\"auto\" or \"disabled\". The empty string defaults to meaning \"disabled\".", + "enum": [ + "disabled", + "auto" + ], "type": "string" - }, - "valueFromSandbox": { - "description": "ValueFromSandbox defines whether or not to source value from the sandbox spec", - "type": "boolean" - }, - "valueFromStep": { - "$ref": "#/definitions/resourceplugin.ValueFromStep" } }, "type": "object" }, - "resourceplugin.StepInputTo": { + "job.UploadArtifact": { "properties": { - "env": { - "description": "Inject the input as an env variable with name Env inside the\nmain container", - "type": "string" + "meta": { + "additionalProperties": { + "type": "string" + }, + "type": "object" }, "path": { - "description": "Expose the input as a file at Path inside the main container", "type": "string" } }, "type": "object" }, - "resourceplugin.StepOut": { + "jobRunnerGroup.AutoScaling": { "properties": { - "description": { - "description": "Description for the output", - "type": "string" + "maxPods": { + "type": "integer" }, - "name": { - "description": "Name of the output variable", - "type": "string" - }, - "type": { - "description": "Type of output", - "type": "string" - }, - "valueFromPath": { - "description": "Path within the main container from where the output will be read", - "type": "string" + "minPods": { + "type": "integer" } }, "type": "object" }, - "resourceplugin.ValueFromStep": { + "jobRunnerGroup.ExecutionsStatus": { "properties": { - "name": { - "description": "Name of the step", - "type": "string" + "queued": { + "type": "integer" }, - "output": { - "description": "Name of the variable from the step", - "type": "string" + "running": { + "type": "integer" } }, "type": "object" }, - "routeGroup.Endpoint": { + "jobRunnerGroup.ManualScaling": { "properties": { - "name": { - "type": "string" - }, - "target": { - "type": "string" - }, - "url": { - "type": "string" + "desiredPods": { + "type": "integer" } }, "type": "object" }, - "routeGroup.Match": { + "jobRunnerGroup.PodsStatus": { "properties": { - "all": { - "description": "When All is non-nil, T matches a set of labels if and only if every element of All matches them.\nOnly one field may be non-nil.", - "items": { - "$ref": "#/definitions/routeGroup.Match" - }, - "type": "array", - "x-omitempty": true + "idle": { + "type": "integer" }, - "any": { - "description": "When Any is non-nil, T matches a set of labels if and only if some element of Any matches them.\nOnly one field may be non-nil.", - "items": { - "$ref": "#/definitions/routeGroup.Match" - }, - "type": "array", - "x-omitempty": true + "notReady": { + "type": "integer" }, - "label": { - "$ref": "#/definitions/routeGroup.MatchLabel" + "ready": { + "type": "integer" } }, "type": "object" }, - "routeGroup.MatchLabel": { + "jobRunnerGroup.Scaling": { "properties": { - "key": { - "description": "Key is an exact match on a label key, glob\ncharacters are just considered normal characters.", - "type": "string" + "auto": { + "$ref": "#/definitions/jobRunnerGroup.AutoScaling" }, - "value": { - "description": "Value is a glob match for the value of a\nsandbox label. See https://pkg.go.dev/path/filepath#Match\nfor the file glob syntax.", - "type": "string" + "manual": { + "$ref": "#/definitions/jobRunnerGroup.ManualScaling" } }, "type": "object" }, - "routeGroup.Spec": { + "jobRunnerGroup.Spec": { "properties": { "cluster": { - "description": "Cluster gives the cluster to which the route group applies.", "type": "string" }, - "description": { - "description": "Description provides a short description of the route group.", + "image": { "type": "string" }, - "endpoints": { - "description": "Endpoints define endpoints which target different in-cluster\nservices.", - "items": { - "$ref": "#/definitions/routeGroup.SpecEndpoint" + "jobTimeout": { + "description": "JobTimeout specifies the max job execution time\nof jobs running with this RunnerGroup. If not\nspecified, it defaults to 30 minutes (\"30m\")", + "type": "string" + }, + "labels": { + "additionalProperties": { + "type": "string" }, - "type": "array" + "type": "object" }, - "match": { - "$ref": "#/definitions/routeGroup.Match" + "namespace": { + "type": "string" }, - "ttl": { - "$ref": "#/definitions/routeGroup.TTL" + "podTemplate": {}, + "scaling": { + "$ref": "#/definitions/jobRunnerGroup.Scaling" } }, "type": "object" }, - "routeGroup.SpecEndpoint": { + "jobRunnerGroup.Status": { "properties": { - "name": { - "type": "string" + "executions": { + "$ref": "#/definitions/jobRunnerGroup.ExecutionsStatus" }, - "target": { - "type": "string" + "pods": { + "$ref": "#/definitions/jobRunnerGroup.PodsStatus" } }, "type": "object" }, - "routeGroup.Status": { + "jobs.Attempt": { "properties": { - "matchedSandboxes": { - "description": "MatchedSandboxes gives the list of sandboxes whose labels\nwere matched by the 'match' object in the spec.", - "items": { - "type": "string" - }, - "type": "array" + "createdAt": { + "type": "string" }, - "message": { - "description": "Message is a human readable explanation of why\nthe sandbox is healthy or not.", + "executionCount": { + "type": "integer" + }, + "finishedAt": { "type": "string" }, - "ready": { - "description": "Ready indicates whether the sandbox is ready,\nmeaning that it can be used for testing.", - "type": "boolean" + "id": { + "type": "integer" }, - "reason": { - "description": "Reason is a machine readable explanation of why\nthe sandbox is healthy or not.", + "phase": { "type": "string" }, - "scheduledDeleteTime": { - "description": "ScheduledDeleteTime returns the formatted and computed ttl based on the Duration\nand OffsetFrom", + "startedAt": { "type": "string" + }, + "state": { + "$ref": "#/definitions/jobs.State" } }, "type": "object" }, - "routeGroup.TTL": { + "jobs.CanceledState": { "properties": { - "duration": { - "description": "Duration represents the duration until routegroup's end of life.\nIt should be an unsigned integer not exceeding 32 bits followed by\na units character, which can be one of the following.\n - 'm' for minutes\n - 'h' for hours\n - 'd' for days\n - 'w' for weeks", + "canceledAt": { "type": "string" }, - "offsetFrom": { - "description": "OffsetFrom indicates what the Duration is relative to. It\nmay be the empty string, \"noMatchedSandboxes\", \"createdAt\" or \"updatedAt\". The empty string\ndefaults to meaning \"noMatchedSandboxes\".", + "canceledBy": { + "type": "string" + }, + "inCluster": { + "type": "boolean" + }, + "message": { "type": "string" } }, "type": "object" }, - "sandbox.CustomPatch": { + "jobs.FailedState": { "properties": { - "type": { - "type": "string" + "exitCode": { + "type": "integer", + "x-nullable": true }, - "value": { + "message": { "type": "string" + }, + "retryAttempt": { + "type": "boolean" } }, "type": "object" }, - "sandbox.Customizations": { + "jobs.QueuedState": { "properties": { - "env": { - "description": "Environment variable modifications that will be applied to the forked workload", - "items": { - "$ref": "#/definitions/sandbox.EnvVar" - }, - "type": "array" - }, - "images": { - "description": "One or more docker images that will be applied to the forked workload", - "items": { - "$ref": "#/definitions/sandbox.Image" - }, - "type": "array" + "lastMessage": { + "type": "string" }, - "patch": { - "$ref": "#/definitions/sandbox.CustomPatch" + "message": { + "type": "string" } }, "type": "object" }, - "sandbox.DefaultRouteGroup": { + "jobs.RunningState": { "properties": { - "endpoints": { - "items": { - "$ref": "#/definitions/routeGroup.SpecEndpoint" - }, - "type": "array" + "podName": { + "type": "string" + }, + "podNamespace": { + "type": "string" } }, "type": "object" }, - "sandbox.Endpoint": { + "jobs.State": { "properties": { - "baselineUrl": { - "type": "string" - }, - "host": { - "type": "string" - }, - "name": { - "type": "string" - }, - "port": { - "type": "integer" + "canceled": { + "$ref": "#/definitions/jobs.CanceledState" }, - "protocol": { - "type": "string" + "failed": { + "$ref": "#/definitions/jobs.FailedState" }, - "routeType": { - "type": "string" + "queued": { + "$ref": "#/definitions/jobs.QueuedState" }, - "target": { - "type": "string" + "running": { + "$ref": "#/definitions/jobs.RunningState" }, - "url": { - "type": "string" + "succeeded": { + "$ref": "#/definitions/jobs.SucceededState" } }, "type": "object" }, - "sandbox.EnvValueFrom": { + "jobs.Status": { "properties": { - "fork": { - "$ref": "#/definitions/sandbox.EnvValueFromFork" + "attempts": { + "items": { + "$ref": "#/definitions/jobs.Attempt" + }, + "type": "array" }, - "resource": { - "$ref": "#/definitions/sandbox.EnvValueFromResource" + "runnerGroupDeletionCompletedAt": { + "type": "string" } }, "type": "object" }, - "sandbox.EnvValueFromFork": { + "jobs.SucceededState": { "properties": { - "expression": { - "type": "string" - }, - "forkOf": { - "$ref": "#/definitions/sandbox.ForkOf" + "exitCode": { + "type": "integer" } }, "type": "object" }, - "sandbox.EnvValueFromResource": { + "local": { "properties": { - "name": { - "type": "string" - }, - "outputKey": { - "type": "string" - } - }, - "type": "object" - }, - "sandbox.EnvVar": { - "properties": { - "container": { - "description": "name of container to which it applies", - "type": "string" - }, - "name": { - "description": "environmental variable name", - "type": "string" - }, - "operation": { - "description": "upsert or delete", - "type": "string" - }, - "value": { - "description": "environmental variable value", - "type": "string" - }, - "valueFrom": { - "$ref": "#/definitions/sandbox.EnvValueFrom" - } - }, - "type": "object" - }, - "sandbox.Fork": { - "properties": { - "customizations": { - "$ref": "#/definitions/sandbox.Customizations" + "from": { + "$ref": "#/definitions/local.From" }, - "endpoints": { - "description": "Deprecated. Use defaultRouteGroup.Endpoints instead.", + "mappings": { "items": { - "$ref": "#/definitions/sandbox.ForkEndpoint" + "$ref": "#/definitions/local.PortMapping" }, - "type": "array", - "x-omitempty": "true" + "type": "array" }, - "forkOf": { - "$ref": "#/definitions/sandbox.ForkOf" - } - }, - "type": "object" - }, - "sandbox.ForkEndpoint": { - "properties": { "name": { - "description": "Name of the endpoint", - "type": "string" - }, - "port": { - "description": "Port it will map to on the forked workload", - "type": "integer" - }, - "protocol": { - "description": "Protocol that this endpoint uses", "type": "string" } }, "type": "object" }, - "sandbox.ForkOf": { + "local.From": { "properties": { "kind": { "description": "Kind of entity that we want to route to. One of (Service or Deployment or Rollout).", @@ -1135,192 +1073,703 @@ ], "type": "object" }, - "sandbox.HostEndpoint": { + "local.PortMapping": { "properties": { - "host": { - "description": "Hostname that this endpoint points to", - "type": "string" - }, - "name": { - "description": "Name of the endpoint", - "type": "string" - }, "port": { - "description": "Port it will map to on the specified host", "type": "integer" }, - "protocol": { - "description": "Protocol that this endpoint uses", + "toLocal": { "type": "string" } }, "type": "object" }, - "sandbox.Image": { + "resourceplugin.Runner": { "properties": { - "container": { - "description": "Container is the container this image must apply to in the forked workload", + "image": { + "description": "Image for the runner instance", "type": "string" }, - "image": { - "description": "Name of the image (e.g. gcr.io/my-image/repo:my-tag)", + "namespace": { + "description": "Namespace to create this runner instance in", + "type": "string" + }, + "podTemplateOverlay": { + "description": "Pod template overlay", "type": "string" } }, "type": "object" }, - "sandbox.LocalWorkloadStatus": { + "resourceplugin.Spec": { "properties": { - "name": { - "type": "string" + "create": { + "description": "Create refers to the `create` steps for spinning up the resource", + "items": { + "$ref": "#/definitions/resourceplugin.Step" + }, + "type": "array" }, - "tunnel": { - "properties": { - "health": { - "properties": { - "connected": { - "type": "boolean" - }, - "lastCheckTime": { - "type": "string" - }, - "lastConnectedTime": { - "type": "string" - } - }, - "type": "object" - } + "delete": { + "description": "Delete refers to the `delete` steps for spinning up the resource", + "items": { + "$ref": "#/definitions/resourceplugin.Step" }, - "type": "object" + "type": "array" + }, + "description": { + "description": "Description for the resource", + "type": "string" + }, + "runner": { + "$ref": "#/definitions/resourceplugin.Runner" } }, "type": "object" }, - "sandbox.Readiness": { + "resourceplugin.Status": { "properties": { - "local": { + "resources": { + "description": "Resources created using the resource plugin", "items": { - "$ref": "#/definitions/sandbox.LocalWorkloadStatus" + "$ref": "#/definitions/ResourceInfo" }, "type": "array" - }, - "message": { - "description": "Message is a human readable explanation of why\nthe sandbox is healthy or not.", - "type": "string" - }, - "ready": { - "description": "Ready indicates whether the sandbox is ready,\nmeaning that it can be used for testing.", - "type": "boolean" - }, - "reason": { - "description": "Reason is a machine readable explanation of why\nthe sandbox is healthy or not.", - "type": "string" - }, - "scheduledDeleteTime": { - "description": "ScheduledDeleteTime returns the formatted and computed ttl based on the Duration\nand OffsetFrom", - "type": "string" } }, "type": "object" }, - "sandbox.Resource": { + "resourceplugin.Step": { "properties": { + "inputs": { + "description": "Inputs for the step", + "items": { + "$ref": "#/definitions/resourceplugin.StepInput" + }, + "type": "array" + }, "name": { + "description": "Name for the step", "type": "string" }, - "params": { - "additionalProperties": { - "type": "string" + "outputs": { + "description": "Outputs for the step", + "items": { + "$ref": "#/definitions/resourceplugin.StepOut" }, - "type": "object" + "type": "array" }, - "plugin": { + "script": { + "description": "Script to execute in the step", "type": "string" } }, "type": "object" }, - "sandbox.Spec": { + "resourceplugin.StepInput": { "properties": { - "cluster": { - "description": "Cluster within which this sandbox should be created", - "type": "string" - }, - "defaultRouteGroup": { - "$ref": "#/definitions/sandbox.DefaultRouteGroup" + "as": { + "$ref": "#/definitions/resourceplugin.StepInputTo" }, - "description": { - "description": "Description of the purpose of this sandbox", + "name": { + "description": "Name for the input", "type": "string" }, - "endpoints": { - "description": "Deprecated. Use defaultRouteGroup.Endpoints instead.", - "items": { - "$ref": "#/definitions/sandbox.HostEndpoint" - }, - "type": "array", - "x-omitempty": "true" - }, - "forks": { - "description": "Forks is the specification of each forked entity", - "items": { - "$ref": "#/definitions/sandbox.Fork" - }, - "type": "array" - }, - "labels": { - "additionalProperties": { - "type": "string" - }, - "description": "Labels are used to specify metadata associated with the sandbox as key-value pairs.", - "type": "object" - }, - "local": { - "description": "Local Workloads", - "items": { - "$ref": "#/definitions/local" - }, - "type": "array" - }, - "localMachineID": { - "description": "Identifier of the machine from where a sandbox containing local workloads\nwas created or is intended to be ran", + "type": { + "description": "Type of input", "type": "string" }, - "resources": { - "description": "Resources specifies each required resource to spin up the sandbox", - "items": { - "$ref": "#/definitions/sandbox.Resource" - }, - "type": "array" + "valueFromSandbox": { + "description": "ValueFromSandbox defines whether or not to source value from the sandbox spec", + "type": "boolean" }, - "ttl": { - "$ref": "#/definitions/sandbox.TTL" + "valueFromStep": { + "$ref": "#/definitions/resourceplugin.ValueFromStep" } }, - "required": [ - "cluster", - "forks" - ], "type": "object" }, - "sandbox.TTL": { + "resourceplugin.StepInputTo": { "properties": { - "duration": { - "description": "Duration represents the duration until sandbox end of life.\nIt should be an unsigned integer not exceeding 32 bits followed by\na units character, which can be one of the following.\n - 'm' for minutes\n - 'h' for hours\n - 'd' for days\n - 'w' for weeks", + "env": { + "description": "Inject the input as an env variable with name Env inside the\nmain container", "type": "string" }, - "offsetFrom": { - "description": "OffsetFrom indicates what the Duration is relative to. It\nmay be the empty string, \"createdAt\" or \"updatedAt\". The empty string\ndefaults to meaning \"createdAt\".", + "path": { + "description": "Expose the input as a file at Path inside the main container", "type": "string" } }, "type": "object" - } - }, - "host": "api.signadot.com", - "info": { - "contact": {}, - "description": "API for Signadot Sandboxes", + }, + "resourceplugin.StepOut": { + "properties": { + "description": { + "description": "Description for the output", + "type": "string" + }, + "name": { + "description": "Name of the output variable", + "type": "string" + }, + "type": { + "description": "Type of output", + "type": "string" + }, + "valueFromPath": { + "description": "Path within the main container from where the output will be read", + "type": "string" + } + }, + "type": "object" + }, + "resourceplugin.ValueFromStep": { + "properties": { + "name": { + "description": "Name of the step", + "type": "string" + }, + "output": { + "description": "Name of the variable from the step", + "type": "string" + } + }, + "type": "object" + }, + "routeGroup.Endpoint": { + "properties": { + "name": { + "type": "string" + }, + "target": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "type": "object" + }, + "routeGroup.Match": { + "properties": { + "all": { + "description": "When All is non-nil, T matches a set of labels if and only if every element of All matches them.\nOnly one field may be non-nil.", + "items": { + "$ref": "#/definitions/routeGroup.Match" + }, + "type": "array", + "x-omitempty": true + }, + "any": { + "description": "When Any is non-nil, T matches a set of labels if and only if some element of Any matches them.\nOnly one field may be non-nil.", + "items": { + "$ref": "#/definitions/routeGroup.Match" + }, + "type": "array", + "x-omitempty": true + }, + "label": { + "$ref": "#/definitions/routeGroup.MatchLabel" + } + }, + "type": "object" + }, + "routeGroup.MatchLabel": { + "properties": { + "key": { + "description": "Key is an exact match on a label key, glob\ncharacters are just considered normal characters.", + "type": "string" + }, + "value": { + "description": "Value is a glob match for the value of a\nsandbox label. See https://pkg.go.dev/path/filepath#Match\nfor the file glob syntax.", + "type": "string" + } + }, + "type": "object" + }, + "routeGroup.Spec": { + "properties": { + "cluster": { + "description": "Cluster gives the cluster to which the route group applies.", + "type": "string" + }, + "description": { + "description": "Description provides a short description of the route group.", + "type": "string" + }, + "endpoints": { + "description": "Endpoints define endpoints which target different in-cluster\nservices.", + "items": { + "$ref": "#/definitions/routeGroup.SpecEndpoint" + }, + "type": "array" + }, + "match": { + "$ref": "#/definitions/routeGroup.Match" + }, + "ttl": { + "$ref": "#/definitions/routeGroup.TTL" + } + }, + "type": "object" + }, + "routeGroup.SpecEndpoint": { + "properties": { + "name": { + "type": "string" + }, + "target": { + "type": "string" + } + }, + "type": "object" + }, + "routeGroup.Status": { + "properties": { + "matchedSandboxes": { + "description": "MatchedSandboxes gives the list of sandboxes whose labels\nwere matched by the 'match' object in the spec.", + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "description": "Message is a human readable explanation of why\nthe sandbox is healthy or not.", + "type": "string" + }, + "ready": { + "description": "Ready indicates whether the sandbox is ready,\nmeaning that it can be used for testing.", + "type": "boolean" + }, + "reason": { + "description": "Reason is a machine readable explanation of why\nthe sandbox is healthy or not.", + "type": "string" + }, + "scheduledDeleteTime": { + "description": "ScheduledDeleteTime returns the formatted and computed ttl based on the Duration\nand OffsetFrom", + "type": "string" + } + }, + "type": "object" + }, + "routeGroup.TTL": { + "properties": { + "duration": { + "description": "Duration represents the duration until routegroup's end of life.\nIt should be an unsigned integer not exceeding 32 bits followed by\na units character, which can be one of the following.\n - 'm' for minutes\n - 'h' for hours\n - 'd' for days\n - 'w' for weeks", + "type": "string" + }, + "offsetFrom": { + "description": "OffsetFrom indicates what the Duration is relative to. It\nmay be the empty string, \"noMatchedSandboxes\", \"createdAt\" or \"updatedAt\". The empty string\ndefaults to meaning \"noMatchedSandboxes\".", + "type": "string" + } + }, + "type": "object" + }, + "sandbox.CustomPatch": { + "properties": { + "type": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "type": "object" + }, + "sandbox.Customizations": { + "properties": { + "env": { + "description": "Environment variable modifications that will be applied to the forked workload", + "items": { + "$ref": "#/definitions/sandbox.EnvVar" + }, + "type": "array" + }, + "images": { + "description": "One or more docker images that will be applied to the forked workload", + "items": { + "$ref": "#/definitions/sandbox.Image" + }, + "type": "array" + }, + "patch": { + "$ref": "#/definitions/sandbox.CustomPatch" + } + }, + "type": "object" + }, + "sandbox.DefaultRouteGroup": { + "properties": { + "endpoints": { + "items": { + "$ref": "#/definitions/routeGroup.SpecEndpoint" + }, + "type": "array" + } + }, + "type": "object" + }, + "sandbox.Endpoint": { + "properties": { + "baselineUrl": { + "type": "string" + }, + "host": { + "type": "string" + }, + "name": { + "type": "string" + }, + "port": { + "type": "integer" + }, + "protocol": { + "type": "string" + }, + "routeType": { + "type": "string" + }, + "target": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "type": "object" + }, + "sandbox.EnvValueFrom": { + "properties": { + "fork": { + "$ref": "#/definitions/sandbox.EnvValueFromFork" + }, + "resource": { + "$ref": "#/definitions/sandbox.EnvValueFromResource" + } + }, + "type": "object" + }, + "sandbox.EnvValueFromFork": { + "properties": { + "expression": { + "type": "string" + }, + "forkOf": { + "$ref": "#/definitions/sandbox.ForkOf" + } + }, + "type": "object" + }, + "sandbox.EnvValueFromResource": { + "properties": { + "name": { + "type": "string" + }, + "outputKey": { + "type": "string" + } + }, + "type": "object" + }, + "sandbox.EnvVar": { + "properties": { + "container": { + "description": "name of container to which it applies", + "type": "string" + }, + "name": { + "description": "environmental variable name", + "type": "string" + }, + "operation": { + "description": "upsert or delete", + "type": "string" + }, + "value": { + "description": "environmental variable value", + "type": "string" + }, + "valueFrom": { + "$ref": "#/definitions/sandbox.EnvValueFrom" + } + }, + "type": "object" + }, + "sandbox.Fork": { + "properties": { + "customizations": { + "$ref": "#/definitions/sandbox.Customizations" + }, + "endpoints": { + "description": "Deprecated. Use defaultRouteGroup.Endpoints instead.", + "items": { + "$ref": "#/definitions/sandbox.ForkEndpoint" + }, + "type": "array", + "x-omitempty": "true" + }, + "forkOf": { + "$ref": "#/definitions/sandbox.ForkOf" + } + }, + "type": "object" + }, + "sandbox.ForkEndpoint": { + "properties": { + "name": { + "description": "Name of the endpoint", + "type": "string" + }, + "port": { + "description": "Port it will map to on the forked workload", + "type": "integer" + }, + "protocol": { + "description": "Protocol that this endpoint uses", + "type": "string" + } + }, + "type": "object" + }, + "sandbox.ForkOf": { + "properties": { + "kind": { + "description": "Kind of entity that we want to route to. One of (Service or Deployment or Rollout).", + "example": "Deployment", + "type": "string" + }, + "name": { + "description": "Name of the entity within the Kubernetes cluster.", + "example": "my-frontend", + "type": "string" + }, + "namespace": { + "description": "Namespace within which the entity lives in the Kubernetes cluster.", + "example": "default", + "type": "string" + } + }, + "required": [ + "kind", + "name", + "namespace" + ], + "type": "object" + }, + "sandbox.HostEndpoint": { + "properties": { + "host": { + "description": "Hostname that this endpoint points to", + "type": "string" + }, + "name": { + "description": "Name of the endpoint", + "type": "string" + }, + "port": { + "description": "Port it will map to on the specified host", + "type": "integer" + }, + "protocol": { + "description": "Protocol that this endpoint uses", + "type": "string" + } + }, + "type": "object" + }, + "sandbox.Image": { + "properties": { + "container": { + "description": "Container is the container this image must apply to in the forked workload", + "type": "string" + }, + "image": { + "description": "Name of the image (e.g. gcr.io/my-image/repo:my-tag)", + "type": "string" + } + }, + "type": "object" + }, + "sandbox.LocalWorkloadStatus": { + "properties": { + "name": { + "type": "string" + }, + "tunnel": { + "properties": { + "health": { + "properties": { + "connected": { + "type": "boolean" + }, + "lastCheckTime": { + "type": "string" + }, + "lastConnectedTime": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "sandbox.Readiness": { + "properties": { + "local": { + "items": { + "$ref": "#/definitions/sandbox.LocalWorkloadStatus" + }, + "type": "array" + }, + "message": { + "description": "Message is a human readable explanation of why\nthe sandbox is healthy or not.", + "type": "string" + }, + "ready": { + "description": "Ready indicates whether the sandbox is ready,\nmeaning that it can be used for testing.", + "type": "boolean" + }, + "reason": { + "description": "Reason is a machine readable explanation of why\nthe sandbox is healthy or not.", + "type": "string" + }, + "scheduledDeleteTime": { + "description": "ScheduledDeleteTime returns the formatted and computed ttl based on the Duration\nand OffsetFrom", + "type": "string" + } + }, + "type": "object" + }, + "sandbox.Resource": { + "properties": { + "name": { + "type": "string" + }, + "params": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "plugin": { + "type": "string" + } + }, + "type": "object" + }, + "sandbox.Spec": { + "properties": { + "cluster": { + "description": "Cluster within which this sandbox should be created", + "type": "string" + }, + "defaultRouteGroup": { + "$ref": "#/definitions/sandbox.DefaultRouteGroup" + }, + "description": { + "description": "Description of the purpose of this sandbox", + "type": "string" + }, + "endpoints": { + "description": "Deprecated. Use defaultRouteGroup.Endpoints instead.", + "items": { + "$ref": "#/definitions/sandbox.HostEndpoint" + }, + "type": "array", + "x-omitempty": "true" + }, + "forks": { + "description": "Forks is the specification of each forked entity", + "items": { + "$ref": "#/definitions/sandbox.Fork" + }, + "type": "array" + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "description": "Labels are used to specify metadata associated with the sandbox as key-value pairs.", + "type": "object" + }, + "local": { + "description": "Local Workloads", + "items": { + "$ref": "#/definitions/local" + }, + "type": "array" + }, + "localMachineID": { + "description": "Identifier of the machine from where a sandbox containing local workloads\nwas created or is intended to be ran", + "type": "string" + }, + "resources": { + "description": "Resources specifies each required resource to spin up the sandbox", + "items": { + "$ref": "#/definitions/sandbox.Resource" + }, + "type": "array" + }, + "ttl": { + "$ref": "#/definitions/sandbox.TTL" + } + }, + "required": [ + "cluster", + "forks" + ], + "type": "object" + }, + "sandbox.TTL": { + "properties": { + "duration": { + "description": "Duration represents the duration until sandbox end of life.\nIt should be an unsigned integer not exceeding 32 bits followed by\na units character, which can be one of the following.\n - 'm' for minutes\n - 'h' for hours\n - 'd' for days\n - 'w' for weeks", + "type": "string" + }, + "offsetFrom": { + "description": "OffsetFrom indicates what the Duration is relative to. It\nmay be the empty string, \"createdAt\" or \"updatedAt\". The empty string\ndefaults to meaning \"createdAt\".", + "type": "string" + } + }, + "type": "object" + }, + "testexecutions.QueryResult": { + "properties": { + "cursor": { + "type": "string" + }, + "execution": { + "$ref": "#/definitions/TestExecution" + } + }, + "type": "object" + }, + "trafficmodels.By": { + "properties": { + "direction": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + } + }, + "type": "object" + } + }, + "host": "api.signadot.com", + "info": { + "contact": {}, + "description": "API for Signadot Sandboxes", "title": "Signadot API", "version": "2.0" }, @@ -1330,8 +1779,626 @@ "consumes": [ "application/json" ], - "description": "List all artifacts for a given job attempt.", - "operationId": "list-job-attempt-artifacts", + "description": "List all artifacts for a given job attempt.", + "operationId": "list-job-attempt-artifacts", + "parameters": [ + { + "description": "Signadot Org Name", + "in": "path", + "name": "orgName", + "required": true, + "type": "string", + "x-example": "my-company" + }, + { + "description": "Job Name", + "in": "path", + "name": "jobName", + "required": true, + "type": "string" + }, + { + "description": "Job Attempt ID", + "in": "path", + "name": "jobAttempt", + "required": true, + "type": "integer" + }, + { + "description": "Filter by artifact space, one of 'user' or 'system' (by default there is no filter)", + "enum": [ + "user", + "system" + ], + "in": "query", + "name": "space", + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "items": { + "$ref": "#/definitions/JobArtifact" + }, + "type": "array" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "summary": "List job attempt artifacts", + "tags": [ + "Artifacts" + ] + } + }, + "/orgs/{orgName}/artifacts/jobs/{jobName}/attempts/{jobAttempt}/objects/": { + "get": { + "consumes": [ + "application/json" + ], + "description": "Get info about a job attempt artifact", + "operationId": "info-job-attempt-artifact", + "parameters": [ + { + "description": "Signadot Org Name", + "in": "path", + "name": "orgName", + "required": true, + "type": "string", + "x-example": "my-company" + }, + { + "description": "Job Name", + "in": "path", + "name": "jobName", + "required": true, + "type": "string" + }, + { + "description": "Job Attempt ID", + "in": "path", + "name": "jobAttempt", + "required": true, + "type": "integer" + }, + { + "description": "Artifact Path", + "in": "query", + "name": "path", + "required": true, + "type": "string" + }, + { + "description": "Artifact space, one of 'user' or 'system' (by default 'user')", + "enum": [ + "user", + "system" + ], + "in": "query", + "name": "space", + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/JobArtifactInfo" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "summary": "Job attempt artifact info", + "tags": [ + "Artifacts" + ] + } + }, + "/orgs/{orgName}/artifacts/jobs/{jobName}/attempts/{jobAttempt}/objects/download": { + "get": { + "consumes": [ + "application/json" + ], + "description": "Downloads an artifact for a given job attempt.", + "operationId": "download-job-attempt-artifact", + "parameters": [ + { + "description": "Signadot Org Name", + "in": "path", + "name": "orgName", + "required": true, + "type": "string", + "x-example": "my-company" + }, + { + "description": "Job Name", + "in": "path", + "name": "jobName", + "required": true, + "type": "string" + }, + { + "description": "Job Attempt ID", + "in": "path", + "name": "jobAttempt", + "required": true, + "type": "integer" + }, + { + "description": "Artifact Path", + "in": "query", + "name": "path", + "required": true, + "type": "string" + }, + { + "description": "Artifact space, one of 'user' or 'system' (by default 'user')", + "enum": [ + "user", + "system" + ], + "in": "query", + "name": "space", + "type": "string" + }, + { + "description": "Downloads the specified byte range of the artifact. Retrieving multiple ranges of data per request is not supported", + "in": "header", + "name": "Range", + "type": "string" + } + ], + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "Artifact successfully downloaded", + "headers": { + "signadot-artifact-checksumSHA256": { + "description": "A base64-encoded, 256-bit SHA-256 digest of the artifact", + "type": "string" + }, + "signadot-artifact-last-modified": { + "description": "Date and time when the artifact was last modified", + "type": "string" + }, + "signadot-artifact-metadata": { + "description": "A json-encoded, map of the artifact metadata", + "type": "string" + } + }, + "schema": { + "type": "file" + } + }, + "206": { + "description": "Artifact range successfully downloaded", + "headers": { + "signadot-artifact-last-modified": { + "description": "Date and time when the artifact was last modified", + "type": "string" + }, + "signadot-artifact-metadata": { + "description": "A json-encoded, map of the artifact metadata", + "type": "string" + } + }, + "schema": { + "type": "file" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "summary": "Download job attempt artifact", + "tags": [ + "Artifacts" + ] + } + }, + "/orgs/{orgName}/artifacts/jobs/{jobName}/attempts/{jobAttempt}/objects/upload": { + "post": { + "consumes": [ + "multipart/form-data" + ], + "description": "Uploads an artifact for a given job attempt.", + "operationId": "upload-job-attempt-artifact", + "parameters": [ + { + "description": "Signadot Org Name", + "in": "path", + "name": "orgName", + "required": true, + "type": "string", + "x-example": "my-company" + }, + { + "description": "Job Name", + "in": "path", + "name": "jobName", + "required": true, + "type": "string" + }, + { + "description": "Job Attempt ID", + "in": "path", + "name": "jobAttempt", + "required": true, + "type": "integer" + }, + { + "description": "Artifact Path", + "in": "query", + "name": "path", + "required": true, + "type": "string" + }, + { + "description": "Artifact space, one of 'user' or 'system' (by default 'user')", + "enum": [ + "user", + "system" + ], + "in": "query", + "name": "space", + "type": "string" + }, + { + "description": "Job Execution ID", + "in": "formData", + "name": "jobExecution", + "type": "integer" + }, + { + "description": "A base64-encoded, 256-bit SHA-256 digest of the artifact", + "in": "formData", + "name": "checksumSHA256", + "type": "string" + }, + { + "description": "A json-encoded, map of metadata to store with the artifact", + "in": "formData", + "name": "metadata", + "type": "string" + }, + { + "description": "Artifact File", + "in": "formData", + "name": "artifact", + "required": true, + "type": "file" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/EmptyResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "413": { + "description": "Request Entity Too Large", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "summary": "Upload job attempt artifact", + "tags": [ + "Artifacts" + ] + } + }, + "/orgs/{orgName}/clusters/": { + "get": { + "consumes": [ + "application/json" + ], + "description": "List clusters.", + "operationId": "list-clusters", + "parameters": [ + { + "description": "Signadot Org Name", + "in": "path", + "name": "orgName", + "required": true, + "type": "string", + "x-example": "my-company" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "items": { + "$ref": "#/definitions/Cluster" + }, + "type": "array" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "502": { + "description": "Bad Gateway", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "summary": "List clusters", + "tags": [ + "Cluster" + ] + } + }, + "/orgs/{orgName}/clusters/{clusterName}/": { + "delete": { + "consumes": [ + "application/json" + ], + "description": "Remove a Kubernetes cluster from Signadot.", + "operationId": "remove-cluster", + "parameters": [ + { + "description": "Signadot Org Name", + "in": "path", + "name": "orgName", + "required": true, + "type": "string", + "x-example": "my-company" + }, + { + "description": "Cluster Name", + "in": "path", + "name": "clusterName", + "required": true, + "type": "string", + "x-example": "my-cluster" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/EmptyResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "502": { + "description": "Bad Gateway", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "summary": "Remove a cluster", + "tags": [ + "Cluster" + ] + }, + "get": { + "consumes": [ + "application/json" + ], + "description": "Get a cluster.", + "operationId": "get-cluster", + "parameters": [ + { + "description": "Signadot Org Name", + "in": "path", + "name": "orgName", + "required": true, + "type": "string", + "x-example": "my-company" + }, + { + "description": "Cluster Name", + "in": "path", + "name": "clusterName", + "required": true, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Cluster" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "502": { + "description": "Bad Gateway", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "summary": "Get a cluster", + "tags": [ + "Cluster" + ] + }, + "put": { + "consumes": [ + "application/json" + ], + "description": "Add a Kubernetes cluster to Signadot.", + "operationId": "add-cluster", "parameters": [ { "description": "Signadot Org Name", @@ -1342,28 +2409,12 @@ "x-example": "my-company" }, { - "description": "Job Name", - "in": "path", - "name": "jobName", - "required": true, - "type": "string" - }, - { - "description": "Job Attempt ID", + "description": "Cluster Name", "in": "path", - "name": "jobAttempt", + "name": "clusterName", "required": true, - "type": "integer" - }, - { - "description": "Filter by artifact space, one of 'user' or 'system' (by default there is no filter)", - "enum": [ - "user", - "system" - ], - "in": "query", - "name": "space", - "type": "string" + "type": "string", + "x-example": "my-cluster" } ], "produces": [ @@ -1373,10 +2424,7 @@ "200": { "description": "OK", "schema": { - "items": { - "$ref": "#/definitions/JobArtifact" - }, - "type": "array" + "$ref": "#/definitions/Cluster" } }, "400": { @@ -1391,14 +2439,8 @@ "$ref": "#/definitions/ErrorResponse" } }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "500": { - "description": "Internal Server Error", + "502": { + "description": "Bad Gateway", "schema": { "$ref": "#/definitions/ErrorResponse" } @@ -1409,19 +2451,19 @@ "ApiKeyAuth": [] } ], - "summary": "List job attempt artifacts", + "summary": "Add a cluster", "tags": [ - "Artifacts" + "Cluster" ] } }, - "/orgs/{orgName}/artifacts/jobs/{jobName}/attempts/{jobAttempt}/objects/": { - "get": { + "/orgs/{orgName}/clusters/{clusterName}/tokens": { + "post": { "consumes": [ "application/json" ], - "description": "Get info about a job attempt artifact", - "operationId": "info-job-attempt-artifact", + "description": "Create a new token for connecting a cluster.", + "operationId": "create-cluster-token", "parameters": [ { "description": "Signadot Org Name", @@ -1432,35 +2474,59 @@ "x-example": "my-company" }, { - "description": "Job Name", + "description": "Cluster Name", "in": "path", - "name": "jobName", + "name": "clusterName", "required": true, - "type": "string" - }, + "type": "string", + "x-example": "my-new-cluster" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ClusterToken" + } + } + }, + "security": [ { - "description": "Job Attempt ID", + "ApiKeyAuth": [] + } + ], + "summary": "Create cluster token", + "tags": [ + "Cluster" + ] + } + }, + "/orgs/{orgName}/clusters/{clusterName}/tokens/": { + "get": { + "consumes": [ + "application/json" + ], + "description": "List the cluster tokens associated with a cluster.", + "operationId": "list-cluster-tokens", + "parameters": [ + { + "description": "Signadot Org Name", "in": "path", - "name": "jobAttempt", + "name": "orgName", "required": true, - "type": "integer" + "type": "string", + "x-example": "my-company" }, { - "description": "Artifact Path", - "in": "query", - "name": "path", + "description": "Cluster Name", + "in": "path", + "name": "clusterName", "required": true, - "type": "string" - }, - { - "description": "Artifact space, one of 'user' or 'system' (by default 'user')", - "enum": [ - "user", - "system" - ], - "in": "query", - "name": "space", - "type": "string" + "type": "string", + "x-example": "my-new-cluster" } ], "produces": [ @@ -1470,31 +2536,10 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/JobArtifactInfo" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/ErrorResponse" + "items": { + "$ref": "#/definitions/ClusterToken" + }, + "type": "array" } } }, @@ -1503,19 +2548,19 @@ "ApiKeyAuth": [] } ], - "summary": "Job attempt artifact info", + "summary": "List cluster tokens", "tags": [ - "Artifacts" + "Cluster" ] } }, - "/orgs/{orgName}/artifacts/jobs/{jobName}/attempts/{jobAttempt}/objects/download": { - "get": { + "/orgs/{orgName}/clusters/{clusterName}/tokens/{tokenId}": { + "delete": { "consumes": [ "application/json" ], - "description": "Downloads an artifact for a given job attempt.", - "operationId": "download-job-attempt-artifact", + "description": "Delete a cluster token associated with a cluster.", + "operationId": "delete-cluster-token", "parameters": [ { "description": "Signadot Org Name", @@ -1526,105 +2571,30 @@ "x-example": "my-company" }, { - "description": "Job Name", + "description": "Cluster Name", "in": "path", - "name": "jobName", + "name": "clusterName", "required": true, - "type": "string" + "type": "string", + "x-example": "my-new-cluster" }, { - "description": "Job Attempt ID", + "description": "Token Id", "in": "path", - "name": "jobAttempt", - "required": true, - "type": "integer" - }, - { - "description": "Artifact Path", - "in": "query", - "name": "path", + "name": "tokenId", "required": true, - "type": "string" - }, - { - "description": "Artifact space, one of 'user' or 'system' (by default 'user')", - "enum": [ - "user", - "system" - ], - "in": "query", - "name": "space", - "type": "string" - }, - { - "description": "Downloads the specified byte range of the artifact. Retrieving multiple ranges of data per request is not supported", - "in": "header", - "name": "Range", - "type": "string" + "type": "string", + "x-example": "kq6mtksk7mn5" } ], "produces": [ - "*/*" - ], - "responses": { - "200": { - "description": "Artifact successfully downloaded", - "headers": { - "signadot-artifact-checksumSHA256": { - "description": "A base64-encoded, 256-bit SHA-256 digest of the artifact", - "type": "string" - }, - "signadot-artifact-last-modified": { - "description": "Date and time when the artifact was last modified", - "type": "string" - }, - "signadot-artifact-metadata": { - "description": "A json-encoded, map of the artifact metadata", - "type": "string" - } - }, - "schema": { - "type": "file" - } - }, - "206": { - "description": "Artifact range successfully downloaded", - "headers": { - "signadot-artifact-last-modified": { - "description": "Date and time when the artifact was last modified", - "type": "string" - }, - "signadot-artifact-metadata": { - "description": "A json-encoded, map of the artifact metadata", - "type": "string" - } - }, - "schema": { - "type": "file" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "500": { - "description": "Internal Server Error", + "application/json" + ], + "responses": { + "200": { + "description": "OK", "schema": { - "$ref": "#/definitions/ErrorResponse" + "$ref": "#/definitions/EmptyResponse" } } }, @@ -1633,19 +2603,17 @@ "ApiKeyAuth": [] } ], - "summary": "Download job attempt artifact", + "summary": "Delete cluster token", "tags": [ - "Artifacts" + "Cluster" ] - } - }, - "/orgs/{orgName}/artifacts/jobs/{jobName}/attempts/{jobAttempt}/objects/upload": { - "post": { + }, + "get": { "consumes": [ - "multipart/form-data" + "application/json" ], - "description": "Uploads an artifact for a given job attempt.", - "operationId": "upload-job-attempt-artifact", + "description": "Get a cluster token associated with a cluster.", + "operationId": "get-cluster-token", "parameters": [ { "description": "Signadot Org Name", @@ -1656,60 +2624,20 @@ "x-example": "my-company" }, { - "description": "Job Name", + "description": "Cluster Name", "in": "path", - "name": "jobName", + "name": "clusterName", "required": true, - "type": "string" + "type": "string", + "x-example": "my-new-cluster" }, { - "description": "Job Attempt ID", + "description": "Token Id", "in": "path", - "name": "jobAttempt", - "required": true, - "type": "integer" - }, - { - "description": "Artifact Path", - "in": "query", - "name": "path", - "required": true, - "type": "string" - }, - { - "description": "Artifact space, one of 'user' or 'system' (by default 'user')", - "enum": [ - "user", - "system" - ], - "in": "query", - "name": "space", - "type": "string" - }, - { - "description": "Job Execution ID", - "in": "formData", - "name": "jobExecution", - "type": "integer" - }, - { - "description": "A base64-encoded, 256-bit SHA-256 digest of the artifact", - "in": "formData", - "name": "checksumSHA256", - "type": "string" - }, - { - "description": "A json-encoded, map of metadata to store with the artifact", - "in": "formData", - "name": "metadata", - "type": "string" - }, - { - "description": "Artifact File", - "in": "formData", - "name": "artifact", + "name": "tokenId", "required": true, - "type": "file" + "type": "string", + "x-example": "kq6mtksk7mn5" } ], "produces": [ @@ -1719,31 +2647,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/EmptyResponse" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "413": { - "description": "Request Entity Too Large", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/ErrorResponse" + "$ref": "#/definitions/ClusterToken" } } }, @@ -1752,19 +2656,19 @@ "ApiKeyAuth": [] } ], - "summary": "Upload job attempt artifact", + "summary": "Get a cluster token", "tags": [ - "Artifacts" + "Cluster" ] } }, - "/orgs/{orgName}/clusters/": { + "/orgs/{orgName}/jobs": { "get": { "consumes": [ "application/json" ], - "description": "List clusters.", - "operationId": "list-clusters", + "description": "List Jobs", + "operationId": "list-jobs", "parameters": [ { "description": "Signadot Org Name", @@ -1783,7 +2687,7 @@ "description": "OK", "schema": { "items": { - "$ref": "#/definitions/Cluster" + "$ref": "#/definitions/Job" }, "type": "array" } @@ -1812,19 +2716,17 @@ "ApiKeyAuth": [] } ], - "summary": "List clusters", + "summary": "List Jobs", "tags": [ - "Cluster" + "Jobs" ] - } - }, - "/orgs/{orgName}/clusters/{clusterName}/": { - "delete": { + }, + "post": { "consumes": [ "application/json" ], - "description": "Remove a Kubernetes cluster from Signadot.", - "operationId": "remove-cluster", + "description": "Creates a job with the provided parameters.", + "operationId": "create-job", "parameters": [ { "description": "Signadot Org Name", @@ -1835,12 +2737,13 @@ "x-example": "my-company" }, { - "description": "Cluster Name", - "in": "path", - "name": "clusterName", + "description": "Request to create a job", + "in": "body", + "name": "data", "required": true, - "type": "string", - "x-example": "my-cluster" + "schema": { + "$ref": "#/definitions/Job" + } } ], "produces": [ @@ -1850,7 +2753,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/EmptyResponse" + "$ref": "#/definitions/Job" } }, "400": { @@ -1877,17 +2780,19 @@ "ApiKeyAuth": [] } ], - "summary": "Remove a cluster", + "summary": "Create a job", "tags": [ - "Cluster" + "Jobs" ] - }, - "get": { + } + }, + "/orgs/{orgName}/jobs/{jobName}": { + "delete": { "consumes": [ "application/json" ], - "description": "Get a cluster.", - "operationId": "get-cluster", + "description": "Delete a given job.", + "operationId": "delete-job", "parameters": [ { "description": "Signadot Org Name", @@ -1898,11 +2803,12 @@ "x-example": "my-company" }, { - "description": "Cluster Name", + "description": "Job Name", "in": "path", - "name": "clusterName", + "name": "jobName", "required": true, - "type": "string" + "type": "string", + "x-example": "job-xyz" } ], "produces": [ @@ -1912,7 +2818,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/Cluster" + "$ref": "#/definitions/EmptyResponse" } }, "400": { @@ -1939,17 +2845,17 @@ "ApiKeyAuth": [] } ], - "summary": "Get a cluster", + "summary": "Delete a job", "tags": [ - "Cluster" + "Jobs" ] }, - "put": { + "get": { "consumes": [ "application/json" ], - "description": "Add a Kubernetes cluster to Signadot.", - "operationId": "add-cluster", + "description": "Fetch the details about a given job.", + "operationId": "get-job", "parameters": [ { "description": "Signadot Org Name", @@ -1960,12 +2866,12 @@ "x-example": "my-company" }, { - "description": "Cluster Name", + "description": "Job Name", "in": "path", - "name": "clusterName", + "name": "jobName", "required": true, "type": "string", - "x-example": "my-cluster" + "x-example": "job-xyz" } ], "produces": [ @@ -1975,7 +2881,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/Cluster" + "$ref": "#/definitions/Job" } }, "400": { @@ -2002,19 +2908,19 @@ "ApiKeyAuth": [] } ], - "summary": "Add a cluster", + "summary": "Get a job", "tags": [ - "Cluster" + "Jobs" ] } }, - "/orgs/{orgName}/clusters/{clusterName}/tokens": { - "post": { + "/orgs/{orgName}/jobs/{jobName}/attempts/{jobAttempt}/logs/stream": { + "get": { "consumes": [ "application/json" ], - "description": "Create a new token for connecting a cluster.", - "operationId": "create-cluster-token", + "description": "Stream logs for a given job attempt.", + "operationId": "stream-job-attempt-logs", "parameters": [ { "description": "Signadot Org Name", @@ -2025,22 +2931,68 @@ "x-example": "my-company" }, { - "description": "Cluster Name", + "description": "Job Name", "in": "path", - "name": "clusterName", + "name": "jobName", "required": true, - "type": "string", - "x-example": "my-new-cluster" + "type": "string" + }, + { + "description": "Job Attempt ID", + "in": "path", + "name": "jobAttempt", + "required": true, + "type": "integer" + }, + { + "description": "Stream type (stdout or stderr)", + "enum": [ + "stdout", + "stderr" + ], + "in": "query", + "name": "type", + "type": "string" + }, + { + "description": "If set, the number of lines from the end of the logs to show", + "in": "query", + "name": "tailLines", + "type": "integer" + }, + { + "description": "If set, resume logs stream from the given cursor", + "in": "query", + "name": "cursor", + "type": "string" } ], "produces": [ - "application/json" + "text/event-stream" ], "responses": { "200": { - "description": "OK", + "description": "Log lines stream", "schema": { - "$ref": "#/definitions/ClusterToken" + "type": "file" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/ErrorResponse" } } }, @@ -2049,19 +3001,19 @@ "ApiKeyAuth": [] } ], - "summary": "Create cluster token", + "summary": "Stream job attempt logs", "tags": [ - "Cluster" + "JobLogs" ] } }, - "/orgs/{orgName}/clusters/{clusterName}/tokens/": { - "get": { + "/orgs/{orgName}/jobs/{jobName}/cancel": { + "put": { "consumes": [ "application/json" ], - "description": "List the cluster tokens associated with a cluster.", - "operationId": "list-cluster-tokens", + "description": "Cancel a given job.", + "operationId": "cancel-job", "parameters": [ { "description": "Signadot Org Name", @@ -2072,12 +3024,12 @@ "x-example": "my-company" }, { - "description": "Cluster Name", + "description": "Job Name", "in": "path", - "name": "clusterName", + "name": "jobName", "required": true, "type": "string", - "x-example": "my-new-cluster" + "x-example": "job-xyz" } ], "produces": [ @@ -2087,10 +3039,25 @@ "200": { "description": "OK", "schema": { - "items": { - "$ref": "#/definitions/ClusterToken" - }, - "type": "array" + "$ref": "#/definitions/Job" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "502": { + "description": "Bad Gateway", + "schema": { + "$ref": "#/definitions/ErrorResponse" } } }, @@ -2099,19 +3066,19 @@ "ApiKeyAuth": [] } ], - "summary": "List cluster tokens", + "summary": "Cancel a job", "tags": [ - "Cluster" + "Jobs" ] } }, - "/orgs/{orgName}/clusters/{clusterName}/tokens/{tokenId}": { - "delete": { + "/orgs/{orgName}/resource-plugins": { + "get": { "consumes": [ "application/json" ], - "description": "Delete a cluster token associated with a cluster.", - "operationId": "delete-cluster-token", + "description": "List all resource plugins under the specified Signadot org.", + "operationId": "list-resource-plugins", "parameters": [ { "description": "Signadot Org Name", @@ -2120,22 +3087,6 @@ "required": true, "type": "string", "x-example": "my-company" - }, - { - "description": "Cluster Name", - "in": "path", - "name": "clusterName", - "required": true, - "type": "string", - "x-example": "my-new-cluster" - }, - { - "description": "Token Id", - "in": "path", - "name": "tokenId", - "required": true, - "type": "string", - "x-example": "kq6mtksk7mn5" } ], "produces": [ @@ -2145,7 +3096,28 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/EmptyResponse" + "items": { + "$ref": "#/definitions/ResourcePlugin" + }, + "type": "array" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "502": { + "description": "Bad Gateway", + "schema": { + "$ref": "#/definitions/ErrorResponse" } } }, @@ -2154,17 +3126,19 @@ "ApiKeyAuth": [] } ], - "summary": "Delete cluster token", + "summary": "List resource plugins", "tags": [ - "Cluster" + "ResourcePlugins" ] - }, - "get": { + } + }, + "/orgs/{orgName}/resource-plugins/{pluginName}": { + "delete": { "consumes": [ "application/json" ], - "description": "Get a cluster token associated with a cluster.", - "operationId": "get-cluster-token", + "description": "Delete the resource plugin by name", + "operationId": "delete-resource-plugin", "parameters": [ { "description": "Signadot Org Name", @@ -2175,20 +3149,12 @@ "x-example": "my-company" }, { - "description": "Cluster Name", - "in": "path", - "name": "clusterName", - "required": true, - "type": "string", - "x-example": "my-new-cluster" - }, - { - "description": "Token Id", + "description": "Resource plugin name", "in": "path", - "name": "tokenId", + "name": "pluginName", "required": true, "type": "string", - "x-example": "kq6mtksk7mn5" + "x-example": "mariadb-plugin" } ], "produces": [ @@ -2198,7 +3164,25 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/ClusterToken" + "$ref": "#/definitions/EmptyResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "502": { + "description": "Bad Gateway", + "schema": { + "$ref": "#/definitions/ErrorResponse" } } }, @@ -2207,19 +3191,17 @@ "ApiKeyAuth": [] } ], - "summary": "Get a cluster token", + "summary": "Delete a resource plugin", "tags": [ - "Cluster" + "ResourcePlugins" ] - } - }, - "/orgs/{orgName}/jobs": { + }, "get": { "consumes": [ "application/json" ], - "description": "List Jobs", - "operationId": "list-jobs", + "description": "Get the specified resource plugin by name", + "operationId": "get-resource-plugin", "parameters": [ { "description": "Signadot Org Name", @@ -2228,6 +3210,14 @@ "required": true, "type": "string", "x-example": "my-company" + }, + { + "description": "Resource plugin name", + "in": "path", + "name": "pluginName", + "required": true, + "type": "string", + "x-example": "mariadb-plugin" } ], "produces": [ @@ -2237,10 +3227,7 @@ "200": { "description": "OK", "schema": { - "items": { - "$ref": "#/definitions/Job" - }, - "type": "array" + "$ref": "#/definitions/ResourcePlugin" } }, "400": { @@ -2267,17 +3254,17 @@ "ApiKeyAuth": [] } ], - "summary": "List Jobs", + "summary": "Get the requested resource plugin", "tags": [ - "Jobs" + "ResourcePlugins" ] }, - "post": { + "put": { "consumes": [ "application/json" ], - "description": "Creates a job with the provided parameters.", - "operationId": "create-job", + "description": "Apply a resource plugin. Updates are not supported at this time.", + "operationId": "apply-resource-plugin", "parameters": [ { "description": "Signadot Org Name", @@ -2288,12 +3275,20 @@ "x-example": "my-company" }, { - "description": "Request to create a job", + "description": "Resource plugin name", + "in": "path", + "name": "pluginName", + "required": true, + "type": "string", + "x-example": "mariadb-plugin" + }, + { + "description": "Request to create or update a resource plugin", "in": "body", "name": "data", "required": true, "schema": { - "$ref": "#/definitions/Job" + "$ref": "#/definitions/ResourcePlugin" } } ], @@ -2304,7 +3299,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/Job" + "$ref": "#/definitions/EmptyResponse" } }, "400": { @@ -2331,19 +3326,19 @@ "ApiKeyAuth": [] } ], - "summary": "Create a job", + "summary": "Apply a resource plugin", "tags": [ - "Jobs" + "ResourcePlugins" ] } }, - "/orgs/{orgName}/jobs/{jobName}": { - "delete": { + "/orgs/{orgName}/routegroups": { + "get": { "consumes": [ "application/json" ], - "description": "Delete a given job.", - "operationId": "delete-job", + "description": "List all routegroups under the specified Signadot org.", + "operationId": "list-routegroups", "parameters": [ { "description": "Signadot Org Name", @@ -2352,14 +3347,6 @@ "required": true, "type": "string", "x-example": "my-company" - }, - { - "description": "Job Name", - "in": "path", - "name": "jobName", - "required": true, - "type": "string", - "x-example": "job-xyz" } ], "produces": [ @@ -2369,7 +3356,10 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/EmptyResponse" + "items": { + "$ref": "#/definitions/RouteGroup" + }, + "type": "array" } }, "400": { @@ -2396,17 +3386,19 @@ "ApiKeyAuth": [] } ], - "summary": "Delete a job", + "summary": "List routegroups", "tags": [ - "Jobs" + "RouteGroups" ] - }, - "get": { + } + }, + "/orgs/{orgName}/routegroups/{routegroupName}": { + "delete": { "consumes": [ "application/json" ], - "description": "Fetch the details about a given job.", - "operationId": "get-job", + "description": "Delete a given routegroup.", + "operationId": "delete-routegroup", "parameters": [ { "description": "Signadot Org Name", @@ -2417,12 +3409,12 @@ "x-example": "my-company" }, { - "description": "Job Name", + "description": "RouteGroup Name", "in": "path", - "name": "jobName", + "name": "routegroupName", "required": true, "type": "string", - "x-example": "job-xyz" + "x-example": "my-routegroup" } ], "produces": [ @@ -2432,7 +3424,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/Job" + "$ref": "#/definitions/EmptyResponse" } }, "400": { @@ -2459,73 +3451,43 @@ "ApiKeyAuth": [] } ], - "summary": "Get a job", + "summary": "Delete a routegroup", "tags": [ - "Jobs" + "RouteGroups" ] - } - }, - "/orgs/{orgName}/jobs/{jobName}/attempts/{jobAttempt}/logs/stream": { + }, "get": { "consumes": [ "application/json" ], - "description": "Stream logs for a given job attempt.", - "operationId": "stream-job-attempt-logs", + "description": "Fetch the details about a given routegroup.", + "operationId": "get-routegroup", "parameters": [ { "description": "Signadot Org Name", "in": "path", "name": "orgName", "required": true, - "type": "string", - "x-example": "my-company" - }, - { - "description": "Job Name", - "in": "path", - "name": "jobName", - "required": true, - "type": "string" + "type": "string", + "x-example": "my-company" }, { - "description": "Job Attempt ID", + "description": "RouteGroup Name", "in": "path", - "name": "jobAttempt", + "name": "routegroupName", "required": true, - "type": "integer" - }, - { - "description": "Stream type (stdout or stderr)", - "enum": [ - "stdout", - "stderr" - ], - "in": "query", - "name": "type", - "type": "string" - }, - { - "description": "If set, the number of lines from the end of the logs to show", - "in": "query", - "name": "tailLines", - "type": "integer" - }, - { - "description": "If set, resume logs stream from the given cursor", - "in": "query", - "name": "cursor", - "type": "string" + "type": "string", + "x-example": "my-routegroup" } ], "produces": [ - "text/event-stream" + "application/json" ], "responses": { "200": { - "description": "Log lines stream", + "description": "OK", "schema": { - "type": "file" + "$ref": "#/definitions/RouteGroup" } }, "400": { @@ -2540,8 +3502,8 @@ "$ref": "#/definitions/ErrorResponse" } }, - "404": { - "description": "Not Found", + "502": { + "description": "Bad Gateway", "schema": { "$ref": "#/definitions/ErrorResponse" } @@ -2552,19 +3514,17 @@ "ApiKeyAuth": [] } ], - "summary": "Stream job attempt logs", + "summary": "Get a routegroup", "tags": [ - "JobLogs" + "RouteGroups" ] - } - }, - "/orgs/{orgName}/jobs/{jobName}/cancel": { + }, "put": { "consumes": [ "application/json" ], - "description": "Cancel a given job.", - "operationId": "cancel-job", + "description": "Creates or updates a routegroup with the provided parameters.", + "operationId": "apply-routegroup", "parameters": [ { "description": "Signadot Org Name", @@ -2575,12 +3535,21 @@ "x-example": "my-company" }, { - "description": "Job Name", + "description": "RouteGroup Name", "in": "path", - "name": "jobName", + "name": "routegroupName", "required": true, "type": "string", - "x-example": "job-xyz" + "x-example": "my-routegroup" + }, + { + "description": "Request to create or update routegroup", + "in": "body", + "name": "data", + "required": true, + "schema": { + "$ref": "#/definitions/RouteGroup" + } } ], "produces": [ @@ -2590,7 +3559,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/Job" + "$ref": "#/definitions/RouteGroup" } }, "400": { @@ -2617,19 +3586,19 @@ "ApiKeyAuth": [] } ], - "summary": "Cancel a job", + "summary": "Create or update a routegroup", "tags": [ - "Jobs" + "RouteGroups" ] } }, - "/orgs/{orgName}/resource-plugins": { + "/orgs/{orgName}/runnergroups": { "get": { "consumes": [ "application/json" ], - "description": "List all resource plugins under the specified Signadot org.", - "operationId": "list-resource-plugins", + "description": "List RunnerGroups", + "operationId": "list-runnergroup", "parameters": [ { "description": "Signadot Org Name", @@ -2648,7 +3617,7 @@ "description": "OK", "schema": { "items": { - "$ref": "#/definitions/ResourcePlugin" + "$ref": "#/definitions/JobRunnerGroup" }, "type": "array" } @@ -2677,19 +3646,19 @@ "ApiKeyAuth": [] } ], - "summary": "List resource plugins", + "summary": "List RunnerGroups", "tags": [ - "ResourcePlugins" + "RunnerGroups" ] } }, - "/orgs/{orgName}/resource-plugins/{pluginName}": { + "/orgs/{orgName}/runnergroups/{runnergroupName}": { "delete": { "consumes": [ "application/json" ], - "description": "Delete the resource plugin by name", - "operationId": "delete-resource-plugin", + "description": "Delete a given runnergroup.", + "operationId": "delete-runnergroup", "parameters": [ { "description": "Signadot Org Name", @@ -2700,12 +3669,12 @@ "x-example": "my-company" }, { - "description": "Resource plugin name", + "description": "RunnerGroup Name", "in": "path", - "name": "pluginName", + "name": "runnergroupName", "required": true, "type": "string", - "x-example": "mariadb-plugin" + "x-example": "my-runnergroup" } ], "produces": [ @@ -2742,17 +3711,17 @@ "ApiKeyAuth": [] } ], - "summary": "Delete a resource plugin", + "summary": "Delete a runnergroup", "tags": [ - "ResourcePlugins" + "RunnerGroups" ] }, "get": { "consumes": [ "application/json" ], - "description": "Get the specified resource plugin by name", - "operationId": "get-resource-plugin", + "description": "Fetch the details about a given runnergroup.", + "operationId": "get-runnergroup", "parameters": [ { "description": "Signadot Org Name", @@ -2763,12 +3732,12 @@ "x-example": "my-company" }, { - "description": "Resource plugin name", + "description": "RunnerGroup Name", "in": "path", - "name": "pluginName", + "name": "runnergroupName", "required": true, "type": "string", - "x-example": "mariadb-plugin" + "x-example": "my-runnergroup" } ], "produces": [ @@ -2778,7 +3747,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/ResourcePlugin" + "$ref": "#/definitions/JobRunnerGroup" } }, "400": { @@ -2805,17 +3774,17 @@ "ApiKeyAuth": [] } ], - "summary": "Get the requested resource plugin", + "summary": "Get a runnergroup", "tags": [ - "ResourcePlugins" + "RunnerGroups" ] }, "put": { "consumes": [ "application/json" ], - "description": "Apply a resource plugin. Updates are not supported at this time.", - "operationId": "apply-resource-plugin", + "description": "Creates or updates a runnergroup with the provided parameters.", + "operationId": "apply-runnergroup", "parameters": [ { "description": "Signadot Org Name", @@ -2826,20 +3795,20 @@ "x-example": "my-company" }, { - "description": "Resource plugin name", + "description": "RunnerGroup Name", "in": "path", - "name": "pluginName", + "name": "runnergroupName", "required": true, "type": "string", - "x-example": "mariadb-plugin" + "x-example": "my-runnergroup" }, { - "description": "Request to create or update a resource plugin", + "description": "Request to create or update runnergroup", "in": "body", "name": "data", "required": true, "schema": { - "$ref": "#/definitions/ResourcePlugin" + "$ref": "#/definitions/JobRunnerGroup" } } ], @@ -2850,7 +3819,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/EmptyResponse" + "$ref": "#/definitions/JobRunnerGroup" } }, "400": { @@ -2877,19 +3846,19 @@ "ApiKeyAuth": [] } ], - "summary": "Apply a resource plugin", + "summary": "Create or update a runnergroup", "tags": [ - "ResourcePlugins" + "RunnerGroups" ] } }, - "/orgs/{orgName}/routegroups": { + "/orgs/{orgName}/sandboxes": { "get": { "consumes": [ "application/json" ], - "description": "List all routegroups under the specified Signadot org.", - "operationId": "list-routegroups", + "description": "List all sandboxes under the specified Signadot org.", + "operationId": "list-sandboxes", "parameters": [ { "description": "Signadot Org Name", @@ -2908,7 +3877,7 @@ "description": "OK", "schema": { "items": { - "$ref": "#/definitions/RouteGroup" + "$ref": "#/definitions/Sandbox" }, "type": "array" } @@ -2937,19 +3906,19 @@ "ApiKeyAuth": [] } ], - "summary": "List routegroups", + "summary": "List sandboxes", "tags": [ - "RouteGroups" + "Sandboxes" ] } }, - "/orgs/{orgName}/routegroups/{routegroupName}": { + "/orgs/{orgName}/sandboxes/{sandboxName}": { "delete": { "consumes": [ "application/json" ], - "description": "Delete a given routegroup.", - "operationId": "delete-routegroup", + "description": "Delete a given sandbox.", + "operationId": "delete-sandbox", "parameters": [ { "description": "Signadot Org Name", @@ -2960,12 +3929,18 @@ "x-example": "my-company" }, { - "description": "RouteGroup Name", + "description": "Sandbox Name", "in": "path", - "name": "routegroupName", + "name": "sandboxName", "required": true, "type": "string", - "x-example": "my-routegroup" + "x-example": "my-sandbox" + }, + { + "description": "force", + "in": "query", + "name": "force", + "type": "boolean" } ], "produces": [ @@ -3002,17 +3977,17 @@ "ApiKeyAuth": [] } ], - "summary": "Delete a routegroup", + "summary": "Delete a sandbox", "tags": [ - "RouteGroups" + "Sandboxes" ] }, "get": { "consumes": [ "application/json" ], - "description": "Fetch the details about a given routegroup.", - "operationId": "get-routegroup", + "description": "Fetch the details about a given sandbox.", + "operationId": "get-sandbox", "parameters": [ { "description": "Signadot Org Name", @@ -3023,12 +3998,12 @@ "x-example": "my-company" }, { - "description": "RouteGroup Name", + "description": "Sandbox Name", "in": "path", - "name": "routegroupName", + "name": "sandboxName", "required": true, "type": "string", - "x-example": "my-routegroup" + "x-example": "my-sandbox" } ], "produces": [ @@ -3038,7 +4013,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/RouteGroup" + "$ref": "#/definitions/Sandbox" } }, "400": { @@ -3065,17 +4040,17 @@ "ApiKeyAuth": [] } ], - "summary": "Get a routegroup", + "summary": "Get a sandbox", "tags": [ - "RouteGroups" + "Sandboxes" ] }, "put": { "consumes": [ "application/json" ], - "description": "Creates or updates a routegroup with the provided parameters.", - "operationId": "apply-routegroup", + "description": "Creates or updates a sandbox with the provided parameters.", + "operationId": "apply-sandbox", "parameters": [ { "description": "Signadot Org Name", @@ -3086,21 +4061,78 @@ "x-example": "my-company" }, { - "description": "RouteGroup Name", + "description": "Sandbox Name", + "in": "path", + "name": "sandboxName", + "required": true, + "type": "string", + "x-example": "my-sandbox" + }, + { + "description": "Request to create sandbox", + "in": "body", + "name": "data", + "required": true, + "schema": { + "$ref": "#/definitions/Sandbox" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Sandbox" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "502": { + "description": "Bad Gateway", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "summary": "Create or update a sandbox", + "tags": [ + "Sandboxes" + ] + } + }, + "/orgs/{orgName}/tests": { + "get": { + "consumes": [ + "application/json" + ], + "description": "List Tests", + "operationId": "list-tests", + "parameters": [ + { + "description": "Signadot Org Name", "in": "path", - "name": "routegroupName", + "name": "orgName", "required": true, "type": "string", - "x-example": "my-routegroup" - }, - { - "description": "Request to create or update routegroup", - "in": "body", - "name": "data", - "required": true, - "schema": { - "$ref": "#/definitions/RouteGroup" - } + "x-example": "my-company" } ], "produces": [ @@ -3110,7 +4142,10 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/RouteGroup" + "items": { + "$ref": "#/definitions/Test" + }, + "type": "array" } }, "400": { @@ -3137,27 +4172,118 @@ "ApiKeyAuth": [] } ], - "summary": "Create or update a routegroup", + "summary": "List Tests", "tags": [ - "RouteGroups" + "Tests" ] } }, - "/orgs/{orgName}/runnergroups": { + "/orgs/{orgName}/tests/executions/": { "get": { "consumes": [ "application/json" ], - "description": "List RunnerGroups", - "operationId": "list-runnergroup", + "description": "Query test executions based on different criteria", + "operationId": "query-test-executions", "parameters": [ { - "description": "Signadot Org Name", + "description": "Signadot Org name", "in": "path", "name": "orgName", "required": true, "type": "string", "x-example": "my-company" + }, + { + "description": "Target sandbox name", + "in": "query", + "name": "targetSandboxName", + "type": "string" + }, + { + "description": "Target route group name", + "in": "query", + "name": "targetRouteGroupName", + "type": "string" + }, + { + "description": "Revision of the target routing context", + "in": "query", + "name": "targetRevision", + "type": "string" + }, + { + "description": "Cluster name", + "in": "query", + "name": "clusterName", + "type": "string" + }, + { + "description": "Test name", + "in": "query", + "name": "testName", + "type": "string" + }, + { + "description": "Trigger name", + "in": "query", + "name": "triggerName", + "type": "string" + }, + { + "description": "Trigger workload in JSON format", + "in": "query", + "name": "triggerWorkload", + "type": "string" + }, + { + "description": "Test execution phase", + "in": "query", + "name": "executionPhase", + "type": "string" + }, + { + "description": "Filter results starting from this time", + "in": "query", + "name": "from", + "type": "string" + }, + { + "description": "Filter results until this time", + "in": "query", + "name": "to", + "type": "string" + }, + { + "description": "Group results by entity (so far, only triggers is supported)", + "enum": [ + "trigger" + ], + "in": "query", + "name": "groupBy", + "type": "string" + }, + { + "description": "Sorting direction", + "enum": [ + "asc", + "desc" + ], + "in": "query", + "name": "orderDir", + "type": "string" + }, + { + "description": "Number of rows to be included in the response", + "in": "query", + "name": "pageSize", + "type": "string" + }, + { + "description": "Start sending results from this cursor", + "in": "query", + "name": "cursor", + "type": "string" } ], "produces": [ @@ -3168,7 +4294,7 @@ "description": "OK", "schema": { "items": { - "$ref": "#/definitions/JobRunnerGroup" + "$ref": "#/definitions/testexecutions.QueryResult" }, "type": "array" } @@ -3197,19 +4323,19 @@ "ApiKeyAuth": [] } ], - "summary": "List RunnerGroups", + "summary": "Query Test Executions", "tags": [ - "RunnerGroups" + "TestExecutions" ] } }, - "/orgs/{orgName}/runnergroups/{runnergroupName}": { + "/orgs/{orgName}/tests/{testName}": { "delete": { "consumes": [ "application/json" ], - "description": "Delete a given runnergroup.", - "operationId": "delete-runnergroup", + "description": "Delete a given test.", + "operationId": "delete-test", "parameters": [ { "description": "Signadot Org Name", @@ -3220,12 +4346,12 @@ "x-example": "my-company" }, { - "description": "RunnerGroup Name", + "description": "Test Name", "in": "path", - "name": "runnergroupName", + "name": "testName", "required": true, "type": "string", - "x-example": "my-runnergroup" + "x-example": "job-xyz" } ], "produces": [ @@ -3262,17 +4388,17 @@ "ApiKeyAuth": [] } ], - "summary": "Delete a runnergroup", + "summary": "Delete a test", "tags": [ - "RunnerGroups" + "Tests" ] }, "get": { "consumes": [ "application/json" ], - "description": "Fetch the details about a given runnergroup.", - "operationId": "get-runnergroup", + "description": "Fetch the details about a given test.", + "operationId": "get-test", "parameters": [ { "description": "Signadot Org Name", @@ -3283,12 +4409,11 @@ "x-example": "my-company" }, { - "description": "RunnerGroup Name", + "description": "Test Name", "in": "path", - "name": "runnergroupName", + "name": "testName", "required": true, - "type": "string", - "x-example": "my-runnergroup" + "type": "string" } ], "produces": [ @@ -3298,7 +4423,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/JobRunnerGroup" + "$ref": "#/definitions/Test" } }, "400": { @@ -3325,17 +4450,17 @@ "ApiKeyAuth": [] } ], - "summary": "Get a runnergroup", + "summary": "Get a test", "tags": [ - "RunnerGroups" + "Tests" ] }, "put": { "consumes": [ "application/json" ], - "description": "Creates or updates a runnergroup with the provided parameters.", - "operationId": "apply-runnergroup", + "description": "Creates or updates a test with the provided parameters.", + "operationId": "apply-test", "parameters": [ { "description": "Signadot Org Name", @@ -3346,20 +4471,19 @@ "x-example": "my-company" }, { - "description": "RunnerGroup Name", + "description": "Test Name", "in": "path", - "name": "runnergroupName", + "name": "testName", "required": true, - "type": "string", - "x-example": "my-runnergroup" + "type": "string" }, { - "description": "Request to create or update runnergroup", + "description": "Test Spec", "in": "body", "name": "data", "required": true, "schema": { - "$ref": "#/definitions/JobRunnerGroup" + "$ref": "#/definitions/TestSpec" } } ], @@ -3370,7 +4494,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/JobRunnerGroup" + "$ref": "#/definitions/Test" } }, "400": { @@ -3397,19 +4521,19 @@ "ApiKeyAuth": [] } ], - "summary": "Create or update a runnergroup", + "summary": "Create or update a Test", "tags": [ - "RunnerGroups" + "Tests" ] } }, - "/orgs/{orgName}/sandboxes": { + "/orgs/{orgName}/tests/{testName}/executions/": { "get": { "consumes": [ "application/json" ], - "description": "List all sandboxes under the specified Signadot org.", - "operationId": "list-sandboxes", + "description": "List test executions for a given test", + "operationId": "list-test-executions", "parameters": [ { "description": "Signadot Org Name", @@ -3418,6 +4542,13 @@ "required": true, "type": "string", "x-example": "my-company" + }, + { + "description": "Test name", + "in": "path", + "name": "testName", + "required": true, + "type": "string" } ], "produces": [ @@ -3428,7 +4559,7 @@ "description": "OK", "schema": { "items": { - "$ref": "#/definitions/Sandbox" + "$ref": "#/definitions/TestExecution" }, "type": "array" } @@ -3457,19 +4588,17 @@ "ApiKeyAuth": [] } ], - "summary": "List sandboxes", + "summary": "List Test Executions", "tags": [ - "Sandboxes" + "TestExecutions" ] - } - }, - "/orgs/{orgName}/sandboxes/{sandboxName}": { - "delete": { + }, + "post": { "consumes": [ "application/json" ], - "description": "Delete a given sandbox.", - "operationId": "delete-sandbox", + "description": "Creates a test with the provided parameters.", + "operationId": "create-test-execution", "parameters": [ { "description": "Signadot Org Name", @@ -3480,18 +4609,20 @@ "x-example": "my-company" }, { - "description": "Sandbox Name", + "description": "Test name", "in": "path", - "name": "sandboxName", + "name": "testName", "required": true, - "type": "string", - "x-example": "my-sandbox" + "type": "string" }, { - "description": "force", - "in": "query", - "name": "force", - "type": "boolean" + "description": "Request to create a test execution", + "in": "body", + "name": "data", + "required": true, + "schema": { + "$ref": "#/definitions/TestExecutionSpec" + } } ], "produces": [ @@ -3501,7 +4632,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/EmptyResponse" + "$ref": "#/definitions/TestExecution" } }, "400": { @@ -3528,17 +4659,19 @@ "ApiKeyAuth": [] } ], - "summary": "Delete a sandbox", + "summary": "Create a Test Execution", "tags": [ - "Sandboxes" + "TestExecutions" ] - }, + } + }, + "/orgs/{orgName}/tests/{testName}/executions/{executionName}": { "get": { "consumes": [ "application/json" ], - "description": "Fetch the details about a given sandbox.", - "operationId": "get-sandbox", + "description": "Fetch the details about a given test execution.", + "operationId": "get-test-execution", "parameters": [ { "description": "Signadot Org Name", @@ -3549,12 +4682,18 @@ "x-example": "my-company" }, { - "description": "Sandbox Name", + "description": "Test Name", "in": "path", - "name": "sandboxName", + "name": "testName", "required": true, - "type": "string", - "x-example": "my-sandbox" + "type": "string" + }, + { + "description": "Test Execution Name", + "in": "path", + "name": "executionName", + "required": true, + "type": "string" } ], "produces": [ @@ -3564,7 +4703,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/Sandbox" + "$ref": "#/definitions/TestExecution" } }, "400": { @@ -3591,17 +4730,19 @@ "ApiKeyAuth": [] } ], - "summary": "Get a sandbox", + "summary": "Get a test execution", "tags": [ - "Sandboxes" + "TestExecutions" ] - }, - "put": { + } + }, + "/orgs/{orgName}/tests/{testName}/executions/{executionName}/cancel": { + "post": { "consumes": [ "application/json" ], - "description": "Creates or updates a sandbox with the provided parameters.", - "operationId": "apply-sandbox", + "description": "Cancel a given test execution.", + "operationId": "cancel-test-execution", "parameters": [ { "description": "Signadot Org Name", @@ -3612,21 +4753,89 @@ "x-example": "my-company" }, { - "description": "Sandbox Name", + "description": "Test Name", "in": "path", - "name": "sandboxName", + "name": "testName", "required": true, - "type": "string", - "x-example": "my-sandbox" + "type": "string" }, { - "description": "Request to create sandbox", - "in": "body", - "name": "data", + "description": "Test Execution Name", + "in": "path", + "name": "executionName", "required": true, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", "schema": { - "$ref": "#/definitions/Sandbox" + "$ref": "#/definitions/EmptyResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "502": { + "description": "Bad Gateway", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "summary": "Cancel a test execution", + "tags": [ + "TestExecutions" + ] + } + }, + "/orgs/{orgName}/tests/{testName}/executions/{executionName}/traffic-diff": { + "get": { + "consumes": [ + "application/json" + ], + "description": "Get the full traffic diff of a test execution", + "operationId": "test-execution-traffic-diff", + "parameters": [ + { + "description": "Signadot Org Name", + "in": "path", + "name": "orgName", + "required": true, + "type": "string", + "x-example": "my-company" + }, + { + "description": "Test Name", + "in": "path", + "name": "testName", + "required": true, + "type": "string" + }, + { + "description": "Test Execution Name", + "in": "path", + "name": "executionName", + "required": true, + "type": "string" } ], "produces": [ @@ -3636,7 +4845,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/Sandbox" + "$ref": "#/definitions/TrafficDiffResult" } }, "400": { @@ -3663,9 +4872,9 @@ "ApiKeyAuth": [] } ], - "summary": "Create or update a sandbox", + "summary": "Get the full traffic diff of a test execution", "tags": [ - "Sandboxes" + "TestExecutions" ] } } @@ -3678,4 +4887,4 @@ } }, "swagger": "2.0" -} +} \ No newline at end of file diff --git a/go.mod b/go.mod index f9af6aa..5383524 100644 --- a/go.mod +++ b/go.mod @@ -25,10 +25,10 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/oklog/ulid v1.3.1 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect - go.mongodb.org/mongo-driver v1.16.0 // indirect - go.opentelemetry.io/otel v1.28.0 // indirect - go.opentelemetry.io/otel/metric v1.28.0 // indirect - go.opentelemetry.io/otel/trace v1.28.0 // indirect - golang.org/x/sync v0.7.0 // indirect + go.mongodb.org/mongo-driver v1.17.0 // indirect + go.opentelemetry.io/otel v1.30.0 // indirect + go.opentelemetry.io/otel/metric v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.30.0 // indirect + golang.org/x/sync v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index d48872c..f3a89fd 100644 --- a/go.sum +++ b/go.sum @@ -54,18 +54,18 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -go.mongodb.org/mongo-driver v1.16.0 h1:tpRsfBJMROVHKpdGyc1BBEzzjDUWjItxbVSZ8Ls4BQ4= -go.mongodb.org/mongo-driver v1.16.0/go.mod h1:oB6AhJQvFQL4LEHyXi6aJzQJtBiTQHiAd83l0GdFaiw= -go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= -go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= -go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.mongodb.org/mongo-driver v1.17.0 h1:Hp4q2MCjvY19ViwimTs00wHi7G4yzxh4/2+nTx8r40k= +go.mongodb.org/mongo-driver v1.17.0/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4= +go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= +go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= +go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= -go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= +go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/models/capture_message.go b/models/capture_message.go new file mode 100644 index 0000000..f4866fd --- /dev/null +++ b/models/capture_message.go @@ -0,0 +1,115 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CaptureMessage capture message +// +// swagger:model capture.Message +type CaptureMessage struct { + + // body + Body interface{} `json:"body,omitempty"` + + // finished at + FinishedAt string `json:"finishedAt,omitempty"` + + // headers + Headers CaptureValues `json:"headers,omitempty"` + + // started at + StartedAt string `json:"startedAt,omitempty"` +} + +// Validate validates this capture message +func (m *CaptureMessage) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHeaders(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CaptureMessage) validateHeaders(formats strfmt.Registry) error { + if swag.IsZero(m.Headers) { // not required + return nil + } + + if m.Headers != nil { + if err := m.Headers.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("headers") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("headers") + } + return err + } + } + + return nil +} + +// ContextValidate validate this capture message based on the context it is used +func (m *CaptureMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHeaders(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CaptureMessage) contextValidateHeaders(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Headers) { // not required + return nil + } + + if err := m.Headers.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("headers") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("headers") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CaptureMessage) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CaptureMessage) UnmarshalBinary(b []byte) error { + var res CaptureMessage + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/capture_point_diff_summary.go b/models/capture_point_diff_summary.go new file mode 100644 index 0000000..21c8102 --- /dev/null +++ b/models/capture_point_diff_summary.go @@ -0,0 +1,188 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CapturePointDiffSummary capture point diff summary +// +// swagger:model CapturePointDiffSummary +type CapturePointDiffSummary struct { + + // additions + Additions int64 `json:"additions,omitempty"` + + // captured by + CapturedBy *TrafficmodelsBy `json:"capturedBy,omitempty"` + + // captures + Captures int64 `json:"captures,omitempty"` + + // MaxRelevance indicates a score in 0..1 of the maximally relevant diff + // operation, or 1.0 if either the baseline or target are missing. + MaxRelevance float64 `json:"maxRelevance,omitempty"` + + // removals + Removals int64 `json:"removals,omitempty"` + + // replacements + Replacements int64 `json:"replacements,omitempty"` + + // top + Top []*TrafficDiffPairedDiff `json:"top"` +} + +// Validate validates this capture point diff summary +func (m *CapturePointDiffSummary) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCapturedBy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTop(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CapturePointDiffSummary) validateCapturedBy(formats strfmt.Registry) error { + if swag.IsZero(m.CapturedBy) { // not required + return nil + } + + if m.CapturedBy != nil { + if err := m.CapturedBy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capturedBy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capturedBy") + } + return err + } + } + + return nil +} + +func (m *CapturePointDiffSummary) validateTop(formats strfmt.Registry) error { + if swag.IsZero(m.Top) { // not required + return nil + } + + for i := 0; i < len(m.Top); i++ { + if swag.IsZero(m.Top[i]) { // not required + continue + } + + if m.Top[i] != nil { + if err := m.Top[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("top" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("top" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this capture point diff summary based on the context it is used +func (m *CapturePointDiffSummary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCapturedBy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTop(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CapturePointDiffSummary) contextValidateCapturedBy(ctx context.Context, formats strfmt.Registry) error { + + if m.CapturedBy != nil { + + if swag.IsZero(m.CapturedBy) { // not required + return nil + } + + if err := m.CapturedBy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capturedBy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capturedBy") + } + return err + } + } + + return nil +} + +func (m *CapturePointDiffSummary) contextValidateTop(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Top); i++ { + + if m.Top[i] != nil { + + if swag.IsZero(m.Top[i]) { // not required + return nil + } + + if err := m.Top[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("top" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("top" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CapturePointDiffSummary) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CapturePointDiffSummary) UnmarshalBinary(b []byte) error { + var res CapturePointDiffSummary + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/capture_request.go b/models/capture_request.go new file mode 100644 index 0000000..a01f84a --- /dev/null +++ b/models/capture_request.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CaptureRequest capture request +// +// swagger:model capture.Request +type CaptureRequest struct { + + // host + Host string `json:"host,omitempty"` + + // message + Message *CaptureMessage `json:"message,omitempty"` + + // method + Method string `json:"method,omitempty"` + + // proto + Proto string `json:"proto,omitempty"` + + // query + Query CaptureValues `json:"query,omitempty"` + + // uri + URI string `json:"uri,omitempty"` +} + +// Validate validates this capture request +func (m *CaptureRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMessage(formats); err != nil { + res = append(res, err) + } + + if err := m.validateQuery(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CaptureRequest) validateMessage(formats strfmt.Registry) error { + if swag.IsZero(m.Message) { // not required + return nil + } + + if m.Message != nil { + if err := m.Message.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("message") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("message") + } + return err + } + } + + return nil +} + +func (m *CaptureRequest) validateQuery(formats strfmt.Registry) error { + if swag.IsZero(m.Query) { // not required + return nil + } + + if m.Query != nil { + if err := m.Query.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("query") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("query") + } + return err + } + } + + return nil +} + +// ContextValidate validate this capture request based on the context it is used +func (m *CaptureRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMessage(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateQuery(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CaptureRequest) contextValidateMessage(ctx context.Context, formats strfmt.Registry) error { + + if m.Message != nil { + + if swag.IsZero(m.Message) { // not required + return nil + } + + if err := m.Message.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("message") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("message") + } + return err + } + } + + return nil +} + +func (m *CaptureRequest) contextValidateQuery(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Query) { // not required + return nil + } + + if err := m.Query.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("query") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("query") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CaptureRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CaptureRequest) UnmarshalBinary(b []byte) error { + var res CaptureRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/capture_response.go b/models/capture_response.go new file mode 100644 index 0000000..5145cb1 --- /dev/null +++ b/models/capture_response.go @@ -0,0 +1,118 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CaptureResponse capture response +// +// swagger:model capture.Response +type CaptureResponse struct { + + // error + Error string `json:"error,omitempty"` + + // message + Message *CaptureMessage `json:"message,omitempty"` + + // proto + Proto string `json:"proto,omitempty"` + + // status code + StatusCode int64 `json:"statusCode,omitempty"` +} + +// Validate validates this capture response +func (m *CaptureResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMessage(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CaptureResponse) validateMessage(formats strfmt.Registry) error { + if swag.IsZero(m.Message) { // not required + return nil + } + + if m.Message != nil { + if err := m.Message.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("message") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("message") + } + return err + } + } + + return nil +} + +// ContextValidate validate this capture response based on the context it is used +func (m *CaptureResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMessage(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CaptureResponse) contextValidateMessage(ctx context.Context, formats strfmt.Registry) error { + + if m.Message != nil { + + if swag.IsZero(m.Message) { // not required + return nil + } + + if err := m.Message.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("message") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("message") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CaptureResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CaptureResponse) UnmarshalBinary(b []byte) error { + var res CaptureResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/capture_values.go b/models/capture_values.go new file mode 100644 index 0000000..eb8b6b9 --- /dev/null +++ b/models/capture_values.go @@ -0,0 +1,27 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" +) + +// CaptureValues capture values +// +// swagger:model capture.Values +type CaptureValues map[string]string + +// Validate validates this capture values +func (m CaptureValues) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this capture values based on context it is used +func (m CaptureValues) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/diff_op.go b/models/diff_op.go new file mode 100644 index 0000000..61cfc9b --- /dev/null +++ b/models/diff_op.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// DiffOp diff op +// +// swagger:model DiffOp +type DiffOp struct { + + // classification + Classification *DiffOpClassification `json:"classification,omitempty"` + + // old value + OldValue interface{} `json:"oldValue,omitempty"` + + // op + Op string `json:"op,omitempty"` + + // path + Path string `json:"path,omitempty"` + + // value + Value interface{} `json:"value,omitempty"` +} + +// Validate validates this diff op +func (m *DiffOp) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClassification(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DiffOp) validateClassification(formats strfmt.Registry) error { + if swag.IsZero(m.Classification) { // not required + return nil + } + + if m.Classification != nil { + if err := m.Classification.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classification") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classification") + } + return err + } + } + + return nil +} + +// ContextValidate validate this diff op based on the context it is used +func (m *DiffOp) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClassification(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DiffOp) contextValidateClassification(ctx context.Context, formats strfmt.Registry) error { + + if m.Classification != nil { + + if swag.IsZero(m.Classification) { // not required + return nil + } + + if err := m.Classification.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classification") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classification") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *DiffOp) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DiffOp) UnmarshalBinary(b []byte) error { + var res DiffOp + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/diff_op_classification.go b/models/diff_op_classification.go new file mode 100644 index 0000000..dff16e8 --- /dev/null +++ b/models/diff_op_classification.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// DiffOpClassification diff op classification +// +// swagger:model DiffOpClassification +type DiffOpClassification struct { + + // noise + Noise float64 `json:"noise,omitempty"` +} + +// Validate validates this diff op classification +func (m *DiffOpClassification) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this diff op classification based on context it is used +func (m *DiffOpClassification) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DiffOpClassification) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DiffOpClassification) UnmarshalBinary(b []byte) error { + var res DiffOpClassification + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/request_diff.go b/models/request_diff.go new file mode 100644 index 0000000..1dacf8e --- /dev/null +++ b/models/request_diff.go @@ -0,0 +1,223 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// RequestDiff request diff +// +// swagger:model RequestDiff +type RequestDiff struct { + + // baseline + Baseline *CaptureRequest `json:"baseline,omitempty"` + + // diff ops + DiffOps []*DiffOp `json:"diffOps"` + + // target + Target *CaptureRequest `json:"target,omitempty"` +} + +// Validate validates this request diff +func (m *RequestDiff) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBaseline(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDiffOps(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTarget(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RequestDiff) validateBaseline(formats strfmt.Registry) error { + if swag.IsZero(m.Baseline) { // not required + return nil + } + + if m.Baseline != nil { + if err := m.Baseline.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("baseline") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("baseline") + } + return err + } + } + + return nil +} + +func (m *RequestDiff) validateDiffOps(formats strfmt.Registry) error { + if swag.IsZero(m.DiffOps) { // not required + return nil + } + + for i := 0; i < len(m.DiffOps); i++ { + if swag.IsZero(m.DiffOps[i]) { // not required + continue + } + + if m.DiffOps[i] != nil { + if err := m.DiffOps[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("diffOps" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("diffOps" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *RequestDiff) validateTarget(formats strfmt.Registry) error { + if swag.IsZero(m.Target) { // not required + return nil + } + + if m.Target != nil { + if err := m.Target.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target") + } + return err + } + } + + return nil +} + +// ContextValidate validate this request diff based on the context it is used +func (m *RequestDiff) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBaseline(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDiffOps(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTarget(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RequestDiff) contextValidateBaseline(ctx context.Context, formats strfmt.Registry) error { + + if m.Baseline != nil { + + if swag.IsZero(m.Baseline) { // not required + return nil + } + + if err := m.Baseline.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("baseline") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("baseline") + } + return err + } + } + + return nil +} + +func (m *RequestDiff) contextValidateDiffOps(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.DiffOps); i++ { + + if m.DiffOps[i] != nil { + + if swag.IsZero(m.DiffOps[i]) { // not required + return nil + } + + if err := m.DiffOps[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("diffOps" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("diffOps" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *RequestDiff) contextValidateTarget(ctx context.Context, formats strfmt.Registry) error { + + if m.Target != nil { + + if swag.IsZero(m.Target) { // not required + return nil + } + + if err := m.Target.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *RequestDiff) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RequestDiff) UnmarshalBinary(b []byte) error { + var res RequestDiff + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/response_diff.go b/models/response_diff.go new file mode 100644 index 0000000..22f8d63 --- /dev/null +++ b/models/response_diff.go @@ -0,0 +1,223 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// ResponseDiff response diff +// +// swagger:model ResponseDiff +type ResponseDiff struct { + + // baseline + Baseline *CaptureResponse `json:"baseline,omitempty"` + + // diff ops + DiffOps []*DiffOp `json:"diffOps"` + + // target + Target *CaptureResponse `json:"target,omitempty"` +} + +// Validate validates this response diff +func (m *ResponseDiff) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBaseline(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDiffOps(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTarget(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResponseDiff) validateBaseline(formats strfmt.Registry) error { + if swag.IsZero(m.Baseline) { // not required + return nil + } + + if m.Baseline != nil { + if err := m.Baseline.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("baseline") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("baseline") + } + return err + } + } + + return nil +} + +func (m *ResponseDiff) validateDiffOps(formats strfmt.Registry) error { + if swag.IsZero(m.DiffOps) { // not required + return nil + } + + for i := 0; i < len(m.DiffOps); i++ { + if swag.IsZero(m.DiffOps[i]) { // not required + continue + } + + if m.DiffOps[i] != nil { + if err := m.DiffOps[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("diffOps" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("diffOps" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ResponseDiff) validateTarget(formats strfmt.Registry) error { + if swag.IsZero(m.Target) { // not required + return nil + } + + if m.Target != nil { + if err := m.Target.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target") + } + return err + } + } + + return nil +} + +// ContextValidate validate this response diff based on the context it is used +func (m *ResponseDiff) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBaseline(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDiffOps(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTarget(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ResponseDiff) contextValidateBaseline(ctx context.Context, formats strfmt.Registry) error { + + if m.Baseline != nil { + + if swag.IsZero(m.Baseline) { // not required + return nil + } + + if err := m.Baseline.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("baseline") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("baseline") + } + return err + } + } + + return nil +} + +func (m *ResponseDiff) contextValidateDiffOps(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.DiffOps); i++ { + + if m.DiffOps[i] != nil { + + if swag.IsZero(m.DiffOps[i]) { // not required + return nil + } + + if err := m.DiffOps[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("diffOps" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("diffOps" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ResponseDiff) contextValidateTarget(ctx context.Context, formats strfmt.Registry) error { + + if m.Target != nil { + + if swag.IsZero(m.Target) { // not required + return nil + } + + if err := m.Target.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ResponseDiff) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ResponseDiff) UnmarshalBinary(b []byte) error { + var res ResponseDiff + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_execution.go b/models/test_execution.go new file mode 100644 index 0000000..3d938ad --- /dev/null +++ b/models/test_execution.go @@ -0,0 +1,220 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestExecution test execution +// +// swagger:model TestExecution +type TestExecution struct { + + // canceled at + CanceledAt string `json:"canceledAt,omitempty"` + + // created at + CreatedAt string `json:"createdAt,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // results + Results *TestExecutionResults `json:"results,omitempty"` + + // spec + Spec *TestExecutionSpec `json:"spec,omitempty"` + + // status + Status *TestExecutionStatus `json:"status,omitempty"` +} + +// Validate validates this test execution +func (m *TestExecution) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResults(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSpec(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecution) validateResults(formats strfmt.Registry) error { + if swag.IsZero(m.Results) { // not required + return nil + } + + if m.Results != nil { + if err := m.Results.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("results") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("results") + } + return err + } + } + + return nil +} + +func (m *TestExecution) validateSpec(formats strfmt.Registry) error { + if swag.IsZero(m.Spec) { // not required + return nil + } + + if m.Spec != nil { + if err := m.Spec.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("spec") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("spec") + } + return err + } + } + + return nil +} + +func (m *TestExecution) validateStatus(formats strfmt.Registry) error { + if swag.IsZero(m.Status) { // not required + return nil + } + + if m.Status != nil { + if err := m.Status.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + } + + return nil +} + +// ContextValidate validate this test execution based on the context it is used +func (m *TestExecution) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResults(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSpec(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecution) contextValidateResults(ctx context.Context, formats strfmt.Registry) error { + + if m.Results != nil { + + if swag.IsZero(m.Results) { // not required + return nil + } + + if err := m.Results.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("results") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("results") + } + return err + } + } + + return nil +} + +func (m *TestExecution) contextValidateSpec(ctx context.Context, formats strfmt.Registry) error { + + if m.Spec != nil { + + if swag.IsZero(m.Spec) { // not required + return nil + } + + if err := m.Spec.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("spec") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("spec") + } + return err + } + } + + return nil +} + +func (m *TestExecution) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.Status != nil { + + if swag.IsZero(m.Status) { // not required + return nil + } + + if err := m.Status.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TestExecution) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestExecution) UnmarshalBinary(b []byte) error { + var res TestExecution + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_execution_auto_diff.go b/models/test_execution_auto_diff.go new file mode 100644 index 0000000..ce7d567 --- /dev/null +++ b/models/test_execution_auto_diff.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestExecutionAutoDiff test execution auto diff +// +// swagger:model TestExecutionAutoDiff +type TestExecutionAutoDiff struct { + + // Enabled = true, requires the definition of a valid routing context + Enabled bool `json:"enabled,omitempty"` +} + +// Validate validates this test execution auto diff +func (m *TestExecutionAutoDiff) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this test execution auto diff based on context it is used +func (m *TestExecutionAutoDiff) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TestExecutionAutoDiff) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestExecutionAutoDiff) UnmarshalBinary(b []byte) error { + var res TestExecutionAutoDiff + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_execution_canceled_state.go b/models/test_execution_canceled_state.go new file mode 100644 index 0000000..25e46cc --- /dev/null +++ b/models/test_execution_canceled_state.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestExecutionCanceledState test execution canceled state +// +// swagger:model TestExecutionCanceledState +type TestExecutionCanceledState struct { + + // canceled by + CanceledBy string `json:"canceledBy,omitempty"` + + // message + Message string `json:"message,omitempty"` +} + +// Validate validates this test execution canceled state +func (m *TestExecutionCanceledState) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this test execution canceled state based on context it is used +func (m *TestExecutionCanceledState) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TestExecutionCanceledState) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestExecutionCanceledState) UnmarshalBinary(b []byte) error { + var res TestExecutionCanceledState + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_execution_context.go b/models/test_execution_context.go new file mode 100644 index 0000000..f643a42 --- /dev/null +++ b/models/test_execution_context.go @@ -0,0 +1,163 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestExecutionContext test execution context +// +// swagger:model TestExecutionContext +type TestExecutionContext struct { + + // auto diff + AutoDiff *TestExecutionAutoDiff `json:"autoDiff,omitempty"` + + // cluster + Cluster string `json:"cluster,omitempty"` + + // routing + Routing *JobRoutingContext `json:"routing,omitempty"` +} + +// Validate validates this test execution context +func (m *TestExecutionContext) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAutoDiff(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRouting(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecutionContext) validateAutoDiff(formats strfmt.Registry) error { + if swag.IsZero(m.AutoDiff) { // not required + return nil + } + + if m.AutoDiff != nil { + if err := m.AutoDiff.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("autoDiff") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("autoDiff") + } + return err + } + } + + return nil +} + +func (m *TestExecutionContext) validateRouting(formats strfmt.Registry) error { + if swag.IsZero(m.Routing) { // not required + return nil + } + + if m.Routing != nil { + if err := m.Routing.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("routing") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("routing") + } + return err + } + } + + return nil +} + +// ContextValidate validate this test execution context based on the context it is used +func (m *TestExecutionContext) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAutoDiff(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRouting(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecutionContext) contextValidateAutoDiff(ctx context.Context, formats strfmt.Registry) error { + + if m.AutoDiff != nil { + + if swag.IsZero(m.AutoDiff) { // not required + return nil + } + + if err := m.AutoDiff.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("autoDiff") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("autoDiff") + } + return err + } + } + + return nil +} + +func (m *TestExecutionContext) contextValidateRouting(ctx context.Context, formats strfmt.Registry) error { + + if m.Routing != nil { + + if swag.IsZero(m.Routing) { // not required + return nil + } + + if err := m.Routing.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("routing") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("routing") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TestExecutionContext) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestExecutionContext) UnmarshalBinary(b []byte) error { + var res TestExecutionContext + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_execution_failed_state.go b/models/test_execution_failed_state.go new file mode 100644 index 0000000..0a66b82 --- /dev/null +++ b/models/test_execution_failed_state.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestExecutionFailedState test execution failed state +// +// swagger:model TestExecutionFailedState +type TestExecutionFailedState struct { + + // message + Message string `json:"message,omitempty"` +} + +// Validate validates this test execution failed state +func (m *TestExecutionFailedState) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this test execution failed state based on context it is used +func (m *TestExecutionFailedState) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TestExecutionFailedState) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestExecutionFailedState) UnmarshalBinary(b []byte) error { + var res TestExecutionFailedState + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_execution_results.go b/models/test_execution_results.go new file mode 100644 index 0000000..879a428 --- /dev/null +++ b/models/test_execution_results.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestExecutionResults test execution results +// +// swagger:model TestExecutionResults +type TestExecutionResults struct { + + // traffic diff + TrafficDiff *TrafficDiff `json:"trafficDiff,omitempty"` +} + +// Validate validates this test execution results +func (m *TestExecutionResults) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTrafficDiff(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecutionResults) validateTrafficDiff(formats strfmt.Registry) error { + if swag.IsZero(m.TrafficDiff) { // not required + return nil + } + + if m.TrafficDiff != nil { + if err := m.TrafficDiff.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("trafficDiff") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("trafficDiff") + } + return err + } + } + + return nil +} + +// ContextValidate validate this test execution results based on the context it is used +func (m *TestExecutionResults) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTrafficDiff(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecutionResults) contextValidateTrafficDiff(ctx context.Context, formats strfmt.Registry) error { + + if m.TrafficDiff != nil { + + if swag.IsZero(m.TrafficDiff) { // not required + return nil + } + + if err := m.TrafficDiff.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("trafficDiff") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("trafficDiff") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TestExecutionResults) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestExecutionResults) UnmarshalBinary(b []byte) error { + var res TestExecutionResults + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_execution_spec.go b/models/test_execution_spec.go new file mode 100644 index 0000000..b963876 --- /dev/null +++ b/models/test_execution_spec.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestExecutionSpec test execution spec +// +// swagger:model TestExecutionSpec +type TestExecutionSpec struct { + + // execution context + ExecutionContext *TestExecutionContext `json:"executionContext,omitempty"` + + // test + Test string `json:"test,omitempty"` +} + +// Validate validates this test execution spec +func (m *TestExecutionSpec) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateExecutionContext(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecutionSpec) validateExecutionContext(formats strfmt.Registry) error { + if swag.IsZero(m.ExecutionContext) { // not required + return nil + } + + if m.ExecutionContext != nil { + if err := m.ExecutionContext.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executionContext") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executionContext") + } + return err + } + } + + return nil +} + +// ContextValidate validate this test execution spec based on the context it is used +func (m *TestExecutionSpec) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateExecutionContext(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecutionSpec) contextValidateExecutionContext(ctx context.Context, formats strfmt.Registry) error { + + if m.ExecutionContext != nil { + + if swag.IsZero(m.ExecutionContext) { // not required + return nil + } + + if err := m.ExecutionContext.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executionContext") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executionContext") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TestExecutionSpec) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestExecutionSpec) UnmarshalBinary(b []byte) error { + var res TestExecutionSpec + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_execution_state.go b/models/test_execution_state.go new file mode 100644 index 0000000..95a0452 --- /dev/null +++ b/models/test_execution_state.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestExecutionState test execution state +// +// swagger:model TestExecutionState +type TestExecutionState struct { + + // canceled + Canceled *TestExecutionCanceledState `json:"canceled,omitempty"` + + // failed + Failed *TestExecutionFailedState `json:"failed,omitempty"` +} + +// Validate validates this test execution state +func (m *TestExecutionState) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCanceled(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFailed(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecutionState) validateCanceled(formats strfmt.Registry) error { + if swag.IsZero(m.Canceled) { // not required + return nil + } + + if m.Canceled != nil { + if err := m.Canceled.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("canceled") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("canceled") + } + return err + } + } + + return nil +} + +func (m *TestExecutionState) validateFailed(formats strfmt.Registry) error { + if swag.IsZero(m.Failed) { // not required + return nil + } + + if m.Failed != nil { + if err := m.Failed.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("failed") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("failed") + } + return err + } + } + + return nil +} + +// ContextValidate validate this test execution state based on the context it is used +func (m *TestExecutionState) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCanceled(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFailed(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecutionState) contextValidateCanceled(ctx context.Context, formats strfmt.Registry) error { + + if m.Canceled != nil { + + if swag.IsZero(m.Canceled) { // not required + return nil + } + + if err := m.Canceled.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("canceled") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("canceled") + } + return err + } + } + + return nil +} + +func (m *TestExecutionState) contextValidateFailed(ctx context.Context, formats strfmt.Registry) error { + + if m.Failed != nil { + + if swag.IsZero(m.Failed) { // not required + return nil + } + + if err := m.Failed.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("failed") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("failed") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TestExecutionState) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestExecutionState) UnmarshalBinary(b []byte) error { + var res TestExecutionState + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_execution_status.go b/models/test_execution_status.go new file mode 100644 index 0000000..676f3b1 --- /dev/null +++ b/models/test_execution_status.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestExecutionStatus test execution status +// +// swagger:model TestExecutionStatus +type TestExecutionStatus struct { + + // baseline job + BaselineJob string `json:"baselineJob,omitempty"` + + // final state + FinalState *TestExecutionState `json:"finalState,omitempty"` + + // phase + Phase string `json:"phase,omitempty"` + + // target job + TargetJob string `json:"targetJob,omitempty"` + + // triggered by + TriggeredBy *TestExecutionTriggeredBy `json:"triggeredBy,omitempty"` +} + +// Validate validates this test execution status +func (m *TestExecutionStatus) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFinalState(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTriggeredBy(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecutionStatus) validateFinalState(formats strfmt.Registry) error { + if swag.IsZero(m.FinalState) { // not required + return nil + } + + if m.FinalState != nil { + if err := m.FinalState.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("finalState") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("finalState") + } + return err + } + } + + return nil +} + +func (m *TestExecutionStatus) validateTriggeredBy(formats strfmt.Registry) error { + if swag.IsZero(m.TriggeredBy) { // not required + return nil + } + + if m.TriggeredBy != nil { + if err := m.TriggeredBy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("triggeredBy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("triggeredBy") + } + return err + } + } + + return nil +} + +// ContextValidate validate this test execution status based on the context it is used +func (m *TestExecutionStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFinalState(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTriggeredBy(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecutionStatus) contextValidateFinalState(ctx context.Context, formats strfmt.Registry) error { + + if m.FinalState != nil { + + if swag.IsZero(m.FinalState) { // not required + return nil + } + + if err := m.FinalState.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("finalState") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("finalState") + } + return err + } + } + + return nil +} + +func (m *TestExecutionStatus) contextValidateTriggeredBy(ctx context.Context, formats strfmt.Registry) error { + + if m.TriggeredBy != nil { + + if swag.IsZero(m.TriggeredBy) { // not required + return nil + } + + if err := m.TriggeredBy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("triggeredBy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("triggeredBy") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TestExecutionStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestExecutionStatus) UnmarshalBinary(b []byte) error { + var res TestExecutionStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_execution_template.go b/models/test_execution_template.go new file mode 100644 index 0000000..a20fda0 --- /dev/null +++ b/models/test_execution_template.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestExecutionTemplate test execution template +// +// swagger:model TestExecutionTemplate +type TestExecutionTemplate struct { + + // auto diff + AutoDiff *TestExecutionAutoDiff `json:"autoDiff,omitempty"` + + // cluster + Cluster string `json:"cluster,omitempty"` +} + +// Validate validates this test execution template +func (m *TestExecutionTemplate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAutoDiff(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecutionTemplate) validateAutoDiff(formats strfmt.Registry) error { + if swag.IsZero(m.AutoDiff) { // not required + return nil + } + + if m.AutoDiff != nil { + if err := m.AutoDiff.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("autoDiff") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("autoDiff") + } + return err + } + } + + return nil +} + +// ContextValidate validate this test execution template based on the context it is used +func (m *TestExecutionTemplate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAutoDiff(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestExecutionTemplate) contextValidateAutoDiff(ctx context.Context, formats strfmt.Registry) error { + + if m.AutoDiff != nil { + + if swag.IsZero(m.AutoDiff) { // not required + return nil + } + + if err := m.AutoDiff.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("autoDiff") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("autoDiff") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TestExecutionTemplate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestExecutionTemplate) UnmarshalBinary(b []byte) error { + var res TestExecutionTemplate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_execution_triggered_by.go b/models/test_execution_triggered_by.go new file mode 100644 index 0000000..155ee00 --- /dev/null +++ b/models/test_execution_triggered_by.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestExecutionTriggeredBy test execution triggered by +// +// swagger:model TestExecutionTriggeredBy +type TestExecutionTriggeredBy struct { + + // sandbox + Sandbox string `json:"sandbox,omitempty"` + + // trigger ID + TriggerID string `json:"triggerID,omitempty"` +} + +// Validate validates this test execution triggered by +func (m *TestExecutionTriggeredBy) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this test execution triggered by based on context it is used +func (m *TestExecutionTriggeredBy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TestExecutionTriggeredBy) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestExecutionTriggeredBy) UnmarshalBinary(b []byte) error { + var res TestExecutionTriggeredBy + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_spec.go b/models/test_spec.go new file mode 100644 index 0000000..5141e67 --- /dev/null +++ b/models/test_spec.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestSpec test spec +// +// swagger:model TestSpec +type TestSpec struct { + + // script + Script string `json:"script,omitempty"` + + // triggers + Triggers []*TestTrigger `json:"triggers"` +} + +// Validate validates this test spec +func (m *TestSpec) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTriggers(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestSpec) validateTriggers(formats strfmt.Registry) error { + if swag.IsZero(m.Triggers) { // not required + return nil + } + + for i := 0; i < len(m.Triggers); i++ { + if swag.IsZero(m.Triggers[i]) { // not required + continue + } + + if m.Triggers[i] != nil { + if err := m.Triggers[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("triggers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("triggers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this test spec based on the context it is used +func (m *TestSpec) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTriggers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestSpec) contextValidateTriggers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Triggers); i++ { + + if m.Triggers[i] != nil { + + if swag.IsZero(m.Triggers[i]) { // not required + return nil + } + + if err := m.Triggers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("triggers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("triggers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TestSpec) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestSpec) UnmarshalBinary(b []byte) error { + var res TestSpec + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_status.go b/models/test_status.go new file mode 100644 index 0000000..bf600e4 --- /dev/null +++ b/models/test_status.go @@ -0,0 +1,11 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// TestStatus test status +// +// swagger:model TestStatus +type TestStatus interface{} diff --git a/models/test_swagger.go b/models/test_swagger.go new file mode 100644 index 0000000..2928314 --- /dev/null +++ b/models/test_swagger.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Test test +// +// swagger:model Test +type Test struct { + + // created at + CreatedAt string `json:"createdAt,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // spec + Spec *TestSpec `json:"spec,omitempty"` + + // status + Status TestStatus `json:"status,omitempty"` + + // updated at + UpdatedAt string `json:"updatedAt,omitempty"` +} + +// Validate validates this test +func (m *Test) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSpec(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Test) validateSpec(formats strfmt.Registry) error { + if swag.IsZero(m.Spec) { // not required + return nil + } + + if m.Spec != nil { + if err := m.Spec.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("spec") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("spec") + } + return err + } + } + + return nil +} + +// ContextValidate validate this test based on the context it is used +func (m *Test) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSpec(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Test) contextValidateSpec(ctx context.Context, formats strfmt.Registry) error { + + if m.Spec != nil { + + if swag.IsZero(m.Spec) { // not required + return nil + } + + if err := m.Spec.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("spec") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("spec") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Test) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Test) UnmarshalBinary(b []byte) error { + var res Test + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/test_trigger.go b/models/test_trigger.go new file mode 100644 index 0000000..9e293d6 --- /dev/null +++ b/models/test_trigger.go @@ -0,0 +1,163 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestTrigger test trigger +// +// swagger:model TestTrigger +type TestTrigger struct { + + // execution template + ExecutionTemplate *TestExecutionTemplate `json:"executionTemplate,omitempty"` + + // id + ID string `json:"id,omitempty"` + + // sandbox of + SandboxOf *SandboxForkOf `json:"sandboxOf,omitempty"` +} + +// Validate validates this test trigger +func (m *TestTrigger) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateExecutionTemplate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSandboxOf(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestTrigger) validateExecutionTemplate(formats strfmt.Registry) error { + if swag.IsZero(m.ExecutionTemplate) { // not required + return nil + } + + if m.ExecutionTemplate != nil { + if err := m.ExecutionTemplate.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executionTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executionTemplate") + } + return err + } + } + + return nil +} + +func (m *TestTrigger) validateSandboxOf(formats strfmt.Registry) error { + if swag.IsZero(m.SandboxOf) { // not required + return nil + } + + if m.SandboxOf != nil { + if err := m.SandboxOf.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sandboxOf") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sandboxOf") + } + return err + } + } + + return nil +} + +// ContextValidate validate this test trigger based on the context it is used +func (m *TestTrigger) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateExecutionTemplate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSandboxOf(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestTrigger) contextValidateExecutionTemplate(ctx context.Context, formats strfmt.Registry) error { + + if m.ExecutionTemplate != nil { + + if swag.IsZero(m.ExecutionTemplate) { // not required + return nil + } + + if err := m.ExecutionTemplate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("executionTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("executionTemplate") + } + return err + } + } + + return nil +} + +func (m *TestTrigger) contextValidateSandboxOf(ctx context.Context, formats strfmt.Registry) error { + + if m.SandboxOf != nil { + + if swag.IsZero(m.SandboxOf) { // not required + return nil + } + + if err := m.SandboxOf.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sandboxOf") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sandboxOf") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TestTrigger) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestTrigger) UnmarshalBinary(b []byte) error { + var res TestTrigger + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/testexecutions_query_result.go b/models/testexecutions_query_result.go new file mode 100644 index 0000000..6296f39 --- /dev/null +++ b/models/testexecutions_query_result.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TestexecutionsQueryResult testexecutions query result +// +// swagger:model testexecutions.QueryResult +type TestexecutionsQueryResult struct { + + // cursor + Cursor string `json:"cursor,omitempty"` + + // execution + Execution *TestExecution `json:"execution,omitempty"` +} + +// Validate validates this testexecutions query result +func (m *TestexecutionsQueryResult) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateExecution(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestexecutionsQueryResult) validateExecution(formats strfmt.Registry) error { + if swag.IsZero(m.Execution) { // not required + return nil + } + + if m.Execution != nil { + if err := m.Execution.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("execution") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("execution") + } + return err + } + } + + return nil +} + +// ContextValidate validate this testexecutions query result based on the context it is used +func (m *TestexecutionsQueryResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateExecution(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TestexecutionsQueryResult) contextValidateExecution(ctx context.Context, formats strfmt.Registry) error { + + if m.Execution != nil { + + if swag.IsZero(m.Execution) { // not required + return nil + } + + if err := m.Execution.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("execution") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("execution") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TestexecutionsQueryResult) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TestexecutionsQueryResult) UnmarshalBinary(b []byte) error { + var res TestexecutionsQueryResult + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/traffic_diff.go b/models/traffic_diff.go new file mode 100644 index 0000000..1b08219 --- /dev/null +++ b/models/traffic_diff.go @@ -0,0 +1,264 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TrafficDiff traffic diff +// +// swagger:model TrafficDiff +type TrafficDiff struct { + + // additions + Additions int64 `json:"additions,omitempty"` + + // capture points + CapturePoints int64 `json:"capturePoints,omitempty"` + + // captures + Captures int64 `json:"captures,omitempty"` + + // green + Green []*CapturePointDiffSummary `json:"green"` + + // MaxRelevance indicates a score in 0..1 of the maximally relevant + // diff of captures. + MaxRelevance float64 `json:"maxRelevance,omitempty"` + + // red + Red []*CapturePointDiffSummary `json:"red"` + + // removals + Removals int64 `json:"removals,omitempty"` + + // replacements + Replacements int64 `json:"replacements,omitempty"` + + // yellow + Yellow []*CapturePointDiffSummary `json:"yellow"` +} + +// Validate validates this traffic diff +func (m *TrafficDiff) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateGreen(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateYellow(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TrafficDiff) validateGreen(formats strfmt.Registry) error { + if swag.IsZero(m.Green) { // not required + return nil + } + + for i := 0; i < len(m.Green); i++ { + if swag.IsZero(m.Green[i]) { // not required + continue + } + + if m.Green[i] != nil { + if err := m.Green[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("green" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("green" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TrafficDiff) validateRed(formats strfmt.Registry) error { + if swag.IsZero(m.Red) { // not required + return nil + } + + for i := 0; i < len(m.Red); i++ { + if swag.IsZero(m.Red[i]) { // not required + continue + } + + if m.Red[i] != nil { + if err := m.Red[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("red" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("red" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TrafficDiff) validateYellow(formats strfmt.Registry) error { + if swag.IsZero(m.Yellow) { // not required + return nil + } + + for i := 0; i < len(m.Yellow); i++ { + if swag.IsZero(m.Yellow[i]) { // not required + continue + } + + if m.Yellow[i] != nil { + if err := m.Yellow[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("yellow" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("yellow" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this traffic diff based on the context it is used +func (m *TrafficDiff) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGreen(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRed(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateYellow(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TrafficDiff) contextValidateGreen(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Green); i++ { + + if m.Green[i] != nil { + + if swag.IsZero(m.Green[i]) { // not required + return nil + } + + if err := m.Green[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("green" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("green" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TrafficDiff) contextValidateRed(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Red); i++ { + + if m.Red[i] != nil { + + if swag.IsZero(m.Red[i]) { // not required + return nil + } + + if err := m.Red[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("red" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("red" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TrafficDiff) contextValidateYellow(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Yellow); i++ { + + if m.Yellow[i] != nil { + + if swag.IsZero(m.Yellow[i]) { // not required + return nil + } + + if err := m.Yellow[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("yellow" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("yellow" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TrafficDiff) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TrafficDiff) UnmarshalBinary(b []byte) error { + var res TrafficDiff + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/traffic_diff_paired_diff.go b/models/traffic_diff_paired_diff.go new file mode 100644 index 0000000..bf494d4 --- /dev/null +++ b/models/traffic_diff_paired_diff.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TrafficDiffPairedDiff traffic diff paired diff +// +// swagger:model TrafficDiffPairedDiff +type TrafficDiffPairedDiff struct { + + // request + Request *RequestDiff `json:"request,omitempty"` + + // response + Response *ResponseDiff `json:"response,omitempty"` +} + +// Validate validates this traffic diff paired diff +func (m *TrafficDiffPairedDiff) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRequest(formats); err != nil { + res = append(res, err) + } + + if err := m.validateResponse(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TrafficDiffPairedDiff) validateRequest(formats strfmt.Registry) error { + if swag.IsZero(m.Request) { // not required + return nil + } + + if m.Request != nil { + if err := m.Request.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("request") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("request") + } + return err + } + } + + return nil +} + +func (m *TrafficDiffPairedDiff) validateResponse(formats strfmt.Registry) error { + if swag.IsZero(m.Response) { // not required + return nil + } + + if m.Response != nil { + if err := m.Response.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("response") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("response") + } + return err + } + } + + return nil +} + +// ContextValidate validate this traffic diff paired diff based on the context it is used +func (m *TrafficDiffPairedDiff) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRequest(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateResponse(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TrafficDiffPairedDiff) contextValidateRequest(ctx context.Context, formats strfmt.Registry) error { + + if m.Request != nil { + + if swag.IsZero(m.Request) { // not required + return nil + } + + if err := m.Request.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("request") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("request") + } + return err + } + } + + return nil +} + +func (m *TrafficDiffPairedDiff) contextValidateResponse(ctx context.Context, formats strfmt.Registry) error { + + if m.Response != nil { + + if swag.IsZero(m.Response) { // not required + return nil + } + + if err := m.Response.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("response") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("response") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TrafficDiffPairedDiff) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TrafficDiffPairedDiff) UnmarshalBinary(b []byte) error { + var res TrafficDiffPairedDiff + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/traffic_diff_point_result.go b/models/traffic_diff_point_result.go new file mode 100644 index 0000000..a35607a --- /dev/null +++ b/models/traffic_diff_point_result.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TrafficDiffPointResult traffic diff point result +// +// swagger:model TrafficDiffPointResult +type TrafficDiffPointResult struct { + + // by + By *TrafficmodelsBy `json:"by,omitempty"` + + // diffs + Diffs []*TrafficDiffPairedDiff `json:"diffs"` +} + +// Validate validates this traffic diff point result +func (m *TrafficDiffPointResult) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDiffs(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TrafficDiffPointResult) validateBy(formats strfmt.Registry) error { + if swag.IsZero(m.By) { // not required + return nil + } + + if m.By != nil { + if err := m.By.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("by") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("by") + } + return err + } + } + + return nil +} + +func (m *TrafficDiffPointResult) validateDiffs(formats strfmt.Registry) error { + if swag.IsZero(m.Diffs) { // not required + return nil + } + + for i := 0; i < len(m.Diffs); i++ { + if swag.IsZero(m.Diffs[i]) { // not required + continue + } + + if m.Diffs[i] != nil { + if err := m.Diffs[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("diffs" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("diffs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this traffic diff point result based on the context it is used +func (m *TrafficDiffPointResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDiffs(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TrafficDiffPointResult) contextValidateBy(ctx context.Context, formats strfmt.Registry) error { + + if m.By != nil { + + if swag.IsZero(m.By) { // not required + return nil + } + + if err := m.By.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("by") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("by") + } + return err + } + } + + return nil +} + +func (m *TrafficDiffPointResult) contextValidateDiffs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Diffs); i++ { + + if m.Diffs[i] != nil { + + if swag.IsZero(m.Diffs[i]) { // not required + return nil + } + + if err := m.Diffs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("diffs" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("diffs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TrafficDiffPointResult) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TrafficDiffPointResult) UnmarshalBinary(b []byte) error { + var res TrafficDiffPointResult + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/traffic_diff_result.go b/models/traffic_diff_result.go new file mode 100644 index 0000000..ee383db --- /dev/null +++ b/models/traffic_diff_result.go @@ -0,0 +1,127 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TrafficDiffResult traffic diff result +// +// swagger:model TrafficDiffResult +type TrafficDiffResult struct { + + // baseline + Baseline string `json:"baseline,omitempty"` + + // results + Results []*TrafficDiffPointResult `json:"results"` + + // target + Target string `json:"target,omitempty"` +} + +// Validate validates this traffic diff result +func (m *TrafficDiffResult) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResults(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TrafficDiffResult) validateResults(formats strfmt.Registry) error { + if swag.IsZero(m.Results) { // not required + return nil + } + + for i := 0; i < len(m.Results); i++ { + if swag.IsZero(m.Results[i]) { // not required + continue + } + + if m.Results[i] != nil { + if err := m.Results[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("results" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("results" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this traffic diff result based on the context it is used +func (m *TrafficDiffResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResults(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TrafficDiffResult) contextValidateResults(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Results); i++ { + + if m.Results[i] != nil { + + if swag.IsZero(m.Results[i]) { // not required + return nil + } + + if err := m.Results[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("results" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("results" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TrafficDiffResult) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TrafficDiffResult) UnmarshalBinary(b []byte) error { + var res TrafficDiffResult + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/trafficmodels_by.go b/models/trafficmodels_by.go new file mode 100644 index 0000000..ab3964b --- /dev/null +++ b/models/trafficmodels_by.go @@ -0,0 +1,59 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TrafficmodelsBy trafficmodels by +// +// swagger:model trafficmodels.By +type TrafficmodelsBy struct { + + // direction + Direction string `json:"direction,omitempty"` + + // kind + Kind string `json:"kind,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // namespace + Namespace string `json:"namespace,omitempty"` +} + +// Validate validates this trafficmodels by +func (m *TrafficmodelsBy) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this trafficmodels by based on context it is used +func (m *TrafficmodelsBy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TrafficmodelsBy) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TrafficmodelsBy) UnmarshalBinary(b []byte) error { + var res TrafficmodelsBy + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}