From 655e0a64bf173a18ac77528b1486e8f5aee828f9 Mon Sep 17 00:00:00 2001 From: "metal-robot[bot]" <68018895+metal-robot[bot]@users.noreply.github.com> Date: Wed, 11 Oct 2023 10:18:04 +0200 Subject: [PATCH] Bump metal-api to version v0.24.2 (#134) * Bump metal-api to version v0.24.2 * Bump to version v0.24.2 --------- Co-authored-by: metal-stack --- VERSION | 2 +- api/client/machine/issues_parameters.go | 150 +++++++ api/client/machine/issues_responses.go | 181 +++++++++ api/client/machine/list_issues_parameters.go | 128 ++++++ api/client/machine/list_issues_responses.go | 181 +++++++++ api/client/machine/machine_client.go | 80 ++++ .../partition_capacity_compat_parameters.go | 128 ------ .../partition_capacity_compat_responses.go | 181 --------- api/client/partition/partition_client.go | 40 -- api/models/v1_machine_issue.go | 139 +++++++ api/models/v1_machine_issue_response.go | 88 +++++ api/models/v1_machine_issues_request.go | 296 ++++++++++++++ metal-api.json | 368 ++++++++++++++++-- test/mocks/machine/ClientService.go | 66 ++++ test/mocks/partition/ClientService.go | 33 -- 15 files changed, 1646 insertions(+), 415 deletions(-) create mode 100644 api/client/machine/issues_parameters.go create mode 100644 api/client/machine/issues_responses.go create mode 100644 api/client/machine/list_issues_parameters.go create mode 100644 api/client/machine/list_issues_responses.go delete mode 100644 api/client/partition/partition_capacity_compat_parameters.go delete mode 100644 api/client/partition/partition_capacity_compat_responses.go create mode 100644 api/models/v1_machine_issue.go create mode 100644 api/models/v1_machine_issue_response.go create mode 100644 api/models/v1_machine_issues_request.go diff --git a/VERSION b/VERSION index b61be290..6205e5bf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.24.1 +v0.24.2 diff --git a/api/client/machine/issues_parameters.go b/api/client/machine/issues_parameters.go new file mode 100644 index 00000000..63688bc5 --- /dev/null +++ b/api/client/machine/issues_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package machine + +// 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/metal-stack/metal-go/api/models" +) + +// NewIssuesParams creates a new IssuesParams 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 NewIssuesParams() *IssuesParams { + return &IssuesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewIssuesParamsWithTimeout creates a new IssuesParams object +// with the ability to set a timeout on a request. +func NewIssuesParamsWithTimeout(timeout time.Duration) *IssuesParams { + return &IssuesParams{ + timeout: timeout, + } +} + +// NewIssuesParamsWithContext creates a new IssuesParams object +// with the ability to set a context for a request. +func NewIssuesParamsWithContext(ctx context.Context) *IssuesParams { + return &IssuesParams{ + Context: ctx, + } +} + +// NewIssuesParamsWithHTTPClient creates a new IssuesParams object +// with the ability to set a custom HTTPClient for a request. +func NewIssuesParamsWithHTTPClient(client *http.Client) *IssuesParams { + return &IssuesParams{ + HTTPClient: client, + } +} + +/* +IssuesParams contains all the parameters to send to the API endpoint + + for the issues operation. + + Typically these are written to a http.Request. +*/ +type IssuesParams struct { + + // Body. + Body *models.V1MachineIssuesRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the issues params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *IssuesParams) WithDefaults() *IssuesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the issues params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *IssuesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the issues params +func (o *IssuesParams) WithTimeout(timeout time.Duration) *IssuesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the issues params +func (o *IssuesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the issues params +func (o *IssuesParams) WithContext(ctx context.Context) *IssuesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the issues params +func (o *IssuesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the issues params +func (o *IssuesParams) WithHTTPClient(client *http.Client) *IssuesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the issues params +func (o *IssuesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the issues params +func (o *IssuesParams) WithBody(body *models.V1MachineIssuesRequest) *IssuesParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the issues params +func (o *IssuesParams) SetBody(body *models.V1MachineIssuesRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *IssuesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/api/client/machine/issues_responses.go b/api/client/machine/issues_responses.go new file mode 100644 index 00000000..6fcb0d73 --- /dev/null +++ b/api/client/machine/issues_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package machine + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/metal-stack/metal-go/api/models" + "github.com/metal-stack/metal-lib/httperrors" +) + +// IssuesReader is a Reader for the Issues structure. +type IssuesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *IssuesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewIssuesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewIssuesDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewIssuesOK creates a IssuesOK with default headers values +func NewIssuesOK() *IssuesOK { + return &IssuesOK{} +} + +/* +IssuesOK describes a response with status code 200, with default header values. + +OK +*/ +type IssuesOK struct { + Payload []*models.V1MachineIssueResponse +} + +// IsSuccess returns true when this issues o k response has a 2xx status code +func (o *IssuesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this issues o k response has a 3xx status code +func (o *IssuesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this issues o k response has a 4xx status code +func (o *IssuesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this issues o k response has a 5xx status code +func (o *IssuesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this issues o k response a status code equal to that given +func (o *IssuesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the issues o k response +func (o *IssuesOK) Code() int { + return 200 +} + +func (o *IssuesOK) Error() string { + return fmt.Sprintf("[POST /v1/machine/issues/evaluate][%d] issuesOK %+v", 200, o.Payload) +} + +func (o *IssuesOK) String() string { + return fmt.Sprintf("[POST /v1/machine/issues/evaluate][%d] issuesOK %+v", 200, o.Payload) +} + +func (o *IssuesOK) GetPayload() []*models.V1MachineIssueResponse { + return o.Payload +} + +func (o *IssuesOK) 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 +} + +// NewIssuesDefault creates a IssuesDefault with default headers values +func NewIssuesDefault(code int) *IssuesDefault { + return &IssuesDefault{ + _statusCode: code, + } +} + +/* +IssuesDefault describes a response with status code -1, with default header values. + +Error +*/ +type IssuesDefault struct { + _statusCode int + + Payload *httperrors.HTTPErrorResponse +} + +// IsSuccess returns true when this issues default response has a 2xx status code +func (o *IssuesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this issues default response has a 3xx status code +func (o *IssuesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this issues default response has a 4xx status code +func (o *IssuesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this issues default response has a 5xx status code +func (o *IssuesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this issues default response a status code equal to that given +func (o *IssuesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the issues default response +func (o *IssuesDefault) Code() int { + return o._statusCode +} + +func (o *IssuesDefault) Error() string { + return fmt.Sprintf("[POST /v1/machine/issues/evaluate][%d] issues default %+v", o._statusCode, o.Payload) +} + +func (o *IssuesDefault) String() string { + return fmt.Sprintf("[POST /v1/machine/issues/evaluate][%d] issues default %+v", o._statusCode, o.Payload) +} + +func (o *IssuesDefault) GetPayload() *httperrors.HTTPErrorResponse { + return o.Payload +} + +func (o *IssuesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(httperrors.HTTPErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/api/client/machine/list_issues_parameters.go b/api/client/machine/list_issues_parameters.go new file mode 100644 index 00000000..80755798 --- /dev/null +++ b/api/client/machine/list_issues_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package machine + +// 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" +) + +// NewListIssuesParams creates a new ListIssuesParams 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 NewListIssuesParams() *ListIssuesParams { + return &ListIssuesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListIssuesParamsWithTimeout creates a new ListIssuesParams object +// with the ability to set a timeout on a request. +func NewListIssuesParamsWithTimeout(timeout time.Duration) *ListIssuesParams { + return &ListIssuesParams{ + timeout: timeout, + } +} + +// NewListIssuesParamsWithContext creates a new ListIssuesParams object +// with the ability to set a context for a request. +func NewListIssuesParamsWithContext(ctx context.Context) *ListIssuesParams { + return &ListIssuesParams{ + Context: ctx, + } +} + +// NewListIssuesParamsWithHTTPClient creates a new ListIssuesParams object +// with the ability to set a custom HTTPClient for a request. +func NewListIssuesParamsWithHTTPClient(client *http.Client) *ListIssuesParams { + return &ListIssuesParams{ + HTTPClient: client, + } +} + +/* +ListIssuesParams contains all the parameters to send to the API endpoint + + for the list issues operation. + + Typically these are written to a http.Request. +*/ +type ListIssuesParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list issues params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListIssuesParams) WithDefaults() *ListIssuesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list issues params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListIssuesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list issues params +func (o *ListIssuesParams) WithTimeout(timeout time.Duration) *ListIssuesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list issues params +func (o *ListIssuesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list issues params +func (o *ListIssuesParams) WithContext(ctx context.Context) *ListIssuesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list issues params +func (o *ListIssuesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list issues params +func (o *ListIssuesParams) WithHTTPClient(client *http.Client) *ListIssuesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list issues params +func (o *ListIssuesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ListIssuesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/api/client/machine/list_issues_responses.go b/api/client/machine/list_issues_responses.go new file mode 100644 index 00000000..0d5309dc --- /dev/null +++ b/api/client/machine/list_issues_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package machine + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/metal-stack/metal-go/api/models" + "github.com/metal-stack/metal-lib/httperrors" +) + +// ListIssuesReader is a Reader for the ListIssues structure. +type ListIssuesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListIssuesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListIssuesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListIssuesDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListIssuesOK creates a ListIssuesOK with default headers values +func NewListIssuesOK() *ListIssuesOK { + return &ListIssuesOK{} +} + +/* +ListIssuesOK describes a response with status code 200, with default header values. + +OK +*/ +type ListIssuesOK struct { + Payload []*models.V1MachineIssue +} + +// IsSuccess returns true when this list issues o k response has a 2xx status code +func (o *ListIssuesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list issues o k response has a 3xx status code +func (o *ListIssuesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list issues o k response has a 4xx status code +func (o *ListIssuesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list issues o k response has a 5xx status code +func (o *ListIssuesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list issues o k response a status code equal to that given +func (o *ListIssuesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list issues o k response +func (o *ListIssuesOK) Code() int { + return 200 +} + +func (o *ListIssuesOK) Error() string { + return fmt.Sprintf("[GET /v1/machine/issues][%d] listIssuesOK %+v", 200, o.Payload) +} + +func (o *ListIssuesOK) String() string { + return fmt.Sprintf("[GET /v1/machine/issues][%d] listIssuesOK %+v", 200, o.Payload) +} + +func (o *ListIssuesOK) GetPayload() []*models.V1MachineIssue { + return o.Payload +} + +func (o *ListIssuesOK) 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 +} + +// NewListIssuesDefault creates a ListIssuesDefault with default headers values +func NewListIssuesDefault(code int) *ListIssuesDefault { + return &ListIssuesDefault{ + _statusCode: code, + } +} + +/* +ListIssuesDefault describes a response with status code -1, with default header values. + +Error +*/ +type ListIssuesDefault struct { + _statusCode int + + Payload *httperrors.HTTPErrorResponse +} + +// IsSuccess returns true when this list issues default response has a 2xx status code +func (o *ListIssuesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list issues default response has a 3xx status code +func (o *ListIssuesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list issues default response has a 4xx status code +func (o *ListIssuesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list issues default response has a 5xx status code +func (o *ListIssuesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list issues default response a status code equal to that given +func (o *ListIssuesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list issues default response +func (o *ListIssuesDefault) Code() int { + return o._statusCode +} + +func (o *ListIssuesDefault) Error() string { + return fmt.Sprintf("[GET /v1/machine/issues][%d] listIssues default %+v", o._statusCode, o.Payload) +} + +func (o *ListIssuesDefault) String() string { + return fmt.Sprintf("[GET /v1/machine/issues][%d] listIssues default %+v", o._statusCode, o.Payload) +} + +func (o *ListIssuesDefault) GetPayload() *httperrors.HTTPErrorResponse { + return o.Payload +} + +func (o *ListIssuesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(httperrors.HTTPErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/api/client/machine/machine_client.go b/api/client/machine/machine_client.go index 94baef5e..804bb8ca 100644 --- a/api/client/machine/machine_client.go +++ b/api/client/machine/machine_client.go @@ -50,6 +50,10 @@ type ClientService interface { IpmiReport(params *IpmiReportParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IpmiReportOK, error) + Issues(params *IssuesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IssuesOK, error) + + ListIssues(params *ListIssuesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListIssuesOK, error) + ListMachines(params *ListMachinesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListMachinesOK, error) MachineBios(params *MachineBiosParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MachineBiosOK, error) @@ -495,6 +499,82 @@ func (a *Client) IpmiReport(params *IpmiReportParams, authInfo runtime.ClientAut return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +Issues returns machine issues +*/ +func (a *Client) Issues(params *IssuesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IssuesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewIssuesParams() + } + op := &runtime.ClientOperation{ + ID: "issues", + Method: "POST", + PathPattern: "/v1/machine/issues/evaluate", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &IssuesReader{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.(*IssuesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*IssuesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListIssues returns the list of issues that exist in the API +*/ +func (a *Client) ListIssues(params *ListIssuesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListIssuesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListIssuesParams() + } + op := &runtime.ClientOperation{ + ID: "listIssues", + Method: "GET", + PathPattern: "/v1/machine/issues", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListIssuesReader{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.(*ListIssuesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListIssuesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* ListMachines gets all known machines */ diff --git a/api/client/partition/partition_capacity_compat_parameters.go b/api/client/partition/partition_capacity_compat_parameters.go deleted file mode 100644 index 4503a55b..00000000 --- a/api/client/partition/partition_capacity_compat_parameters.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package partition - -// 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" -) - -// NewPartitionCapacityCompatParams creates a new PartitionCapacityCompatParams 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 NewPartitionCapacityCompatParams() *PartitionCapacityCompatParams { - return &PartitionCapacityCompatParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPartitionCapacityCompatParamsWithTimeout creates a new PartitionCapacityCompatParams object -// with the ability to set a timeout on a request. -func NewPartitionCapacityCompatParamsWithTimeout(timeout time.Duration) *PartitionCapacityCompatParams { - return &PartitionCapacityCompatParams{ - timeout: timeout, - } -} - -// NewPartitionCapacityCompatParamsWithContext creates a new PartitionCapacityCompatParams object -// with the ability to set a context for a request. -func NewPartitionCapacityCompatParamsWithContext(ctx context.Context) *PartitionCapacityCompatParams { - return &PartitionCapacityCompatParams{ - Context: ctx, - } -} - -// NewPartitionCapacityCompatParamsWithHTTPClient creates a new PartitionCapacityCompatParams object -// with the ability to set a custom HTTPClient for a request. -func NewPartitionCapacityCompatParamsWithHTTPClient(client *http.Client) *PartitionCapacityCompatParams { - return &PartitionCapacityCompatParams{ - HTTPClient: client, - } -} - -/* -PartitionCapacityCompatParams contains all the parameters to send to the API endpoint - - for the partition capacity compat operation. - - Typically these are written to a http.Request. -*/ -type PartitionCapacityCompatParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the partition capacity compat params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PartitionCapacityCompatParams) WithDefaults() *PartitionCapacityCompatParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the partition capacity compat params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PartitionCapacityCompatParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the partition capacity compat params -func (o *PartitionCapacityCompatParams) WithTimeout(timeout time.Duration) *PartitionCapacityCompatParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the partition capacity compat params -func (o *PartitionCapacityCompatParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the partition capacity compat params -func (o *PartitionCapacityCompatParams) WithContext(ctx context.Context) *PartitionCapacityCompatParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the partition capacity compat params -func (o *PartitionCapacityCompatParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the partition capacity compat params -func (o *PartitionCapacityCompatParams) WithHTTPClient(client *http.Client) *PartitionCapacityCompatParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the partition capacity compat params -func (o *PartitionCapacityCompatParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *PartitionCapacityCompatParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/client/partition/partition_capacity_compat_responses.go b/api/client/partition/partition_capacity_compat_responses.go deleted file mode 100644 index 287f587c..00000000 --- a/api/client/partition/partition_capacity_compat_responses.go +++ /dev/null @@ -1,181 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package partition - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/metal-stack/metal-go/api/models" - "github.com/metal-stack/metal-lib/httperrors" -) - -// PartitionCapacityCompatReader is a Reader for the PartitionCapacityCompat structure. -type PartitionCapacityCompatReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PartitionCapacityCompatReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewPartitionCapacityCompatOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewPartitionCapacityCompatDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewPartitionCapacityCompatOK creates a PartitionCapacityCompatOK with default headers values -func NewPartitionCapacityCompatOK() *PartitionCapacityCompatOK { - return &PartitionCapacityCompatOK{} -} - -/* -PartitionCapacityCompatOK describes a response with status code 200, with default header values. - -OK -*/ -type PartitionCapacityCompatOK struct { - Payload []*models.V1PartitionCapacity -} - -// IsSuccess returns true when this partition capacity compat o k response has a 2xx status code -func (o *PartitionCapacityCompatOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this partition capacity compat o k response has a 3xx status code -func (o *PartitionCapacityCompatOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this partition capacity compat o k response has a 4xx status code -func (o *PartitionCapacityCompatOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this partition capacity compat o k response has a 5xx status code -func (o *PartitionCapacityCompatOK) IsServerError() bool { - return false -} - -// IsCode returns true when this partition capacity compat o k response a status code equal to that given -func (o *PartitionCapacityCompatOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the partition capacity compat o k response -func (o *PartitionCapacityCompatOK) Code() int { - return 200 -} - -func (o *PartitionCapacityCompatOK) Error() string { - return fmt.Sprintf("[GET /v1/partition/capacity][%d] partitionCapacityCompatOK %+v", 200, o.Payload) -} - -func (o *PartitionCapacityCompatOK) String() string { - return fmt.Sprintf("[GET /v1/partition/capacity][%d] partitionCapacityCompatOK %+v", 200, o.Payload) -} - -func (o *PartitionCapacityCompatOK) GetPayload() []*models.V1PartitionCapacity { - return o.Payload -} - -func (o *PartitionCapacityCompatOK) 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 -} - -// NewPartitionCapacityCompatDefault creates a PartitionCapacityCompatDefault with default headers values -func NewPartitionCapacityCompatDefault(code int) *PartitionCapacityCompatDefault { - return &PartitionCapacityCompatDefault{ - _statusCode: code, - } -} - -/* -PartitionCapacityCompatDefault describes a response with status code -1, with default header values. - -Error -*/ -type PartitionCapacityCompatDefault struct { - _statusCode int - - Payload *httperrors.HTTPErrorResponse -} - -// IsSuccess returns true when this partition capacity compat default response has a 2xx status code -func (o *PartitionCapacityCompatDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this partition capacity compat default response has a 3xx status code -func (o *PartitionCapacityCompatDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this partition capacity compat default response has a 4xx status code -func (o *PartitionCapacityCompatDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this partition capacity compat default response has a 5xx status code -func (o *PartitionCapacityCompatDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this partition capacity compat default response a status code equal to that given -func (o *PartitionCapacityCompatDefault) IsCode(code int) bool { - return o._statusCode == code -} - -// Code gets the status code for the partition capacity compat default response -func (o *PartitionCapacityCompatDefault) Code() int { - return o._statusCode -} - -func (o *PartitionCapacityCompatDefault) Error() string { - return fmt.Sprintf("[GET /v1/partition/capacity][%d] partitionCapacityCompat default %+v", o._statusCode, o.Payload) -} - -func (o *PartitionCapacityCompatDefault) String() string { - return fmt.Sprintf("[GET /v1/partition/capacity][%d] partitionCapacityCompat default %+v", o._statusCode, o.Payload) -} - -func (o *PartitionCapacityCompatDefault) GetPayload() *httperrors.HTTPErrorResponse { - return o.Payload -} - -func (o *PartitionCapacityCompatDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(httperrors.HTTPErrorResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/api/client/partition/partition_client.go b/api/client/partition/partition_client.go index a511dbee..d629fe40 100644 --- a/api/client/partition/partition_client.go +++ b/api/client/partition/partition_client.go @@ -38,8 +38,6 @@ type ClientService interface { PartitionCapacity(params *PartitionCapacityParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PartitionCapacityOK, error) - PartitionCapacityCompat(params *PartitionCapacityCompatParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PartitionCapacityCompatOK, error) - UpdatePartition(params *UpdatePartitionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdatePartitionOK, error) SetTransport(transport runtime.ClientTransport) @@ -235,44 +233,6 @@ func (a *Client) PartitionCapacity(params *PartitionCapacityParams, authInfo run return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } -/* -PartitionCapacityCompat gets partition capacity -*/ -func (a *Client) PartitionCapacityCompat(params *PartitionCapacityCompatParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PartitionCapacityCompatOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPartitionCapacityCompatParams() - } - op := &runtime.ClientOperation{ - ID: "partitionCapacityCompat", - Method: "GET", - PathPattern: "/v1/partition/capacity", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PartitionCapacityCompatReader{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.(*PartitionCapacityCompatOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*PartitionCapacityCompatDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - /* UpdatePartition updates a partition if the partition was changed since this one was read a conflict is returned */ diff --git a/api/models/v1_machine_issue.go b/api/models/v1_machine_issue.go new file mode 100644 index 00000000..fdb888c3 --- /dev/null +++ b/api/models/v1_machine_issue.go @@ -0,0 +1,139 @@ +// 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" + "github.com/go-openapi/validate" +) + +// V1MachineIssue v1 machine issue +// +// swagger:model v1.MachineIssue +type V1MachineIssue struct { + + // a description of the issue + // Required: true + Description *string `json:"description" yaml:"description"` + + // details of the issue + // Required: true + Details *string `json:"details" yaml:"details"` + + // the id of the issue + // Required: true + ID *string `json:"id" yaml:"id"` + + // an issue reference to the issue in metal-stack docs + // Required: true + RefURL *string `json:"ref_url" yaml:"ref_url"` + + // the severity of the issue + // Required: true + Severity *string `json:"severity" yaml:"severity"` +} + +// Validate validates this v1 machine issue +func (m *V1MachineIssue) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDetails(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRefURL(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSeverity(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1MachineIssue) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *V1MachineIssue) validateDetails(formats strfmt.Registry) error { + + if err := validate.Required("details", "body", m.Details); err != nil { + return err + } + + return nil +} + +func (m *V1MachineIssue) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *V1MachineIssue) validateRefURL(formats strfmt.Registry) error { + + if err := validate.Required("ref_url", "body", m.RefURL); err != nil { + return err + } + + return nil +} + +func (m *V1MachineIssue) validateSeverity(formats strfmt.Registry) error { + + if err := validate.Required("severity", "body", m.Severity); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 machine issue based on context it is used +func (m *V1MachineIssue) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1MachineIssue) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1MachineIssue) UnmarshalBinary(b []byte) error { + var res V1MachineIssue + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_machine_issue_response.go b/api/models/v1_machine_issue_response.go new file mode 100644 index 00000000..4f4cbffc --- /dev/null +++ b/api/models/v1_machine_issue_response.go @@ -0,0 +1,88 @@ +// 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" + "github.com/go-openapi/validate" +) + +// V1MachineIssueResponse v1 machine issue response +// +// swagger:model v1.MachineIssueResponse +type V1MachineIssueResponse struct { + + // the list of issues (only issue ids) of this machine + // Required: true + Issues []string `json:"issues" yaml:"issues"` + + // the machine id that has the given issues + // Required: true + Machineid *string `json:"machineid" yaml:"machineid"` +} + +// Validate validates this v1 machine issue response +func (m *V1MachineIssueResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIssues(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMachineid(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1MachineIssueResponse) validateIssues(formats strfmt.Registry) error { + + if err := validate.Required("issues", "body", m.Issues); err != nil { + return err + } + + return nil +} + +func (m *V1MachineIssueResponse) validateMachineid(formats strfmt.Registry) error { + + if err := validate.Required("machineid", "body", m.Machineid); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 machine issue response based on context it is used +func (m *V1MachineIssueResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1MachineIssueResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1MachineIssueResponse) UnmarshalBinary(b []byte) error { + var res V1MachineIssueResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_machine_issues_request.go b/api/models/v1_machine_issues_request.go new file mode 100644 index 00000000..3e4164b6 --- /dev/null +++ b/api/models/v1_machine_issues_request.go @@ -0,0 +1,296 @@ +// 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" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// V1MachineIssuesRequest v1 machine issues request +// +// swagger:model v1.MachineIssuesRequest +type V1MachineIssuesRequest struct { + + // allocation hostname + AllocationHostname string `json:"allocation_hostname,omitempty" yaml:"allocation_hostname,omitempty"` + + // allocation image id + AllocationImageID string `json:"allocation_image_id,omitempty" yaml:"allocation_image_id,omitempty"` + + // allocation name + AllocationName string `json:"allocation_name,omitempty" yaml:"allocation_name,omitempty"` + + // allocation project + AllocationProject string `json:"allocation_project,omitempty" yaml:"allocation_project,omitempty"` + + // allocation role + AllocationRole string `json:"allocation_role,omitempty" yaml:"allocation_role,omitempty"` + + // allocation succeeded + AllocationSucceeded bool `json:"allocation_succeeded,omitempty" yaml:"allocation_succeeded,omitempty"` + + // disk names + DiskNames []string `json:"disk_names" yaml:"disk_names"` + + // disk sizes + DiskSizes []int64 `json:"disk_sizes" yaml:"disk_sizes"` + + // fru board mfg + FruBoardMfg string `json:"fru_board_mfg,omitempty" yaml:"fru_board_mfg,omitempty"` + + // fru board mfg serial + FruBoardMfgSerial string `json:"fru_board_mfg_serial,omitempty" yaml:"fru_board_mfg_serial,omitempty"` + + // fru board part number + FruBoardPartNumber string `json:"fru_board_part_number,omitempty" yaml:"fru_board_part_number,omitempty"` + + // fru chassis part number + FruChassisPartNumber string `json:"fru_chassis_part_number,omitempty" yaml:"fru_chassis_part_number,omitempty"` + + // fru chassis part serial + FruChassisPartSerial string `json:"fru_chassis_part_serial,omitempty" yaml:"fru_chassis_part_serial,omitempty"` + + // fru product manufacturer + FruProductManufacturer string `json:"fru_product_manufacturer,omitempty" yaml:"fru_product_manufacturer,omitempty"` + + // fru product part number + FruProductPartNumber string `json:"fru_product_part_number,omitempty" yaml:"fru_product_part_number,omitempty"` + + // fru product serial + FruProductSerial string `json:"fru_product_serial,omitempty" yaml:"fru_product_serial,omitempty"` + + // hardware cpu cores + HardwareCPUCores int64 `json:"hardware_cpu_cores,omitempty" yaml:"hardware_cpu_cores,omitempty"` + + // hardware memory + HardwareMemory int64 `json:"hardware_memory,omitempty" yaml:"hardware_memory,omitempty"` + + // id + ID string `json:"id,omitempty" yaml:"id,omitempty"` + + // ipmi address + IpmiAddress string `json:"ipmi_address,omitempty" yaml:"ipmi_address,omitempty"` + + // ipmi interface + IpmiInterface string `json:"ipmi_interface,omitempty" yaml:"ipmi_interface,omitempty"` + + // ipmi mac address + IpmiMacAddress string `json:"ipmi_mac_address,omitempty" yaml:"ipmi_mac_address,omitempty"` + + // ipmi user + IpmiUser string `json:"ipmi_user,omitempty" yaml:"ipmi_user,omitempty"` + + // defines the last error threshold + // Required: true + LastErrorThreshold *int64 `json:"last_error_threshold" yaml:"last_error_threshold"` + + // name + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + // network asns + NetworkAsns []int64 `json:"network_asns" yaml:"network_asns"` + + // network destination prefixes + NetworkDestinationPrefixes []string `json:"network_destination_prefixes" yaml:"network_destination_prefixes"` + + // network ids + NetworkIds []string `json:"network_ids" yaml:"network_ids"` + + // network ips + NetworkIps []string `json:"network_ips" yaml:"network_ips"` + + // network prefixes + NetworkPrefixes []string `json:"network_prefixes" yaml:"network_prefixes"` + + // network vrfs + NetworkVrfs []int64 `json:"network_vrfs" yaml:"network_vrfs"` + + // nics mac addresses + NicsMacAddresses []string `json:"nics_mac_addresses" yaml:"nics_mac_addresses"` + + // nics names + NicsNames []string `json:"nics_names" yaml:"nics_names"` + + // nics neighbor mac addresses + NicsNeighborMacAddresses []string `json:"nics_neighbor_mac_addresses" yaml:"nics_neighbor_mac_addresses"` + + // nics neighbor names + NicsNeighborNames []string `json:"nics_neighbor_names" yaml:"nics_neighbor_names"` + + // nics neighbor vrfs + NicsNeighborVrfs []string `json:"nics_neighbor_vrfs" yaml:"nics_neighbor_vrfs"` + + // nics vrfs + NicsVrfs []string `json:"nics_vrfs" yaml:"nics_vrfs"` + + // a list of machine issues to omit + // Required: true + Omit []string `json:"omit" yaml:"omit"` + + // a list of machine issues to include + // Required: true + Only []string `json:"only" yaml:"only"` + + // partition id + PartitionID string `json:"partition_id,omitempty" yaml:"partition_id,omitempty"` + + // rackid + Rackid string `json:"rackid,omitempty" yaml:"rackid,omitempty"` + + // filters issue for given severity + // Required: true + Severity *string `json:"severity" yaml:"severity"` + + // sizeid + Sizeid string `json:"sizeid,omitempty" yaml:"sizeid,omitempty"` + + // state value + // Enum: [ LOCKED RESERVED] + StateValue string `json:"state_value,omitempty" yaml:"state_value,omitempty"` + + // tags + Tags []string `json:"tags" yaml:"tags"` +} + +// Validate validates this v1 machine issues request +func (m *V1MachineIssuesRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLastErrorThreshold(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOmit(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOnly(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSeverity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1MachineIssuesRequest) validateLastErrorThreshold(formats strfmt.Registry) error { + + if err := validate.Required("last_error_threshold", "body", m.LastErrorThreshold); err != nil { + return err + } + + return nil +} + +func (m *V1MachineIssuesRequest) validateOmit(formats strfmt.Registry) error { + + if err := validate.Required("omit", "body", m.Omit); err != nil { + return err + } + + return nil +} + +func (m *V1MachineIssuesRequest) validateOnly(formats strfmt.Registry) error { + + if err := validate.Required("only", "body", m.Only); err != nil { + return err + } + + return nil +} + +func (m *V1MachineIssuesRequest) validateSeverity(formats strfmt.Registry) error { + + if err := validate.Required("severity", "body", m.Severity); err != nil { + return err + } + + return nil +} + +var v1MachineIssuesRequestTypeStateValuePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["","LOCKED","RESERVED"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + v1MachineIssuesRequestTypeStateValuePropEnum = append(v1MachineIssuesRequestTypeStateValuePropEnum, v) + } +} + +const ( + + // V1MachineIssuesRequestStateValueEmpty captures enum value "" + V1MachineIssuesRequestStateValueEmpty string = "" + + // V1MachineIssuesRequestStateValueLOCKED captures enum value "LOCKED" + V1MachineIssuesRequestStateValueLOCKED string = "LOCKED" + + // V1MachineIssuesRequestStateValueRESERVED captures enum value "RESERVED" + V1MachineIssuesRequestStateValueRESERVED string = "RESERVED" +) + +// prop value enum +func (m *V1MachineIssuesRequest) validateStateValueEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, v1MachineIssuesRequestTypeStateValuePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *V1MachineIssuesRequest) validateStateValue(formats strfmt.Registry) error { + if swag.IsZero(m.StateValue) { // not required + return nil + } + + // value enum + if err := m.validateStateValueEnum("state_value", "body", m.StateValue); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 machine issues request based on context it is used +func (m *V1MachineIssuesRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1MachineIssuesRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1MachineIssuesRequest) UnmarshalBinary(b []byte) error { + var res V1MachineIssuesRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/metal-api.json b/metal-api.json index 98b5b858..2db10ff1 100644 --- a/metal-api.json +++ b/metal-api.json @@ -2736,6 +2736,267 @@ } } }, + "v1.MachineIssue": { + "properties": { + "description": { + "description": "a description of the issue", + "type": "string" + }, + "details": { + "description": "details of the issue", + "type": "string" + }, + "id": { + "description": "the id of the issue", + "type": "string" + }, + "ref_url": { + "description": "an issue reference to the issue in metal-stack docs", + "type": "string" + }, + "severity": { + "description": "the severity of the issue", + "type": "string" + } + }, + "required": [ + "description", + "details", + "id", + "ref_url", + "severity" + ] + }, + "v1.MachineIssueResponse": { + "properties": { + "issues": { + "description": "the list of issues (only issue ids) of this machine", + "items": { + "type": "string" + }, + "type": "array" + }, + "machineid": { + "description": "the machine id that has the given issues", + "type": "string" + } + }, + "required": [ + "issues", + "machineid" + ] + }, + "v1.MachineIssuesRequest": { + "properties": { + "allocation_hostname": { + "type": "string" + }, + "allocation_image_id": { + "type": "string" + }, + "allocation_name": { + "type": "string" + }, + "allocation_project": { + "type": "string" + }, + "allocation_role": { + "type": "string" + }, + "allocation_succeeded": { + "type": "boolean" + }, + "disk_names": { + "items": { + "type": "string" + }, + "type": "array" + }, + "disk_sizes": { + "items": { + "format": "int64", + "type": "integer" + }, + "type": "array" + }, + "fru_board_mfg": { + "type": "string" + }, + "fru_board_mfg_serial": { + "type": "string" + }, + "fru_board_part_number": { + "type": "string" + }, + "fru_chassis_part_number": { + "type": "string" + }, + "fru_chassis_part_serial": { + "type": "string" + }, + "fru_product_manufacturer": { + "type": "string" + }, + "fru_product_part_number": { + "type": "string" + }, + "fru_product_serial": { + "type": "string" + }, + "hardware_cpu_cores": { + "format": "int64", + "type": "integer" + }, + "hardware_memory": { + "format": "int64", + "type": "integer" + }, + "id": { + "type": "string" + }, + "ipmi_address": { + "type": "string" + }, + "ipmi_interface": { + "type": "string" + }, + "ipmi_mac_address": { + "type": "string" + }, + "ipmi_user": { + "type": "string" + }, + "last_error_threshold": { + "description": "defines the last error threshold", + "format": "int64", + "type": "integer" + }, + "name": { + "type": "string" + }, + "network_asns": { + "items": { + "format": "int64", + "type": "integer" + }, + "type": "array" + }, + "network_destination_prefixes": { + "items": { + "type": "string" + }, + "type": "array" + }, + "network_ids": { + "items": { + "type": "string" + }, + "type": "array" + }, + "network_ips": { + "items": { + "type": "string" + }, + "type": "array" + }, + "network_prefixes": { + "items": { + "type": "string" + }, + "type": "array" + }, + "network_vrfs": { + "items": { + "format": "int64", + "type": "integer" + }, + "type": "array" + }, + "nics_mac_addresses": { + "items": { + "type": "string" + }, + "type": "array" + }, + "nics_names": { + "items": { + "type": "string" + }, + "type": "array" + }, + "nics_neighbor_mac_addresses": { + "items": { + "type": "string" + }, + "type": "array" + }, + "nics_neighbor_names": { + "items": { + "type": "string" + }, + "type": "array" + }, + "nics_neighbor_vrfs": { + "items": { + "type": "string" + }, + "type": "array" + }, + "nics_vrfs": { + "items": { + "type": "string" + }, + "type": "array" + }, + "omit": { + "description": "a list of machine issues to omit", + "items": { + "type": "string" + }, + "type": "array" + }, + "only": { + "description": "a list of machine issues to include", + "items": { + "type": "string" + }, + "type": "array" + }, + "partition_id": { + "type": "string" + }, + "rackid": { + "type": "string" + }, + "severity": { + "description": "filters issue for given severity", + "type": "string" + }, + "sizeid": { + "type": "string" + }, + "state_value": { + "enum": [ + "", + "LOCKED", + "RESERVED" + ], + "type": "string" + }, + "tags": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "last_error_threshold", + "omit", + "only", + "severity" + ] + }, "v1.MachineNetwork": { "description": "prefixes that are reachable within this network", "properties": { @@ -4887,7 +5148,7 @@ "url": "https://www.gnu.org/licenses/agpl-3.0.de.html" }, "title": "metal-api", - "version": "v0.24.1" + "version": "v0.24.2" }, "paths": { "/v1/audit/find": { @@ -6508,6 +6769,80 @@ ] } }, + "/v1/machine/issues": { + "get": { + "consumes": [ + "application/json" + ], + "operationId": "listIssues", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "items": { + "$ref": "#/definitions/v1.MachineIssue" + }, + "type": "array" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "#/definitions/httperrors.HTTPErrorResponse" + } + } + }, + "summary": "returns the list of issues that exist in the API", + "tags": [ + "machine" + ] + } + }, + "/v1/machine/issues/evaluate": { + "post": { + "consumes": [ + "application/json" + ], + "operationId": "issues", + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.MachineIssuesRequest" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "items": { + "$ref": "#/definitions/v1.MachineIssueResponse" + }, + "type": "array" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "#/definitions/httperrors.HTTPErrorResponse" + } + } + }, + "summary": "returns machine issues", + "tags": [ + "machine" + ] + } + }, "/v1/machine/update-firmware/{id}": { "post": { "consumes": [ @@ -7714,37 +8049,6 @@ } }, "/v1/partition/capacity": { - "get": { - "consumes": [ - "application/json" - ], - "deprecated": true, - "operationId": "partitionCapacityCompat", - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "items": { - "$ref": "#/definitions/v1.PartitionCapacity" - }, - "type": "array" - } - }, - "default": { - "description": "Error", - "schema": { - "$ref": "#/definitions/httperrors.HTTPErrorResponse" - } - } - }, - "summary": "get partition capacity", - "tags": [ - "Partition" - ] - }, "post": { "consumes": [ "application/json" diff --git a/test/mocks/machine/ClientService.go b/test/mocks/machine/ClientService.go index 4cbd3e0b..5048414d 100644 --- a/test/mocks/machine/ClientService.go +++ b/test/mocks/machine/ClientService.go @@ -377,6 +377,72 @@ func (_m *ClientService) IpmiReport(params *clientmachine.IpmiReportParams, auth return r0, r1 } +// Issues provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) Issues(params *clientmachine.IssuesParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientmachine.ClientOption) (*clientmachine.IssuesOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *clientmachine.IssuesOK + var r1 error + if rf, ok := ret.Get(0).(func(*clientmachine.IssuesParams, runtime.ClientAuthInfoWriter, ...clientmachine.ClientOption) (*clientmachine.IssuesOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*clientmachine.IssuesParams, runtime.ClientAuthInfoWriter, ...clientmachine.ClientOption) *clientmachine.IssuesOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*clientmachine.IssuesOK) + } + } + + if rf, ok := ret.Get(1).(func(*clientmachine.IssuesParams, runtime.ClientAuthInfoWriter, ...clientmachine.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ListIssues provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ListIssues(params *clientmachine.ListIssuesParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientmachine.ClientOption) (*clientmachine.ListIssuesOK, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, params, authInfo) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *clientmachine.ListIssuesOK + var r1 error + if rf, ok := ret.Get(0).(func(*clientmachine.ListIssuesParams, runtime.ClientAuthInfoWriter, ...clientmachine.ClientOption) (*clientmachine.ListIssuesOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*clientmachine.ListIssuesParams, runtime.ClientAuthInfoWriter, ...clientmachine.ClientOption) *clientmachine.ListIssuesOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*clientmachine.ListIssuesOK) + } + } + + if rf, ok := ret.Get(1).(func(*clientmachine.ListIssuesParams, runtime.ClientAuthInfoWriter, ...clientmachine.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ListMachines provides a mock function with given fields: params, authInfo, opts func (_m *ClientService) ListMachines(params *clientmachine.ListMachinesParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientmachine.ClientOption) (*clientmachine.ListMachinesOK, error) { _va := make([]interface{}, len(opts)) diff --git a/test/mocks/partition/ClientService.go b/test/mocks/partition/ClientService.go index dba5d553..7d1dc08d 100644 --- a/test/mocks/partition/ClientService.go +++ b/test/mocks/partition/ClientService.go @@ -179,39 +179,6 @@ func (_m *ClientService) PartitionCapacity(params *clientpartition.PartitionCapa return r0, r1 } -// PartitionCapacityCompat provides a mock function with given fields: params, authInfo, opts -func (_m *ClientService) PartitionCapacityCompat(params *clientpartition.PartitionCapacityCompatParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientpartition.ClientOption) (*clientpartition.PartitionCapacityCompatOK, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, params, authInfo) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - var r0 *clientpartition.PartitionCapacityCompatOK - var r1 error - if rf, ok := ret.Get(0).(func(*clientpartition.PartitionCapacityCompatParams, runtime.ClientAuthInfoWriter, ...clientpartition.ClientOption) (*clientpartition.PartitionCapacityCompatOK, error)); ok { - return rf(params, authInfo, opts...) - } - if rf, ok := ret.Get(0).(func(*clientpartition.PartitionCapacityCompatParams, runtime.ClientAuthInfoWriter, ...clientpartition.ClientOption) *clientpartition.PartitionCapacityCompatOK); ok { - r0 = rf(params, authInfo, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*clientpartition.PartitionCapacityCompatOK) - } - } - - if rf, ok := ret.Get(1).(func(*clientpartition.PartitionCapacityCompatParams, runtime.ClientAuthInfoWriter, ...clientpartition.ClientOption) error); ok { - r1 = rf(params, authInfo, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - // SetTransport provides a mock function with given fields: transport func (_m *ClientService) SetTransport(transport runtime.ClientTransport) { _m.Called(transport)