From b3b2e9b4afd82e681460f9deec492ee1978849fc Mon Sep 17 00:00:00 2001 From: Gerrit Date: Wed, 2 Oct 2024 14:15:00 +0200 Subject: [PATCH] cloud-api v0.29.0 (#122) --- Makefile | 39 +- api/client/accounting/accounting_client.go | 40 ++ .../machine_reservation_usage_parameters.go | 150 ++++ .../machine_reservation_usage_responses.go | 188 +++++ .../create_machine_reservation_parameters.go | 196 +++++ .../create_machine_reservation_responses.go | 264 +++++++ .../delete_machine_reservation_parameters.go | 151 ++++ .../delete_machine_reservation_responses.go | 188 +++++ .../get_machine_reservation_parameters.go | 151 ++++ .../get_machine_reservation_responses.go | 188 +++++ .../list_machine_reservations_parameters.go | 150 ++++ .../list_machine_reservations_responses.go | 186 +++++ .../machine_reservations_usage_parameters.go | 150 ++++ .../machine_reservations_usage_responses.go | 186 +++++ api/client/project/project_client.go | 240 +++++++ .../update_machine_reservation_parameters.go | 196 +++++ .../update_machine_reservation_responses.go | 188 +++++ api/models/models_v1_size_reservation.go | 111 --- api/models/models_v1_size_response.go | 64 -- api/models/v1_kubernetes.go | 17 + ...hine_reservation_billing_usage_response.go | 215 ++++++ .../v1_machine_reservation_create_request.go | 139 ++++ .../v1_machine_reservation_find_request.go | 122 ++++ api/models/v1_machine_reservation_response.go | 176 +++++ .../v1_machine_reservation_update_request.go | 156 ++++ api/models/v1_machine_reservation_usage.go | 241 +++++++ ..._machine_reservation_usage_accumuluated.go | 88 +++ .../v1_machine_reservation_usage_request.go | 114 +++ .../v1_machine_reservation_usage_response.go | 224 ++++++ cloud-api.json | 675 ++++++++++++++++-- go.mod | 1 + go.sum | 2 + test/client/generate/generate_mock_client.go | 96 +++ test/client/generate/mock_client.tpl | 46 ++ test/client/mock_client.go | 113 +++ test/mocks/accounting/ClientOption.go | 2 +- test/mocks/accounting/ClientService.go | 39 +- test/mocks/audit/ClientOption.go | 2 +- test/mocks/audit/ClientService.go | 2 +- test/mocks/cluster/ClientOption.go | 2 +- test/mocks/cluster/ClientService.go | 2 +- test/mocks/database/ClientOption.go | 2 +- test/mocks/database/ClientService.go | 2 +- test/mocks/health/ClientOption.go | 2 +- test/mocks/health/ClientService.go | 2 +- test/mocks/ip/ClientOption.go | 2 +- test/mocks/ip/ClientService.go | 2 +- test/mocks/masterdata/ClientOption.go | 2 +- test/mocks/masterdata/ClientService.go | 2 +- test/mocks/project/ClientOption.go | 2 +- test/mocks/project/ClientService.go | 224 +++++- test/mocks/s3/ClientOption.go | 2 +- test/mocks/s3/ClientService.go | 2 +- test/mocks/tenant/ClientOption.go | 2 +- test/mocks/tenant/ClientService.go | 2 +- test/mocks/version/ClientOption.go | 2 +- test/mocks/version/ClientService.go | 2 +- test/mocks/volume/ClientOption.go | 2 +- test/mocks/volume/ClientService.go | 2 +- 59 files changed, 5501 insertions(+), 257 deletions(-) create mode 100644 api/client/accounting/machine_reservation_usage_parameters.go create mode 100644 api/client/accounting/machine_reservation_usage_responses.go create mode 100644 api/client/project/create_machine_reservation_parameters.go create mode 100644 api/client/project/create_machine_reservation_responses.go create mode 100644 api/client/project/delete_machine_reservation_parameters.go create mode 100644 api/client/project/delete_machine_reservation_responses.go create mode 100644 api/client/project/get_machine_reservation_parameters.go create mode 100644 api/client/project/get_machine_reservation_responses.go create mode 100644 api/client/project/list_machine_reservations_parameters.go create mode 100644 api/client/project/list_machine_reservations_responses.go create mode 100644 api/client/project/machine_reservations_usage_parameters.go create mode 100644 api/client/project/machine_reservations_usage_responses.go create mode 100644 api/client/project/update_machine_reservation_parameters.go create mode 100644 api/client/project/update_machine_reservation_responses.go delete mode 100644 api/models/models_v1_size_reservation.go create mode 100644 api/models/v1_machine_reservation_billing_usage_response.go create mode 100644 api/models/v1_machine_reservation_create_request.go create mode 100644 api/models/v1_machine_reservation_find_request.go create mode 100644 api/models/v1_machine_reservation_response.go create mode 100644 api/models/v1_machine_reservation_update_request.go create mode 100644 api/models/v1_machine_reservation_usage.go create mode 100644 api/models/v1_machine_reservation_usage_accumuluated.go create mode 100644 api/models/v1_machine_reservation_usage_request.go create mode 100644 api/models/v1_machine_reservation_usage_response.go create mode 100644 test/client/generate/generate_mock_client.go create mode 100644 test/client/generate/mock_client.tpl create mode 100755 test/client/mock_client.go diff --git a/Makefile b/Makefile index 6c01c35..9d6dd02 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,32 @@ -.ONESHELL: -CGO_ENABLED := $(or ${CGO_ENABLED},0) -GO := go -GO111MODULE := on +CLOUD_API_VERSION := $(or ${CLOUD_API_VERSION},$(shell curl -L "https://raw.githubusercontent.com/fi-ts/releases/develop/release.yaml" | yq e '.docker-images.metal-stack.extensions.cloud-api.tag' -)) release:: generate-client mocks gofmt test; -.PHONY: gofmt -gofmt: - GO111MODULE=off $(GO) fmt ./... - -.PHONY: test -test: - CGO_ENABLED=1 $(GO) test ./... -coverprofile=coverage.out -covermode=atomic && go tool cover -func=coverage.out - .PHONY: generate-client generate-client: rm -rf api mkdir -p api + yq e -ij ".info.version=\"${CLOUD_API_VERSION}\"" cloud-api.json + yq e '.info.version' cloud-api.json docker pull metalstack/builder - docker run --user $$(id -u):$$(id -g) --rm -v ${PWD}:/work metalstack/builder swagger generate client -f cloud-api.json -t api --skip-validation + docker run --rm \ + --user $$(id -u):$$(id -g) \ + -v ${PWD}:/work \ + metalstack/builder swagger generate client -f cloud-api.json -t api + +.PHONY: mocks +mocks: + rm -rf test/mocks + docker run --user $$(id -u):$$(id -g) --rm -w /work -v ${PWD}:/work vektra/mockery:v2.46.1 -r --keeptree --inpackage --dir api/client --output test/mocks --all + go run ./test/client/generate/generate_mock_client.go + +.PHONY: gofmt +gofmt: + go fmt ./... + +.PHONY: test +test: + go test ./... -coverprofile=coverage.out -covermode=atomic && go tool cover -func=coverage.out .PHONY: golangcicheck golangcicheck: @@ -27,8 +35,3 @@ golangcicheck: .PHONY: lint lint: golangcicheck CGO_ENABLED=1 golangci-lint run - -.PHONY: mocks -mocks: - rm -rf test/mocks - docker run --user $$(id -u):$$(id -g) --rm -w /work -v ${PWD}:/work vektra/mockery:v2.45.1 -r --keeptree --inpackage --dir api/client --output test/mocks --all diff --git a/api/client/accounting/accounting_client.go b/api/client/accounting/accounting_client.go index 1cc573a..9aa77d6 100644 --- a/api/client/accounting/accounting_client.go +++ b/api/client/accounting/accounting_client.go @@ -90,6 +90,8 @@ type ClientService interface { IPUsageCSV(params *IPUsageCSVParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IPUsageCSVOK, error) + MachineReservationUsage(params *MachineReservationUsageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MachineReservationUsageOK, error) + MachineUsage(params *MachineUsageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MachineUsageOK, error) NetworkUsage(params *NetworkUsageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NetworkUsageOK, error) @@ -343,6 +345,44 @@ func (a *Client) IPUsageCSV(params *IPUsageCSVParams, authInfo runtime.ClientAut return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +MachineReservationUsage finds machine reservation usage for given accounting query +*/ +func (a *Client) MachineReservationUsage(params *MachineReservationUsageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MachineReservationUsageOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMachineReservationUsageParams() + } + op := &runtime.ClientOperation{ + ID: "machineReservationUsage", + Method: "POST", + PathPattern: "/v1/accounting/machine-reservation-usage", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &MachineReservationUsageReader{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.(*MachineReservationUsageOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MachineReservationUsageDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* MachineUsage finds machine usage for given accounting query */ diff --git a/api/client/accounting/machine_reservation_usage_parameters.go b/api/client/accounting/machine_reservation_usage_parameters.go new file mode 100644 index 0000000..240d82c --- /dev/null +++ b/api/client/accounting/machine_reservation_usage_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounting + +// 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/fi-ts/cloud-go/api/models" +) + +// NewMachineReservationUsageParams creates a new MachineReservationUsageParams 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 NewMachineReservationUsageParams() *MachineReservationUsageParams { + return &MachineReservationUsageParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMachineReservationUsageParamsWithTimeout creates a new MachineReservationUsageParams object +// with the ability to set a timeout on a request. +func NewMachineReservationUsageParamsWithTimeout(timeout time.Duration) *MachineReservationUsageParams { + return &MachineReservationUsageParams{ + timeout: timeout, + } +} + +// NewMachineReservationUsageParamsWithContext creates a new MachineReservationUsageParams object +// with the ability to set a context for a request. +func NewMachineReservationUsageParamsWithContext(ctx context.Context) *MachineReservationUsageParams { + return &MachineReservationUsageParams{ + Context: ctx, + } +} + +// NewMachineReservationUsageParamsWithHTTPClient creates a new MachineReservationUsageParams object +// with the ability to set a custom HTTPClient for a request. +func NewMachineReservationUsageParamsWithHTTPClient(client *http.Client) *MachineReservationUsageParams { + return &MachineReservationUsageParams{ + HTTPClient: client, + } +} + +/* +MachineReservationUsageParams contains all the parameters to send to the API endpoint + + for the machine reservation usage operation. + + Typically these are written to a http.Request. +*/ +type MachineReservationUsageParams struct { + + // Body. + Body *models.V1MachineReservationUsageRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the machine reservation usage params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MachineReservationUsageParams) WithDefaults() *MachineReservationUsageParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the machine reservation usage params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MachineReservationUsageParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the machine reservation usage params +func (o *MachineReservationUsageParams) WithTimeout(timeout time.Duration) *MachineReservationUsageParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the machine reservation usage params +func (o *MachineReservationUsageParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the machine reservation usage params +func (o *MachineReservationUsageParams) WithContext(ctx context.Context) *MachineReservationUsageParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the machine reservation usage params +func (o *MachineReservationUsageParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the machine reservation usage params +func (o *MachineReservationUsageParams) WithHTTPClient(client *http.Client) *MachineReservationUsageParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the machine reservation usage params +func (o *MachineReservationUsageParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the machine reservation usage params +func (o *MachineReservationUsageParams) WithBody(body *models.V1MachineReservationUsageRequest) *MachineReservationUsageParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the machine reservation usage params +func (o *MachineReservationUsageParams) SetBody(body *models.V1MachineReservationUsageRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *MachineReservationUsageParams) 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/accounting/machine_reservation_usage_responses.go b/api/client/accounting/machine_reservation_usage_responses.go new file mode 100644 index 0000000..93ef646 --- /dev/null +++ b/api/client/accounting/machine_reservation_usage_responses.go @@ -0,0 +1,188 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package accounting + +// 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/fi-ts/cloud-go/api/models" + "github.com/metal-stack/metal-lib/httperrors" +) + +// MachineReservationUsageReader is a Reader for the MachineReservationUsage structure. +type MachineReservationUsageReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MachineReservationUsageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMachineReservationUsageOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMachineReservationUsageDefault(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 + } +} + +// NewMachineReservationUsageOK creates a MachineReservationUsageOK with default headers values +func NewMachineReservationUsageOK() *MachineReservationUsageOK { + return &MachineReservationUsageOK{} +} + +/* +MachineReservationUsageOK describes a response with status code 200, with default header values. + +OK +*/ +type MachineReservationUsageOK struct { + Payload *models.V1MachineReservationBillingUsageResponse +} + +// IsSuccess returns true when this machine reservation usage o k response has a 2xx status code +func (o *MachineReservationUsageOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this machine reservation usage o k response has a 3xx status code +func (o *MachineReservationUsageOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this machine reservation usage o k response has a 4xx status code +func (o *MachineReservationUsageOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this machine reservation usage o k response has a 5xx status code +func (o *MachineReservationUsageOK) IsServerError() bool { + return false +} + +// IsCode returns true when this machine reservation usage o k response a status code equal to that given +func (o *MachineReservationUsageOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the machine reservation usage o k response +func (o *MachineReservationUsageOK) Code() int { + return 200 +} + +func (o *MachineReservationUsageOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/accounting/machine-reservation-usage][%d] machineReservationUsageOK %s", 200, payload) +} + +func (o *MachineReservationUsageOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/accounting/machine-reservation-usage][%d] machineReservationUsageOK %s", 200, payload) +} + +func (o *MachineReservationUsageOK) GetPayload() *models.V1MachineReservationBillingUsageResponse { + return o.Payload +} + +func (o *MachineReservationUsageOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.V1MachineReservationBillingUsageResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMachineReservationUsageDefault creates a MachineReservationUsageDefault with default headers values +func NewMachineReservationUsageDefault(code int) *MachineReservationUsageDefault { + return &MachineReservationUsageDefault{ + _statusCode: code, + } +} + +/* +MachineReservationUsageDefault describes a response with status code -1, with default header values. + +Error +*/ +type MachineReservationUsageDefault struct { + _statusCode int + + Payload *httperrors.HTTPErrorResponse +} + +// IsSuccess returns true when this machine reservation usage default response has a 2xx status code +func (o *MachineReservationUsageDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this machine reservation usage default response has a 3xx status code +func (o *MachineReservationUsageDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this machine reservation usage default response has a 4xx status code +func (o *MachineReservationUsageDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this machine reservation usage default response has a 5xx status code +func (o *MachineReservationUsageDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this machine reservation usage default response a status code equal to that given +func (o *MachineReservationUsageDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the machine reservation usage default response +func (o *MachineReservationUsageDefault) Code() int { + return o._statusCode +} + +func (o *MachineReservationUsageDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/accounting/machine-reservation-usage][%d] machineReservationUsage default %s", o._statusCode, payload) +} + +func (o *MachineReservationUsageDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/accounting/machine-reservation-usage][%d] machineReservationUsage default %s", o._statusCode, payload) +} + +func (o *MachineReservationUsageDefault) GetPayload() *httperrors.HTTPErrorResponse { + return o.Payload +} + +func (o *MachineReservationUsageDefault) 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/project/create_machine_reservation_parameters.go b/api/client/project/create_machine_reservation_parameters.go new file mode 100644 index 0000000..8ffd73a --- /dev/null +++ b/api/client/project/create_machine_reservation_parameters.go @@ -0,0 +1,196 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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/go-openapi/swag" + + "github.com/fi-ts/cloud-go/api/models" +) + +// NewCreateMachineReservationParams creates a new CreateMachineReservationParams 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 NewCreateMachineReservationParams() *CreateMachineReservationParams { + return &CreateMachineReservationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCreateMachineReservationParamsWithTimeout creates a new CreateMachineReservationParams object +// with the ability to set a timeout on a request. +func NewCreateMachineReservationParamsWithTimeout(timeout time.Duration) *CreateMachineReservationParams { + return &CreateMachineReservationParams{ + timeout: timeout, + } +} + +// NewCreateMachineReservationParamsWithContext creates a new CreateMachineReservationParams object +// with the ability to set a context for a request. +func NewCreateMachineReservationParamsWithContext(ctx context.Context) *CreateMachineReservationParams { + return &CreateMachineReservationParams{ + Context: ctx, + } +} + +// NewCreateMachineReservationParamsWithHTTPClient creates a new CreateMachineReservationParams object +// with the ability to set a custom HTTPClient for a request. +func NewCreateMachineReservationParamsWithHTTPClient(client *http.Client) *CreateMachineReservationParams { + return &CreateMachineReservationParams{ + HTTPClient: client, + } +} + +/* +CreateMachineReservationParams contains all the parameters to send to the API endpoint + + for the create machine reservation operation. + + Typically these are written to a http.Request. +*/ +type CreateMachineReservationParams struct { + + // Body. + Body *models.V1MachineReservationCreateRequest + + /* Force. + + if true, allows overbooking of a partition + */ + Force *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the create machine reservation params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateMachineReservationParams) WithDefaults() *CreateMachineReservationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the create machine reservation params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateMachineReservationParams) SetDefaults() { + var ( + forceDefault = bool(false) + ) + + val := CreateMachineReservationParams{ + Force: &forceDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the create machine reservation params +func (o *CreateMachineReservationParams) WithTimeout(timeout time.Duration) *CreateMachineReservationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create machine reservation params +func (o *CreateMachineReservationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create machine reservation params +func (o *CreateMachineReservationParams) WithContext(ctx context.Context) *CreateMachineReservationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create machine reservation params +func (o *CreateMachineReservationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create machine reservation params +func (o *CreateMachineReservationParams) WithHTTPClient(client *http.Client) *CreateMachineReservationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create machine reservation params +func (o *CreateMachineReservationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the create machine reservation params +func (o *CreateMachineReservationParams) WithBody(body *models.V1MachineReservationCreateRequest) *CreateMachineReservationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the create machine reservation params +func (o *CreateMachineReservationParams) SetBody(body *models.V1MachineReservationCreateRequest) { + o.Body = body +} + +// WithForce adds the force to the create machine reservation params +func (o *CreateMachineReservationParams) WithForce(force *bool) *CreateMachineReservationParams { + o.SetForce(force) + return o +} + +// SetForce adds the force to the create machine reservation params +func (o *CreateMachineReservationParams) SetForce(force *bool) { + o.Force = force +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateMachineReservationParams) 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 o.Force != nil { + + // query param force + var qrForce bool + + if o.Force != nil { + qrForce = *o.Force + } + qForce := swag.FormatBool(qrForce) + if qForce != "" { + + if err := r.SetQueryParam("force", qForce); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/api/client/project/create_machine_reservation_responses.go b/api/client/project/create_machine_reservation_responses.go new file mode 100644 index 0000000..201fd13 --- /dev/null +++ b/api/client/project/create_machine_reservation_responses.go @@ -0,0 +1,264 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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/fi-ts/cloud-go/api/models" + "github.com/metal-stack/metal-lib/httperrors" +) + +// CreateMachineReservationReader is a Reader for the CreateMachineReservation structure. +type CreateMachineReservationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateMachineReservationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 201: + result := NewCreateMachineReservationCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 409: + result := NewCreateMachineReservationConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + result := NewCreateMachineReservationDefault(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 + } +} + +// NewCreateMachineReservationCreated creates a CreateMachineReservationCreated with default headers values +func NewCreateMachineReservationCreated() *CreateMachineReservationCreated { + return &CreateMachineReservationCreated{} +} + +/* +CreateMachineReservationCreated describes a response with status code 201, with default header values. + +Created +*/ +type CreateMachineReservationCreated struct { + Payload *models.V1MachineReservationResponse +} + +// IsSuccess returns true when this create machine reservation created response has a 2xx status code +func (o *CreateMachineReservationCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this create machine reservation created response has a 3xx status code +func (o *CreateMachineReservationCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create machine reservation created response has a 4xx status code +func (o *CreateMachineReservationCreated) IsClientError() bool { + return false +} + +// IsServerError returns true when this create machine reservation created response has a 5xx status code +func (o *CreateMachineReservationCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this create machine reservation created response a status code equal to that given +func (o *CreateMachineReservationCreated) IsCode(code int) bool { + return code == 201 +} + +// Code gets the status code for the create machine reservation created response +func (o *CreateMachineReservationCreated) Code() int { + return 201 +} + +func (o *CreateMachineReservationCreated) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/project/reservation/machine][%d] createMachineReservationCreated %s", 201, payload) +} + +func (o *CreateMachineReservationCreated) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/project/reservation/machine][%d] createMachineReservationCreated %s", 201, payload) +} + +func (o *CreateMachineReservationCreated) GetPayload() *models.V1MachineReservationResponse { + return o.Payload +} + +func (o *CreateMachineReservationCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.V1MachineReservationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCreateMachineReservationConflict creates a CreateMachineReservationConflict with default headers values +func NewCreateMachineReservationConflict() *CreateMachineReservationConflict { + return &CreateMachineReservationConflict{} +} + +/* +CreateMachineReservationConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type CreateMachineReservationConflict struct { + Payload *httperrors.HTTPErrorResponse +} + +// IsSuccess returns true when this create machine reservation conflict response has a 2xx status code +func (o *CreateMachineReservationConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this create machine reservation conflict response has a 3xx status code +func (o *CreateMachineReservationConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create machine reservation conflict response has a 4xx status code +func (o *CreateMachineReservationConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this create machine reservation conflict response has a 5xx status code +func (o *CreateMachineReservationConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this create machine reservation conflict response a status code equal to that given +func (o *CreateMachineReservationConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the create machine reservation conflict response +func (o *CreateMachineReservationConflict) Code() int { + return 409 +} + +func (o *CreateMachineReservationConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/project/reservation/machine][%d] createMachineReservationConflict %s", 409, payload) +} + +func (o *CreateMachineReservationConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/project/reservation/machine][%d] createMachineReservationConflict %s", 409, payload) +} + +func (o *CreateMachineReservationConflict) GetPayload() *httperrors.HTTPErrorResponse { + return o.Payload +} + +func (o *CreateMachineReservationConflict) 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 +} + +// NewCreateMachineReservationDefault creates a CreateMachineReservationDefault with default headers values +func NewCreateMachineReservationDefault(code int) *CreateMachineReservationDefault { + return &CreateMachineReservationDefault{ + _statusCode: code, + } +} + +/* +CreateMachineReservationDefault describes a response with status code -1, with default header values. + +Error +*/ +type CreateMachineReservationDefault struct { + _statusCode int + + Payload *httperrors.HTTPErrorResponse +} + +// IsSuccess returns true when this create machine reservation default response has a 2xx status code +func (o *CreateMachineReservationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this create machine reservation default response has a 3xx status code +func (o *CreateMachineReservationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this create machine reservation default response has a 4xx status code +func (o *CreateMachineReservationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this create machine reservation default response has a 5xx status code +func (o *CreateMachineReservationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this create machine reservation default response a status code equal to that given +func (o *CreateMachineReservationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the create machine reservation default response +func (o *CreateMachineReservationDefault) Code() int { + return o._statusCode +} + +func (o *CreateMachineReservationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/project/reservation/machine][%d] createMachineReservation default %s", o._statusCode, payload) +} + +func (o *CreateMachineReservationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/project/reservation/machine][%d] createMachineReservation default %s", o._statusCode, payload) +} + +func (o *CreateMachineReservationDefault) GetPayload() *httperrors.HTTPErrorResponse { + return o.Payload +} + +func (o *CreateMachineReservationDefault) 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/project/delete_machine_reservation_parameters.go b/api/client/project/delete_machine_reservation_parameters.go new file mode 100644 index 0000000..cd7b406 --- /dev/null +++ b/api/client/project/delete_machine_reservation_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" +) + +// NewDeleteMachineReservationParams creates a new DeleteMachineReservationParams 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 NewDeleteMachineReservationParams() *DeleteMachineReservationParams { + return &DeleteMachineReservationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteMachineReservationParamsWithTimeout creates a new DeleteMachineReservationParams object +// with the ability to set a timeout on a request. +func NewDeleteMachineReservationParamsWithTimeout(timeout time.Duration) *DeleteMachineReservationParams { + return &DeleteMachineReservationParams{ + timeout: timeout, + } +} + +// NewDeleteMachineReservationParamsWithContext creates a new DeleteMachineReservationParams object +// with the ability to set a context for a request. +func NewDeleteMachineReservationParamsWithContext(ctx context.Context) *DeleteMachineReservationParams { + return &DeleteMachineReservationParams{ + Context: ctx, + } +} + +// NewDeleteMachineReservationParamsWithHTTPClient creates a new DeleteMachineReservationParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteMachineReservationParamsWithHTTPClient(client *http.Client) *DeleteMachineReservationParams { + return &DeleteMachineReservationParams{ + HTTPClient: client, + } +} + +/* +DeleteMachineReservationParams contains all the parameters to send to the API endpoint + + for the delete machine reservation operation. + + Typically these are written to a http.Request. +*/ +type DeleteMachineReservationParams struct { + + /* ID. + + identifier of the machine reservation + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete machine reservation params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteMachineReservationParams) WithDefaults() *DeleteMachineReservationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete machine reservation params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteMachineReservationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete machine reservation params +func (o *DeleteMachineReservationParams) WithTimeout(timeout time.Duration) *DeleteMachineReservationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete machine reservation params +func (o *DeleteMachineReservationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete machine reservation params +func (o *DeleteMachineReservationParams) WithContext(ctx context.Context) *DeleteMachineReservationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete machine reservation params +func (o *DeleteMachineReservationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete machine reservation params +func (o *DeleteMachineReservationParams) WithHTTPClient(client *http.Client) *DeleteMachineReservationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete machine reservation params +func (o *DeleteMachineReservationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete machine reservation params +func (o *DeleteMachineReservationParams) WithID(id string) *DeleteMachineReservationParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete machine reservation params +func (o *DeleteMachineReservationParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteMachineReservationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/api/client/project/delete_machine_reservation_responses.go b/api/client/project/delete_machine_reservation_responses.go new file mode 100644 index 0000000..4561a94 --- /dev/null +++ b/api/client/project/delete_machine_reservation_responses.go @@ -0,0 +1,188 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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/fi-ts/cloud-go/api/models" + "github.com/metal-stack/metal-lib/httperrors" +) + +// DeleteMachineReservationReader is a Reader for the DeleteMachineReservation structure. +type DeleteMachineReservationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteMachineReservationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteMachineReservationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeleteMachineReservationDefault(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 + } +} + +// NewDeleteMachineReservationOK creates a DeleteMachineReservationOK with default headers values +func NewDeleteMachineReservationOK() *DeleteMachineReservationOK { + return &DeleteMachineReservationOK{} +} + +/* +DeleteMachineReservationOK describes a response with status code 200, with default header values. + +OK +*/ +type DeleteMachineReservationOK struct { + Payload *models.V1MachineReservationResponse +} + +// IsSuccess returns true when this delete machine reservation o k response has a 2xx status code +func (o *DeleteMachineReservationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete machine reservation o k response has a 3xx status code +func (o *DeleteMachineReservationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete machine reservation o k response has a 4xx status code +func (o *DeleteMachineReservationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete machine reservation o k response has a 5xx status code +func (o *DeleteMachineReservationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete machine reservation o k response a status code equal to that given +func (o *DeleteMachineReservationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the delete machine reservation o k response +func (o *DeleteMachineReservationOK) Code() int { + return 200 +} + +func (o *DeleteMachineReservationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/project/reservation/machine/{id}][%d] deleteMachineReservationOK %s", 200, payload) +} + +func (o *DeleteMachineReservationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/project/reservation/machine/{id}][%d] deleteMachineReservationOK %s", 200, payload) +} + +func (o *DeleteMachineReservationOK) GetPayload() *models.V1MachineReservationResponse { + return o.Payload +} + +func (o *DeleteMachineReservationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.V1MachineReservationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeleteMachineReservationDefault creates a DeleteMachineReservationDefault with default headers values +func NewDeleteMachineReservationDefault(code int) *DeleteMachineReservationDefault { + return &DeleteMachineReservationDefault{ + _statusCode: code, + } +} + +/* +DeleteMachineReservationDefault describes a response with status code -1, with default header values. + +Error +*/ +type DeleteMachineReservationDefault struct { + _statusCode int + + Payload *httperrors.HTTPErrorResponse +} + +// IsSuccess returns true when this delete machine reservation default response has a 2xx status code +func (o *DeleteMachineReservationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this delete machine reservation default response has a 3xx status code +func (o *DeleteMachineReservationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this delete machine reservation default response has a 4xx status code +func (o *DeleteMachineReservationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this delete machine reservation default response has a 5xx status code +func (o *DeleteMachineReservationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this delete machine reservation default response a status code equal to that given +func (o *DeleteMachineReservationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the delete machine reservation default response +func (o *DeleteMachineReservationDefault) Code() int { + return o._statusCode +} + +func (o *DeleteMachineReservationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/project/reservation/machine/{id}][%d] deleteMachineReservation default %s", o._statusCode, payload) +} + +func (o *DeleteMachineReservationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/project/reservation/machine/{id}][%d] deleteMachineReservation default %s", o._statusCode, payload) +} + +func (o *DeleteMachineReservationDefault) GetPayload() *httperrors.HTTPErrorResponse { + return o.Payload +} + +func (o *DeleteMachineReservationDefault) 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/project/get_machine_reservation_parameters.go b/api/client/project/get_machine_reservation_parameters.go new file mode 100644 index 0000000..5f470ac --- /dev/null +++ b/api/client/project/get_machine_reservation_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" +) + +// NewGetMachineReservationParams creates a new GetMachineReservationParams 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 NewGetMachineReservationParams() *GetMachineReservationParams { + return &GetMachineReservationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetMachineReservationParamsWithTimeout creates a new GetMachineReservationParams object +// with the ability to set a timeout on a request. +func NewGetMachineReservationParamsWithTimeout(timeout time.Duration) *GetMachineReservationParams { + return &GetMachineReservationParams{ + timeout: timeout, + } +} + +// NewGetMachineReservationParamsWithContext creates a new GetMachineReservationParams object +// with the ability to set a context for a request. +func NewGetMachineReservationParamsWithContext(ctx context.Context) *GetMachineReservationParams { + return &GetMachineReservationParams{ + Context: ctx, + } +} + +// NewGetMachineReservationParamsWithHTTPClient creates a new GetMachineReservationParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetMachineReservationParamsWithHTTPClient(client *http.Client) *GetMachineReservationParams { + return &GetMachineReservationParams{ + HTTPClient: client, + } +} + +/* +GetMachineReservationParams contains all the parameters to send to the API endpoint + + for the get machine reservation operation. + + Typically these are written to a http.Request. +*/ +type GetMachineReservationParams struct { + + /* ID. + + identifier of the machine reservation + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get machine reservation params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMachineReservationParams) WithDefaults() *GetMachineReservationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get machine reservation params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMachineReservationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get machine reservation params +func (o *GetMachineReservationParams) WithTimeout(timeout time.Duration) *GetMachineReservationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get machine reservation params +func (o *GetMachineReservationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get machine reservation params +func (o *GetMachineReservationParams) WithContext(ctx context.Context) *GetMachineReservationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get machine reservation params +func (o *GetMachineReservationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get machine reservation params +func (o *GetMachineReservationParams) WithHTTPClient(client *http.Client) *GetMachineReservationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get machine reservation params +func (o *GetMachineReservationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get machine reservation params +func (o *GetMachineReservationParams) WithID(id string) *GetMachineReservationParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get machine reservation params +func (o *GetMachineReservationParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetMachineReservationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/api/client/project/get_machine_reservation_responses.go b/api/client/project/get_machine_reservation_responses.go new file mode 100644 index 0000000..595d758 --- /dev/null +++ b/api/client/project/get_machine_reservation_responses.go @@ -0,0 +1,188 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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/fi-ts/cloud-go/api/models" + "github.com/metal-stack/metal-lib/httperrors" +) + +// GetMachineReservationReader is a Reader for the GetMachineReservation structure. +type GetMachineReservationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetMachineReservationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetMachineReservationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetMachineReservationDefault(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 + } +} + +// NewGetMachineReservationOK creates a GetMachineReservationOK with default headers values +func NewGetMachineReservationOK() *GetMachineReservationOK { + return &GetMachineReservationOK{} +} + +/* +GetMachineReservationOK describes a response with status code 200, with default header values. + +OK +*/ +type GetMachineReservationOK struct { + Payload *models.V1MachineReservationResponse +} + +// IsSuccess returns true when this get machine reservation o k response has a 2xx status code +func (o *GetMachineReservationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get machine reservation o k response has a 3xx status code +func (o *GetMachineReservationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get machine reservation o k response has a 4xx status code +func (o *GetMachineReservationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get machine reservation o k response has a 5xx status code +func (o *GetMachineReservationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get machine reservation o k response a status code equal to that given +func (o *GetMachineReservationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get machine reservation o k response +func (o *GetMachineReservationOK) Code() int { + return 200 +} + +func (o *GetMachineReservationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/project/reservation/machine/{id}][%d] getMachineReservationOK %s", 200, payload) +} + +func (o *GetMachineReservationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/project/reservation/machine/{id}][%d] getMachineReservationOK %s", 200, payload) +} + +func (o *GetMachineReservationOK) GetPayload() *models.V1MachineReservationResponse { + return o.Payload +} + +func (o *GetMachineReservationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.V1MachineReservationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetMachineReservationDefault creates a GetMachineReservationDefault with default headers values +func NewGetMachineReservationDefault(code int) *GetMachineReservationDefault { + return &GetMachineReservationDefault{ + _statusCode: code, + } +} + +/* +GetMachineReservationDefault describes a response with status code -1, with default header values. + +Error +*/ +type GetMachineReservationDefault struct { + _statusCode int + + Payload *httperrors.HTTPErrorResponse +} + +// IsSuccess returns true when this get machine reservation default response has a 2xx status code +func (o *GetMachineReservationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get machine reservation default response has a 3xx status code +func (o *GetMachineReservationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get machine reservation default response has a 4xx status code +func (o *GetMachineReservationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get machine reservation default response has a 5xx status code +func (o *GetMachineReservationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get machine reservation default response a status code equal to that given +func (o *GetMachineReservationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get machine reservation default response +func (o *GetMachineReservationDefault) Code() int { + return o._statusCode +} + +func (o *GetMachineReservationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/project/reservation/machine/{id}][%d] getMachineReservation default %s", o._statusCode, payload) +} + +func (o *GetMachineReservationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/project/reservation/machine/{id}][%d] getMachineReservation default %s", o._statusCode, payload) +} + +func (o *GetMachineReservationDefault) GetPayload() *httperrors.HTTPErrorResponse { + return o.Payload +} + +func (o *GetMachineReservationDefault) 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/project/list_machine_reservations_parameters.go b/api/client/project/list_machine_reservations_parameters.go new file mode 100644 index 0000000..52c2ddb --- /dev/null +++ b/api/client/project/list_machine_reservations_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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/fi-ts/cloud-go/api/models" +) + +// NewListMachineReservationsParams creates a new ListMachineReservationsParams 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 NewListMachineReservationsParams() *ListMachineReservationsParams { + return &ListMachineReservationsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListMachineReservationsParamsWithTimeout creates a new ListMachineReservationsParams object +// with the ability to set a timeout on a request. +func NewListMachineReservationsParamsWithTimeout(timeout time.Duration) *ListMachineReservationsParams { + return &ListMachineReservationsParams{ + timeout: timeout, + } +} + +// NewListMachineReservationsParamsWithContext creates a new ListMachineReservationsParams object +// with the ability to set a context for a request. +func NewListMachineReservationsParamsWithContext(ctx context.Context) *ListMachineReservationsParams { + return &ListMachineReservationsParams{ + Context: ctx, + } +} + +// NewListMachineReservationsParamsWithHTTPClient creates a new ListMachineReservationsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListMachineReservationsParamsWithHTTPClient(client *http.Client) *ListMachineReservationsParams { + return &ListMachineReservationsParams{ + HTTPClient: client, + } +} + +/* +ListMachineReservationsParams contains all the parameters to send to the API endpoint + + for the list machine reservations operation. + + Typically these are written to a http.Request. +*/ +type ListMachineReservationsParams struct { + + // Body. + Body *models.V1MachineReservationFindRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list machine reservations params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListMachineReservationsParams) WithDefaults() *ListMachineReservationsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list machine reservations params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListMachineReservationsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list machine reservations params +func (o *ListMachineReservationsParams) WithTimeout(timeout time.Duration) *ListMachineReservationsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list machine reservations params +func (o *ListMachineReservationsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list machine reservations params +func (o *ListMachineReservationsParams) WithContext(ctx context.Context) *ListMachineReservationsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list machine reservations params +func (o *ListMachineReservationsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list machine reservations params +func (o *ListMachineReservationsParams) WithHTTPClient(client *http.Client) *ListMachineReservationsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list machine reservations params +func (o *ListMachineReservationsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the list machine reservations params +func (o *ListMachineReservationsParams) WithBody(body *models.V1MachineReservationFindRequest) *ListMachineReservationsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the list machine reservations params +func (o *ListMachineReservationsParams) SetBody(body *models.V1MachineReservationFindRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *ListMachineReservationsParams) 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/project/list_machine_reservations_responses.go b/api/client/project/list_machine_reservations_responses.go new file mode 100644 index 0000000..96cb0d7 --- /dev/null +++ b/api/client/project/list_machine_reservations_responses.go @@ -0,0 +1,186 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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/fi-ts/cloud-go/api/models" + "github.com/metal-stack/metal-lib/httperrors" +) + +// ListMachineReservationsReader is a Reader for the ListMachineReservations structure. +type ListMachineReservationsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListMachineReservationsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListMachineReservationsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListMachineReservationsDefault(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 + } +} + +// NewListMachineReservationsOK creates a ListMachineReservationsOK with default headers values +func NewListMachineReservationsOK() *ListMachineReservationsOK { + return &ListMachineReservationsOK{} +} + +/* +ListMachineReservationsOK describes a response with status code 200, with default header values. + +OK +*/ +type ListMachineReservationsOK struct { + Payload []*models.V1MachineReservationResponse +} + +// IsSuccess returns true when this list machine reservations o k response has a 2xx status code +func (o *ListMachineReservationsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list machine reservations o k response has a 3xx status code +func (o *ListMachineReservationsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list machine reservations o k response has a 4xx status code +func (o *ListMachineReservationsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list machine reservations o k response has a 5xx status code +func (o *ListMachineReservationsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list machine reservations o k response a status code equal to that given +func (o *ListMachineReservationsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list machine reservations o k response +func (o *ListMachineReservationsOK) Code() int { + return 200 +} + +func (o *ListMachineReservationsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/project/reservation/machine/find][%d] listMachineReservationsOK %s", 200, payload) +} + +func (o *ListMachineReservationsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/project/reservation/machine/find][%d] listMachineReservationsOK %s", 200, payload) +} + +func (o *ListMachineReservationsOK) GetPayload() []*models.V1MachineReservationResponse { + return o.Payload +} + +func (o *ListMachineReservationsOK) 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 +} + +// NewListMachineReservationsDefault creates a ListMachineReservationsDefault with default headers values +func NewListMachineReservationsDefault(code int) *ListMachineReservationsDefault { + return &ListMachineReservationsDefault{ + _statusCode: code, + } +} + +/* +ListMachineReservationsDefault describes a response with status code -1, with default header values. + +Error +*/ +type ListMachineReservationsDefault struct { + _statusCode int + + Payload *httperrors.HTTPErrorResponse +} + +// IsSuccess returns true when this list machine reservations default response has a 2xx status code +func (o *ListMachineReservationsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list machine reservations default response has a 3xx status code +func (o *ListMachineReservationsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list machine reservations default response has a 4xx status code +func (o *ListMachineReservationsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list machine reservations default response has a 5xx status code +func (o *ListMachineReservationsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list machine reservations default response a status code equal to that given +func (o *ListMachineReservationsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list machine reservations default response +func (o *ListMachineReservationsDefault) Code() int { + return o._statusCode +} + +func (o *ListMachineReservationsDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/project/reservation/machine/find][%d] listMachineReservations default %s", o._statusCode, payload) +} + +func (o *ListMachineReservationsDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/project/reservation/machine/find][%d] listMachineReservations default %s", o._statusCode, payload) +} + +func (o *ListMachineReservationsDefault) GetPayload() *httperrors.HTTPErrorResponse { + return o.Payload +} + +func (o *ListMachineReservationsDefault) 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/project/machine_reservations_usage_parameters.go b/api/client/project/machine_reservations_usage_parameters.go new file mode 100644 index 0000000..f8d40f7 --- /dev/null +++ b/api/client/project/machine_reservations_usage_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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/fi-ts/cloud-go/api/models" +) + +// NewMachineReservationsUsageParams creates a new MachineReservationsUsageParams 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 NewMachineReservationsUsageParams() *MachineReservationsUsageParams { + return &MachineReservationsUsageParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMachineReservationsUsageParamsWithTimeout creates a new MachineReservationsUsageParams object +// with the ability to set a timeout on a request. +func NewMachineReservationsUsageParamsWithTimeout(timeout time.Duration) *MachineReservationsUsageParams { + return &MachineReservationsUsageParams{ + timeout: timeout, + } +} + +// NewMachineReservationsUsageParamsWithContext creates a new MachineReservationsUsageParams object +// with the ability to set a context for a request. +func NewMachineReservationsUsageParamsWithContext(ctx context.Context) *MachineReservationsUsageParams { + return &MachineReservationsUsageParams{ + Context: ctx, + } +} + +// NewMachineReservationsUsageParamsWithHTTPClient creates a new MachineReservationsUsageParams object +// with the ability to set a custom HTTPClient for a request. +func NewMachineReservationsUsageParamsWithHTTPClient(client *http.Client) *MachineReservationsUsageParams { + return &MachineReservationsUsageParams{ + HTTPClient: client, + } +} + +/* +MachineReservationsUsageParams contains all the parameters to send to the API endpoint + + for the machine reservations usage operation. + + Typically these are written to a http.Request. +*/ +type MachineReservationsUsageParams struct { + + // Body. + Body *models.V1MachineReservationFindRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the machine reservations usage params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MachineReservationsUsageParams) WithDefaults() *MachineReservationsUsageParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the machine reservations usage params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MachineReservationsUsageParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the machine reservations usage params +func (o *MachineReservationsUsageParams) WithTimeout(timeout time.Duration) *MachineReservationsUsageParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the machine reservations usage params +func (o *MachineReservationsUsageParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the machine reservations usage params +func (o *MachineReservationsUsageParams) WithContext(ctx context.Context) *MachineReservationsUsageParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the machine reservations usage params +func (o *MachineReservationsUsageParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the machine reservations usage params +func (o *MachineReservationsUsageParams) WithHTTPClient(client *http.Client) *MachineReservationsUsageParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the machine reservations usage params +func (o *MachineReservationsUsageParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the machine reservations usage params +func (o *MachineReservationsUsageParams) WithBody(body *models.V1MachineReservationFindRequest) *MachineReservationsUsageParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the machine reservations usage params +func (o *MachineReservationsUsageParams) SetBody(body *models.V1MachineReservationFindRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *MachineReservationsUsageParams) 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/project/machine_reservations_usage_responses.go b/api/client/project/machine_reservations_usage_responses.go new file mode 100644 index 0000000..bc371dc --- /dev/null +++ b/api/client/project/machine_reservations_usage_responses.go @@ -0,0 +1,186 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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/fi-ts/cloud-go/api/models" + "github.com/metal-stack/metal-lib/httperrors" +) + +// MachineReservationsUsageReader is a Reader for the MachineReservationsUsage structure. +type MachineReservationsUsageReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MachineReservationsUsageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMachineReservationsUsageOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMachineReservationsUsageDefault(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 + } +} + +// NewMachineReservationsUsageOK creates a MachineReservationsUsageOK with default headers values +func NewMachineReservationsUsageOK() *MachineReservationsUsageOK { + return &MachineReservationsUsageOK{} +} + +/* +MachineReservationsUsageOK describes a response with status code 200, with default header values. + +OK +*/ +type MachineReservationsUsageOK struct { + Payload []*models.V1MachineReservationUsageResponse +} + +// IsSuccess returns true when this machine reservations usage o k response has a 2xx status code +func (o *MachineReservationsUsageOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this machine reservations usage o k response has a 3xx status code +func (o *MachineReservationsUsageOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this machine reservations usage o k response has a 4xx status code +func (o *MachineReservationsUsageOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this machine reservations usage o k response has a 5xx status code +func (o *MachineReservationsUsageOK) IsServerError() bool { + return false +} + +// IsCode returns true when this machine reservations usage o k response a status code equal to that given +func (o *MachineReservationsUsageOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the machine reservations usage o k response +func (o *MachineReservationsUsageOK) Code() int { + return 200 +} + +func (o *MachineReservationsUsageOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/project/reservation/machine/usage][%d] machineReservationsUsageOK %s", 200, payload) +} + +func (o *MachineReservationsUsageOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/project/reservation/machine/usage][%d] machineReservationsUsageOK %s", 200, payload) +} + +func (o *MachineReservationsUsageOK) GetPayload() []*models.V1MachineReservationUsageResponse { + return o.Payload +} + +func (o *MachineReservationsUsageOK) 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 +} + +// NewMachineReservationsUsageDefault creates a MachineReservationsUsageDefault with default headers values +func NewMachineReservationsUsageDefault(code int) *MachineReservationsUsageDefault { + return &MachineReservationsUsageDefault{ + _statusCode: code, + } +} + +/* +MachineReservationsUsageDefault describes a response with status code -1, with default header values. + +Error +*/ +type MachineReservationsUsageDefault struct { + _statusCode int + + Payload *httperrors.HTTPErrorResponse +} + +// IsSuccess returns true when this machine reservations usage default response has a 2xx status code +func (o *MachineReservationsUsageDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this machine reservations usage default response has a 3xx status code +func (o *MachineReservationsUsageDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this machine reservations usage default response has a 4xx status code +func (o *MachineReservationsUsageDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this machine reservations usage default response has a 5xx status code +func (o *MachineReservationsUsageDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this machine reservations usage default response a status code equal to that given +func (o *MachineReservationsUsageDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the machine reservations usage default response +func (o *MachineReservationsUsageDefault) Code() int { + return o._statusCode +} + +func (o *MachineReservationsUsageDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/project/reservation/machine/usage][%d] machineReservationsUsage default %s", o._statusCode, payload) +} + +func (o *MachineReservationsUsageDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/project/reservation/machine/usage][%d] machineReservationsUsage default %s", o._statusCode, payload) +} + +func (o *MachineReservationsUsageDefault) GetPayload() *httperrors.HTTPErrorResponse { + return o.Payload +} + +func (o *MachineReservationsUsageDefault) 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/project/project_client.go b/api/client/project/project_client.go index f16cdbc..e97d69d 100644 --- a/api/client/project/project_client.go +++ b/api/client/project/project_client.go @@ -54,21 +54,71 @@ type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods type ClientService interface { + CreateMachineReservation(params *CreateMachineReservationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateMachineReservationCreated, error) + CreateProject(params *CreateProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateProjectCreated, error) + DeleteMachineReservation(params *DeleteMachineReservationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteMachineReservationOK, error) + DeleteProject(params *DeleteProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteProjectOK, error) FindProject(params *FindProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FindProjectOK, error) FindProjects(params *FindProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FindProjectsOK, error) + GetMachineReservation(params *GetMachineReservationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetMachineReservationOK, error) + + ListMachineReservations(params *ListMachineReservationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListMachineReservationsOK, error) + ListProjects(params *ListProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListProjectsOK, error) + MachineReservationsUsage(params *MachineReservationsUsageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MachineReservationsUsageOK, error) + + UpdateMachineReservation(params *UpdateMachineReservationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateMachineReservationOK, error) + UpdateProject(params *UpdateProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateProjectOK, error) SetTransport(transport runtime.ClientTransport) } +/* +CreateMachineReservation creates a machine reservation +*/ +func (a *Client) CreateMachineReservation(params *CreateMachineReservationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateMachineReservationCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateMachineReservationParams() + } + op := &runtime.ClientOperation{ + ID: "createMachineReservation", + Method: "PUT", + PathPattern: "/v1/project/reservation/machine", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &CreateMachineReservationReader{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.(*CreateMachineReservationCreated) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*CreateMachineReservationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* CreateProject creates a project if the given ID already exists a conflict is returned */ @@ -107,6 +157,44 @@ func (a *Client) CreateProject(params *CreateProjectParams, authInfo runtime.Cli return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +DeleteMachineReservation deletes a machine reservation +*/ +func (a *Client) DeleteMachineReservation(params *DeleteMachineReservationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteMachineReservationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteMachineReservationParams() + } + op := &runtime.ClientOperation{ + ID: "deleteMachineReservation", + Method: "DELETE", + PathPattern: "/v1/project/reservation/machine/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteMachineReservationReader{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.(*DeleteMachineReservationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeleteMachineReservationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* DeleteProject deletes a project and returns the deleted entity */ @@ -221,6 +309,82 @@ func (a *Client) FindProjects(params *FindProjectsParams, authInfo runtime.Clien return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +GetMachineReservation gets a machine reservation +*/ +func (a *Client) GetMachineReservation(params *GetMachineReservationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetMachineReservationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetMachineReservationParams() + } + op := &runtime.ClientOperation{ + ID: "getMachineReservation", + Method: "GET", + PathPattern: "/v1/project/reservation/machine/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetMachineReservationReader{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.(*GetMachineReservationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetMachineReservationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListMachineReservations gets all machine reservations +*/ +func (a *Client) ListMachineReservations(params *ListMachineReservationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListMachineReservationsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListMachineReservationsParams() + } + op := &runtime.ClientOperation{ + ID: "listMachineReservations", + Method: "POST", + PathPattern: "/v1/project/reservation/machine/find", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListMachineReservationsReader{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.(*ListMachineReservationsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListMachineReservationsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* ListProjects gets all projects */ @@ -259,6 +423,82 @@ func (a *Client) ListProjects(params *ListProjectsParams, authInfo runtime.Clien return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +MachineReservationsUsage gets usage of machine reservations +*/ +func (a *Client) MachineReservationsUsage(params *MachineReservationsUsageParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MachineReservationsUsageOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMachineReservationsUsageParams() + } + op := &runtime.ClientOperation{ + ID: "machineReservationsUsage", + Method: "POST", + PathPattern: "/v1/project/reservation/machine/usage", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &MachineReservationsUsageReader{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.(*MachineReservationsUsageOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MachineReservationsUsageDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +UpdateMachineReservation updates a machine reservation +*/ +func (a *Client) UpdateMachineReservation(params *UpdateMachineReservationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateMachineReservationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateMachineReservationParams() + } + op := &runtime.ClientOperation{ + ID: "updateMachineReservation", + Method: "POST", + PathPattern: "/v1/project/reservation/machine", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &UpdateMachineReservationReader{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.(*UpdateMachineReservationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UpdateMachineReservationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* UpdateProject updates a project optimistic lock error can occur */ diff --git a/api/client/project/update_machine_reservation_parameters.go b/api/client/project/update_machine_reservation_parameters.go new file mode 100644 index 0000000..cf6498e --- /dev/null +++ b/api/client/project/update_machine_reservation_parameters.go @@ -0,0 +1,196 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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/go-openapi/swag" + + "github.com/fi-ts/cloud-go/api/models" +) + +// NewUpdateMachineReservationParams creates a new UpdateMachineReservationParams 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 NewUpdateMachineReservationParams() *UpdateMachineReservationParams { + return &UpdateMachineReservationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateMachineReservationParamsWithTimeout creates a new UpdateMachineReservationParams object +// with the ability to set a timeout on a request. +func NewUpdateMachineReservationParamsWithTimeout(timeout time.Duration) *UpdateMachineReservationParams { + return &UpdateMachineReservationParams{ + timeout: timeout, + } +} + +// NewUpdateMachineReservationParamsWithContext creates a new UpdateMachineReservationParams object +// with the ability to set a context for a request. +func NewUpdateMachineReservationParamsWithContext(ctx context.Context) *UpdateMachineReservationParams { + return &UpdateMachineReservationParams{ + Context: ctx, + } +} + +// NewUpdateMachineReservationParamsWithHTTPClient creates a new UpdateMachineReservationParams object +// with the ability to set a custom HTTPClient for a request. +func NewUpdateMachineReservationParamsWithHTTPClient(client *http.Client) *UpdateMachineReservationParams { + return &UpdateMachineReservationParams{ + HTTPClient: client, + } +} + +/* +UpdateMachineReservationParams contains all the parameters to send to the API endpoint + + for the update machine reservation operation. + + Typically these are written to a http.Request. +*/ +type UpdateMachineReservationParams struct { + + // Body. + Body *models.V1MachineReservationUpdateRequest + + /* Force. + + if true, allows overbooking of a partition + */ + Force *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the update machine reservation params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateMachineReservationParams) WithDefaults() *UpdateMachineReservationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the update machine reservation params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateMachineReservationParams) SetDefaults() { + var ( + forceDefault = bool(false) + ) + + val := UpdateMachineReservationParams{ + Force: &forceDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the update machine reservation params +func (o *UpdateMachineReservationParams) WithTimeout(timeout time.Duration) *UpdateMachineReservationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update machine reservation params +func (o *UpdateMachineReservationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update machine reservation params +func (o *UpdateMachineReservationParams) WithContext(ctx context.Context) *UpdateMachineReservationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update machine reservation params +func (o *UpdateMachineReservationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update machine reservation params +func (o *UpdateMachineReservationParams) WithHTTPClient(client *http.Client) *UpdateMachineReservationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update machine reservation params +func (o *UpdateMachineReservationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the update machine reservation params +func (o *UpdateMachineReservationParams) WithBody(body *models.V1MachineReservationUpdateRequest) *UpdateMachineReservationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the update machine reservation params +func (o *UpdateMachineReservationParams) SetBody(body *models.V1MachineReservationUpdateRequest) { + o.Body = body +} + +// WithForce adds the force to the update machine reservation params +func (o *UpdateMachineReservationParams) WithForce(force *bool) *UpdateMachineReservationParams { + o.SetForce(force) + return o +} + +// SetForce adds the force to the update machine reservation params +func (o *UpdateMachineReservationParams) SetForce(force *bool) { + o.Force = force +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateMachineReservationParams) 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 o.Force != nil { + + // query param force + var qrForce bool + + if o.Force != nil { + qrForce = *o.Force + } + qForce := swag.FormatBool(qrForce) + if qForce != "" { + + if err := r.SetQueryParam("force", qForce); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/api/client/project/update_machine_reservation_responses.go b/api/client/project/update_machine_reservation_responses.go new file mode 100644 index 0000000..aa65d22 --- /dev/null +++ b/api/client/project/update_machine_reservation_responses.go @@ -0,0 +1,188 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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/fi-ts/cloud-go/api/models" + "github.com/metal-stack/metal-lib/httperrors" +) + +// UpdateMachineReservationReader is a Reader for the UpdateMachineReservation structure. +type UpdateMachineReservationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateMachineReservationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateMachineReservationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUpdateMachineReservationDefault(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 + } +} + +// NewUpdateMachineReservationOK creates a UpdateMachineReservationOK with default headers values +func NewUpdateMachineReservationOK() *UpdateMachineReservationOK { + return &UpdateMachineReservationOK{} +} + +/* +UpdateMachineReservationOK describes a response with status code 200, with default header values. + +Updated +*/ +type UpdateMachineReservationOK struct { + Payload *models.V1MachineReservationResponse +} + +// IsSuccess returns true when this update machine reservation o k response has a 2xx status code +func (o *UpdateMachineReservationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this update machine reservation o k response has a 3xx status code +func (o *UpdateMachineReservationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update machine reservation o k response has a 4xx status code +func (o *UpdateMachineReservationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this update machine reservation o k response has a 5xx status code +func (o *UpdateMachineReservationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this update machine reservation o k response a status code equal to that given +func (o *UpdateMachineReservationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the update machine reservation o k response +func (o *UpdateMachineReservationOK) Code() int { + return 200 +} + +func (o *UpdateMachineReservationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/project/reservation/machine][%d] updateMachineReservationOK %s", 200, payload) +} + +func (o *UpdateMachineReservationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/project/reservation/machine][%d] updateMachineReservationOK %s", 200, payload) +} + +func (o *UpdateMachineReservationOK) GetPayload() *models.V1MachineReservationResponse { + return o.Payload +} + +func (o *UpdateMachineReservationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.V1MachineReservationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateMachineReservationDefault creates a UpdateMachineReservationDefault with default headers values +func NewUpdateMachineReservationDefault(code int) *UpdateMachineReservationDefault { + return &UpdateMachineReservationDefault{ + _statusCode: code, + } +} + +/* +UpdateMachineReservationDefault describes a response with status code -1, with default header values. + +Error +*/ +type UpdateMachineReservationDefault struct { + _statusCode int + + Payload *httperrors.HTTPErrorResponse +} + +// IsSuccess returns true when this update machine reservation default response has a 2xx status code +func (o *UpdateMachineReservationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this update machine reservation default response has a 3xx status code +func (o *UpdateMachineReservationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this update machine reservation default response has a 4xx status code +func (o *UpdateMachineReservationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this update machine reservation default response has a 5xx status code +func (o *UpdateMachineReservationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this update machine reservation default response a status code equal to that given +func (o *UpdateMachineReservationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the update machine reservation default response +func (o *UpdateMachineReservationDefault) Code() int { + return o._statusCode +} + +func (o *UpdateMachineReservationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/project/reservation/machine][%d] updateMachineReservation default %s", o._statusCode, payload) +} + +func (o *UpdateMachineReservationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/project/reservation/machine][%d] updateMachineReservation default %s", o._statusCode, payload) +} + +func (o *UpdateMachineReservationDefault) GetPayload() *httperrors.HTTPErrorResponse { + return o.Payload +} + +func (o *UpdateMachineReservationDefault) 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/models/models_v1_size_reservation.go b/api/models/models_v1_size_reservation.go deleted file mode 100644 index 1c04893..0000000 --- a/api/models/models_v1_size_reservation.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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" -) - -// ModelsV1SizeReservation models v1 size reservation -// -// swagger:model models.V1SizeReservation -type ModelsV1SizeReservation struct { - - // amount - // Required: true - Amount *int32 `json:"amount"` - - // description - Description string `json:"description,omitempty"` - - // labels - Labels map[string]string `json:"labels,omitempty"` - - // partitionids - // Required: true - Partitionids []string `json:"partitionids"` - - // projectid - // Required: true - Projectid *string `json:"projectid"` -} - -// Validate validates this models v1 size reservation -func (m *ModelsV1SizeReservation) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAmount(formats); err != nil { - res = append(res, err) - } - - if err := m.validatePartitionids(formats); err != nil { - res = append(res, err) - } - - if err := m.validateProjectid(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ModelsV1SizeReservation) validateAmount(formats strfmt.Registry) error { - - if err := validate.Required("amount", "body", m.Amount); err != nil { - return err - } - - return nil -} - -func (m *ModelsV1SizeReservation) validatePartitionids(formats strfmt.Registry) error { - - if err := validate.Required("partitionids", "body", m.Partitionids); err != nil { - return err - } - - return nil -} - -func (m *ModelsV1SizeReservation) validateProjectid(formats strfmt.Registry) error { - - if err := validate.Required("projectid", "body", m.Projectid); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this models v1 size reservation based on context it is used -func (m *ModelsV1SizeReservation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *ModelsV1SizeReservation) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ModelsV1SizeReservation) UnmarshalBinary(b []byte) error { - var res ModelsV1SizeReservation - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/api/models/models_v1_size_response.go b/api/models/models_v1_size_response.go index 6c0cc9a..8129e0b 100644 --- a/api/models/models_v1_size_response.go +++ b/api/models/models_v1_size_response.go @@ -43,10 +43,6 @@ type ModelsV1SizeResponse struct { // name Name string `json:"name,omitempty"` - - // reservations - // Required: true - Reservations []*ModelsV1SizeReservation `json:"reservations"` } // Validate validates this models v1 size response @@ -65,10 +61,6 @@ func (m *ModelsV1SizeResponse) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateReservations(formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -120,33 +112,6 @@ func (m *ModelsV1SizeResponse) validateLabels(formats strfmt.Registry) error { return nil } -func (m *ModelsV1SizeResponse) validateReservations(formats strfmt.Registry) error { - - if err := validate.Required("reservations", "body", m.Reservations); err != nil { - return err - } - - for i := 0; i < len(m.Reservations); i++ { - if swag.IsZero(m.Reservations[i]) { // not required - continue - } - - if m.Reservations[i] != nil { - if err := m.Reservations[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("reservations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("reservations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - // ContextValidate validate this models v1 size response based on the context it is used func (m *ModelsV1SizeResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -155,10 +120,6 @@ func (m *ModelsV1SizeResponse) ContextValidate(ctx context.Context, formats strf res = append(res, err) } - if err := m.contextValidateReservations(ctx, formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -190,31 +151,6 @@ func (m *ModelsV1SizeResponse) contextValidateConstraints(ctx context.Context, f return nil } -func (m *ModelsV1SizeResponse) contextValidateReservations(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Reservations); i++ { - - if m.Reservations[i] != nil { - - if swag.IsZero(m.Reservations[i]) { // not required - return nil - } - - if err := m.Reservations[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("reservations" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("reservations" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - // MarshalBinary interface implementation func (m *ModelsV1SizeResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/models/v1_kubernetes.go b/api/models/v1_kubernetes.go index 28ce0a3..4f19979 100644 --- a/api/models/v1_kubernetes.go +++ b/api/models/v1_kubernetes.go @@ -28,6 +28,10 @@ type V1Kubernetes struct { // max pods per node MaxPodsPerNode int32 `json:"MaxPodsPerNode,omitempty"` + // pod p i ds limit + // Required: true + PodPIDsLimit *int64 `json:"PodPIDsLimit"` + // version // Required: true Version *string `json:"Version"` @@ -46,6 +50,10 @@ func (m *V1Kubernetes) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validatePodPIDsLimit(formats); err != nil { + res = append(res, err) + } + if err := m.validateVersion(formats); err != nil { res = append(res, err) } @@ -73,6 +81,15 @@ func (m *V1Kubernetes) validateExpirationDate(formats strfmt.Registry) error { return nil } +func (m *V1Kubernetes) validatePodPIDsLimit(formats strfmt.Registry) error { + + if err := validate.Required("PodPIDsLimit", "body", m.PodPIDsLimit); err != nil { + return err + } + + return nil +} + func (m *V1Kubernetes) validateVersion(formats strfmt.Registry) error { if err := validate.Required("Version", "body", m.Version); err != nil { diff --git a/api/models/v1_machine_reservation_billing_usage_response.go b/api/models/v1_machine_reservation_billing_usage_response.go new file mode 100644 index 0000000..7820621 --- /dev/null +++ b/api/models/v1_machine_reservation_billing_usage_response.go @@ -0,0 +1,215 @@ +// 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" + "github.com/go-openapi/validate" +) + +// V1MachineReservationBillingUsageResponse v1 machine reservation billing usage response +// +// swagger:model v1.MachineReservationBillingUsageResponse +type V1MachineReservationBillingUsageResponse struct { + + // just the usage data of the individual machine reservations summed up + // Required: true + Accumulatedusage *V1MachineReservationUsageAccumuluated `json:"accumulatedusage"` + + // the start time in the accounting window to look at + // Required: true + // Format: date-time + From *strfmt.DateTime `json:"from"` + + // the end time in the accounting window to look at (defaults to current system time) + // Format: date-time + To strfmt.DateTime `json:"to,omitempty"` + + // the usage data of the individual machine reservations + // Required: true + Usage []*V1MachineReservationUsage `json:"usage"` +} + +// Validate validates this v1 machine reservation billing usage response +func (m *V1MachineReservationBillingUsageResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccumulatedusage(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFrom(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTo(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsage(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1MachineReservationBillingUsageResponse) validateAccumulatedusage(formats strfmt.Registry) error { + + if err := validate.Required("accumulatedusage", "body", m.Accumulatedusage); err != nil { + return err + } + + if m.Accumulatedusage != nil { + if err := m.Accumulatedusage.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accumulatedusage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accumulatedusage") + } + return err + } + } + + return nil +} + +func (m *V1MachineReservationBillingUsageResponse) validateFrom(formats strfmt.Registry) error { + + if err := validate.Required("from", "body", m.From); err != nil { + return err + } + + if err := validate.FormatOf("from", "body", "date-time", m.From.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationBillingUsageResponse) validateTo(formats strfmt.Registry) error { + if swag.IsZero(m.To) { // not required + return nil + } + + if err := validate.FormatOf("to", "body", "date-time", m.To.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationBillingUsageResponse) validateUsage(formats strfmt.Registry) error { + + if err := validate.Required("usage", "body", m.Usage); err != nil { + return err + } + + for i := 0; i < len(m.Usage); i++ { + if swag.IsZero(m.Usage[i]) { // not required + continue + } + + if m.Usage[i] != nil { + if err := m.Usage[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("usage" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this v1 machine reservation billing usage response based on the context it is used +func (m *V1MachineReservationBillingUsageResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccumulatedusage(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUsage(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1MachineReservationBillingUsageResponse) contextValidateAccumulatedusage(ctx context.Context, formats strfmt.Registry) error { + + if m.Accumulatedusage != nil { + + if err := m.Accumulatedusage.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accumulatedusage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accumulatedusage") + } + return err + } + } + + return nil +} + +func (m *V1MachineReservationBillingUsageResponse) contextValidateUsage(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Usage); i++ { + + if m.Usage[i] != nil { + + if swag.IsZero(m.Usage[i]) { // not required + return nil + } + + if err := m.Usage[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("usage" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *V1MachineReservationBillingUsageResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1MachineReservationBillingUsageResponse) UnmarshalBinary(b []byte) error { + var res V1MachineReservationBillingUsageResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_machine_reservation_create_request.go b/api/models/v1_machine_reservation_create_request.go new file mode 100644 index 0000000..c6ffae3 --- /dev/null +++ b/api/models/v1_machine_reservation_create_request.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" +) + +// V1MachineReservationCreateRequest v1 machine reservation create request +// +// swagger:model v1.MachineReservationCreateRequest +type V1MachineReservationCreateRequest struct { + + // amount + // Required: true + Amount *int32 `json:"amount"` + + // description + // Required: true + Description *string `json:"description"` + + // partitionids + // Required: true + Partitionids []string `json:"partitionids"` + + // projectid + // Required: true + Projectid *string `json:"projectid"` + + // sizeid + // Required: true + Sizeid *string `json:"sizeid"` +} + +// Validate validates this v1 machine reservation create request +func (m *V1MachineReservationCreateRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAmount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePartitionids(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProjectid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSizeid(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1MachineReservationCreateRequest) validateAmount(formats strfmt.Registry) error { + + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationCreateRequest) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationCreateRequest) validatePartitionids(formats strfmt.Registry) error { + + if err := validate.Required("partitionids", "body", m.Partitionids); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationCreateRequest) validateProjectid(formats strfmt.Registry) error { + + if err := validate.Required("projectid", "body", m.Projectid); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationCreateRequest) validateSizeid(formats strfmt.Registry) error { + + if err := validate.Required("sizeid", "body", m.Sizeid); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 machine reservation create request based on context it is used +func (m *V1MachineReservationCreateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1MachineReservationCreateRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1MachineReservationCreateRequest) UnmarshalBinary(b []byte) error { + var res V1MachineReservationCreateRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_machine_reservation_find_request.go b/api/models/v1_machine_reservation_find_request.go new file mode 100644 index 0000000..bc4210e --- /dev/null +++ b/api/models/v1_machine_reservation_find_request.go @@ -0,0 +1,122 @@ +// 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" +) + +// V1MachineReservationFindRequest v1 machine reservation find request +// +// swagger:model v1.MachineReservationFindRequest +type V1MachineReservationFindRequest struct { + + // the id of this machine reservation + // Required: true + ID *string `json:"id"` + + // the project id of this machine reservation + // Required: true + Projectid *string `json:"projectid"` + + // the size id of this machine reservation + // Required: true + Sizeid *string `json:"sizeid"` + + // the tenant of this machine reservation + // Required: true + Tenant *string `json:"tenant"` +} + +// Validate validates this v1 machine reservation find request +func (m *V1MachineReservationFindRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProjectid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSizeid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTenant(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1MachineReservationFindRequest) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationFindRequest) validateProjectid(formats strfmt.Registry) error { + + if err := validate.Required("projectid", "body", m.Projectid); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationFindRequest) validateSizeid(formats strfmt.Registry) error { + + if err := validate.Required("sizeid", "body", m.Sizeid); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationFindRequest) validateTenant(formats strfmt.Registry) error { + + if err := validate.Required("tenant", "body", m.Tenant); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 machine reservation find request based on context it is used +func (m *V1MachineReservationFindRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1MachineReservationFindRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1MachineReservationFindRequest) UnmarshalBinary(b []byte) error { + var res V1MachineReservationFindRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_machine_reservation_response.go b/api/models/v1_machine_reservation_response.go new file mode 100644 index 0000000..b1c1652 --- /dev/null +++ b/api/models/v1_machine_reservation_response.go @@ -0,0 +1,176 @@ +// 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" +) + +// V1MachineReservationResponse v1 machine reservation response +// +// swagger:model v1.MachineReservationResponse +type V1MachineReservationResponse struct { + + // amount + // Required: true + Amount *int32 `json:"amount"` + + // description + Description string `json:"description,omitempty"` + + // id + // Required: true + ID *string `json:"id"` + + // labels + // Required: true + Labels map[string]string `json:"labels"` + + // partitionids + // Required: true + Partitionids []string `json:"partitionids"` + + // projectid + // Required: true + Projectid *string `json:"projectid"` + + // sizeid + // Required: true + Sizeid *string `json:"sizeid"` + + // tenant + // Required: true + Tenant *string `json:"tenant"` +} + +// Validate validates this v1 machine reservation response +func (m *V1MachineReservationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAmount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLabels(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePartitionids(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProjectid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSizeid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTenant(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1MachineReservationResponse) validateAmount(formats strfmt.Registry) error { + + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationResponse) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationResponse) validateLabels(formats strfmt.Registry) error { + + if err := validate.Required("labels", "body", m.Labels); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationResponse) validatePartitionids(formats strfmt.Registry) error { + + if err := validate.Required("partitionids", "body", m.Partitionids); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationResponse) validateProjectid(formats strfmt.Registry) error { + + if err := validate.Required("projectid", "body", m.Projectid); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationResponse) validateSizeid(formats strfmt.Registry) error { + + if err := validate.Required("sizeid", "body", m.Sizeid); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationResponse) validateTenant(formats strfmt.Registry) error { + + if err := validate.Required("tenant", "body", m.Tenant); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 machine reservation response based on context it is used +func (m *V1MachineReservationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1MachineReservationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1MachineReservationResponse) UnmarshalBinary(b []byte) error { + var res V1MachineReservationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_machine_reservation_update_request.go b/api/models/v1_machine_reservation_update_request.go new file mode 100644 index 0000000..fee9779 --- /dev/null +++ b/api/models/v1_machine_reservation_update_request.go @@ -0,0 +1,156 @@ +// 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" +) + +// V1MachineReservationUpdateRequest v1 machine reservation update request +// +// swagger:model v1.MachineReservationUpdateRequest +type V1MachineReservationUpdateRequest struct { + + // amount + // Required: true + Amount *int32 `json:"amount"` + + // description + // Required: true + Description *string `json:"description"` + + // id + // Required: true + ID *string `json:"id"` + + // partitionids + // Required: true + Partitionids []string `json:"partitionids"` + + // projectid + // Required: true + Projectid *string `json:"projectid"` + + // sizeid + // Required: true + Sizeid *string `json:"sizeid"` +} + +// Validate validates this v1 machine reservation update request +func (m *V1MachineReservationUpdateRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAmount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePartitionids(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProjectid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSizeid(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1MachineReservationUpdateRequest) validateAmount(formats strfmt.Registry) error { + + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUpdateRequest) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUpdateRequest) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUpdateRequest) validatePartitionids(formats strfmt.Registry) error { + + if err := validate.Required("partitionids", "body", m.Partitionids); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUpdateRequest) validateProjectid(formats strfmt.Registry) error { + + if err := validate.Required("projectid", "body", m.Projectid); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUpdateRequest) validateSizeid(formats strfmt.Registry) error { + + if err := validate.Required("sizeid", "body", m.Sizeid); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 machine reservation update request based on context it is used +func (m *V1MachineReservationUpdateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1MachineReservationUpdateRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1MachineReservationUpdateRequest) UnmarshalBinary(b []byte) error { + var res V1MachineReservationUpdateRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_machine_reservation_usage.go b/api/models/v1_machine_reservation_usage.go new file mode 100644 index 0000000..3782ec3 --- /dev/null +++ b/api/models/v1_machine_reservation_usage.go @@ -0,0 +1,241 @@ +// 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" +) + +// V1MachineReservationUsage v1 machine reservation usage +// +// swagger:model v1.MachineReservationUsage +type V1MachineReservationUsage struct { + + // the average amount of unused machine reservations in the given time window + // Required: true + Average *string `json:"average"` + + // the contract number attached to this entity + // Required: true + Contract *string `json:"contract"` + + // the debtor id attached to this entity + // Required: true + Debtorid *string `json:"debtorid"` + + // the id of this machine reservation + // Required: true + ID *string `json:"id"` + + // the partition of this machine reservation + // Required: true + Partition *string `json:"partition"` + + // the project id of this entity + // Required: true + Projectid *string `json:"projectid"` + + // the project name of this entity + // Required: true + Projectname *string `json:"projectname"` + + // the amount of the number of unused machine reservations multiplied by time + // Required: true + Reservationseconds *string `json:"reservationseconds"` + + // the size id of this machine reservation + // Required: true + Sizeid *string `json:"sizeid"` + + // the tenant of this entity + // Required: true + Tenant *string `json:"tenant"` + + // the tenant name of this entity + // Required: true + Tenantname *string `json:"tenantname"` +} + +// Validate validates this v1 machine reservation usage +func (m *V1MachineReservationUsage) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAverage(formats); err != nil { + res = append(res, err) + } + + if err := m.validateContract(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDebtorid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePartition(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProjectid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProjectname(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReservationseconds(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSizeid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTenant(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTenantname(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1MachineReservationUsage) validateAverage(formats strfmt.Registry) error { + + if err := validate.Required("average", "body", m.Average); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsage) validateContract(formats strfmt.Registry) error { + + if err := validate.Required("contract", "body", m.Contract); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsage) validateDebtorid(formats strfmt.Registry) error { + + if err := validate.Required("debtorid", "body", m.Debtorid); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsage) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsage) validatePartition(formats strfmt.Registry) error { + + if err := validate.Required("partition", "body", m.Partition); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsage) validateProjectid(formats strfmt.Registry) error { + + if err := validate.Required("projectid", "body", m.Projectid); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsage) validateProjectname(formats strfmt.Registry) error { + + if err := validate.Required("projectname", "body", m.Projectname); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsage) validateReservationseconds(formats strfmt.Registry) error { + + if err := validate.Required("reservationseconds", "body", m.Reservationseconds); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsage) validateSizeid(formats strfmt.Registry) error { + + if err := validate.Required("sizeid", "body", m.Sizeid); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsage) validateTenant(formats strfmt.Registry) error { + + if err := validate.Required("tenant", "body", m.Tenant); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsage) validateTenantname(formats strfmt.Registry) error { + + if err := validate.Required("tenantname", "body", m.Tenantname); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 machine reservation usage based on context it is used +func (m *V1MachineReservationUsage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1MachineReservationUsage) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1MachineReservationUsage) UnmarshalBinary(b []byte) error { + var res V1MachineReservationUsage + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_machine_reservation_usage_accumuluated.go b/api/models/v1_machine_reservation_usage_accumuluated.go new file mode 100644 index 0000000..75a2286 --- /dev/null +++ b/api/models/v1_machine_reservation_usage_accumuluated.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" +) + +// V1MachineReservationUsageAccumuluated v1 machine reservation usage accumuluated +// +// swagger:model v1.MachineReservationUsageAccumuluated +type V1MachineReservationUsageAccumuluated struct { + + // the average amount of unused machine reservations in the given time window + // Required: true + Average *string `json:"average"` + + // the amount of the number of unused machine reservations multiplied by time + // Required: true + Reservationseconds *string `json:"reservationseconds"` +} + +// Validate validates this v1 machine reservation usage accumuluated +func (m *V1MachineReservationUsageAccumuluated) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAverage(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReservationseconds(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1MachineReservationUsageAccumuluated) validateAverage(formats strfmt.Registry) error { + + if err := validate.Required("average", "body", m.Average); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsageAccumuluated) validateReservationseconds(formats strfmt.Registry) error { + + if err := validate.Required("reservationseconds", "body", m.Reservationseconds); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 machine reservation usage accumuluated based on context it is used +func (m *V1MachineReservationUsageAccumuluated) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1MachineReservationUsageAccumuluated) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1MachineReservationUsageAccumuluated) UnmarshalBinary(b []byte) error { + var res V1MachineReservationUsageAccumuluated + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_machine_reservation_usage_request.go b/api/models/v1_machine_reservation_usage_request.go new file mode 100644 index 0000000..fc1e1f9 --- /dev/null +++ b/api/models/v1_machine_reservation_usage_request.go @@ -0,0 +1,114 @@ +// 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" +) + +// V1MachineReservationUsageRequest v1 machine reservation usage request +// +// swagger:model v1.MachineReservationUsageRequest +type V1MachineReservationUsageRequest struct { + + // the cluster id to account for + Clusterid string `json:"clusterid,omitempty"` + + // the start time in the accounting window to look at + // Required: true + // Format: date-time + From *strfmt.DateTime `json:"from"` + + // the id of the machine reservation + ID string `json:"id,omitempty"` + + // the partition of the machine reservation + Partition string `json:"partition,omitempty"` + + // the project id to account for + Projectid string `json:"projectid,omitempty"` + + // the size of the machine reservation + Sizeid string `json:"sizeid,omitempty"` + + // the tenant to get the container usage for (defaults to all tenants) + Tenant string `json:"tenant,omitempty"` + + // the end time in the accounting window to look at (defaults to current system time) + // Format: date-time + To strfmt.DateTime `json:"to,omitempty"` +} + +// Validate validates this v1 machine reservation usage request +func (m *V1MachineReservationUsageRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFrom(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTo(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1MachineReservationUsageRequest) validateFrom(formats strfmt.Registry) error { + + if err := validate.Required("from", "body", m.From); err != nil { + return err + } + + if err := validate.FormatOf("from", "body", "date-time", m.From.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsageRequest) validateTo(formats strfmt.Registry) error { + if swag.IsZero(m.To) { // not required + return nil + } + + if err := validate.FormatOf("to", "body", "date-time", m.To.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 machine reservation usage request based on context it is used +func (m *V1MachineReservationUsageRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1MachineReservationUsageRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1MachineReservationUsageRequest) UnmarshalBinary(b []byte) error { + var res V1MachineReservationUsageRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/models/v1_machine_reservation_usage_response.go b/api/models/v1_machine_reservation_usage_response.go new file mode 100644 index 0000000..27e7108 --- /dev/null +++ b/api/models/v1_machine_reservation_usage_response.go @@ -0,0 +1,224 @@ +// 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" +) + +// V1MachineReservationUsageResponse v1 machine reservation usage response +// +// swagger:model v1.MachineReservationUsageResponse +type V1MachineReservationUsageResponse struct { + + // id + // Required: true + ID *string `json:"id"` + + // labels + // Required: true + Labels map[string]string `json:"labels"` + + // partitionid + // Required: true + Partitionid *string `json:"partitionid"` + + // projectallocations + // Required: true + Projectallocations *int32 `json:"projectallocations"` + + // projectid + // Required: true + Projectid *string `json:"projectid"` + + // projectname + // Required: true + Projectname *string `json:"projectname"` + + // reservations + // Required: true + Reservations *int32 `json:"reservations"` + + // sizeid + // Required: true + Sizeid *string `json:"sizeid"` + + // tenant + // Required: true + Tenant *string `json:"tenant"` + + // usedreservations + // Required: true + Usedreservations *int32 `json:"usedreservations"` +} + +// Validate validates this v1 machine reservation usage response +func (m *V1MachineReservationUsageResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLabels(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePartitionid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProjectallocations(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProjectid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProjectname(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReservations(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSizeid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTenant(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsedreservations(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1MachineReservationUsageResponse) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsageResponse) validateLabels(formats strfmt.Registry) error { + + if err := validate.Required("labels", "body", m.Labels); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsageResponse) validatePartitionid(formats strfmt.Registry) error { + + if err := validate.Required("partitionid", "body", m.Partitionid); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsageResponse) validateProjectallocations(formats strfmt.Registry) error { + + if err := validate.Required("projectallocations", "body", m.Projectallocations); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsageResponse) validateProjectid(formats strfmt.Registry) error { + + if err := validate.Required("projectid", "body", m.Projectid); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsageResponse) validateProjectname(formats strfmt.Registry) error { + + if err := validate.Required("projectname", "body", m.Projectname); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsageResponse) validateReservations(formats strfmt.Registry) error { + + if err := validate.Required("reservations", "body", m.Reservations); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsageResponse) validateSizeid(formats strfmt.Registry) error { + + if err := validate.Required("sizeid", "body", m.Sizeid); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsageResponse) validateTenant(formats strfmt.Registry) error { + + if err := validate.Required("tenant", "body", m.Tenant); err != nil { + return err + } + + return nil +} + +func (m *V1MachineReservationUsageResponse) validateUsedreservations(formats strfmt.Registry) error { + + if err := validate.Required("usedreservations", "body", m.Usedreservations); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this v1 machine reservation usage response based on context it is used +func (m *V1MachineReservationUsageResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *V1MachineReservationUsageResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1MachineReservationUsageResponse) UnmarshalBinary(b []byte) error { + var res V1MachineReservationUsageResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/cloud-api.json b/cloud-api.json index 225f1a5..02efca6 100644 --- a/cloud-api.json +++ b/cloud-api.json @@ -1045,37 +1045,6 @@ "type" ] }, - "models.V1SizeReservation": { - "properties": { - "amount": { - "format": "int32", - "type": "integer" - }, - "description": { - "type": "string" - }, - "labels": { - "additionalProperties": { - "type": "string" - }, - "type": "object" - }, - "partitionids": { - "items": { - "type": "string" - }, - "type": "array" - }, - "projectid": { - "type": "string" - } - }, - "required": [ - "amount", - "partitionids", - "projectid" - ] - }, "models.V1SizeResponse": { "properties": { "changed": { @@ -1104,19 +1073,12 @@ }, "name": { "type": "string" - }, - "reservations": { - "items": { - "$ref": "#/definitions/models.V1SizeReservation" - }, - "type": "array" } }, "required": [ "constraints", "id", - "labels", - "reservations" + "labels" ] }, "models.V1VolumeGroup": { @@ -2777,6 +2739,10 @@ "format": "int32", "type": "integer" }, + "PodPIDsLimit": { + "format": "int64", + "type": "integer" + }, "Version": { "type": "string" }, @@ -2792,6 +2758,7 @@ }, "required": [ "ExpirationDate", + "PodPIDsLimit", "Version", "defaultPodSecurityStandard" ] @@ -2810,6 +2777,340 @@ "Version" ] }, + "v1.MachineReservationBillingUsageResponse": { + "properties": { + "accumulatedusage": { + "$ref": "#/definitions/v1.MachineReservationUsageAccumuluated", + "description": "just the usage data of the individual machine reservations summed up" + }, + "from": { + "description": "the start time in the accounting window to look at", + "format": "date-time", + "type": "string" + }, + "to": { + "description": "the end time in the accounting window to look at (defaults to current system time)", + "format": "date-time", + "type": "string" + }, + "usage": { + "description": "the usage data of the individual machine reservations", + "items": { + "$ref": "#/definitions/v1.MachineReservationUsage" + }, + "type": "array" + } + }, + "required": [ + "accumulatedusage", + "from", + "usage" + ] + }, + "v1.MachineReservationCreateRequest": { + "properties": { + "amount": { + "format": "int32", + "type": "integer" + }, + "description": { + "type": "string" + }, + "partitionids": { + "items": { + "type": "string" + }, + "type": "array" + }, + "projectid": { + "type": "string" + }, + "sizeid": { + "type": "string" + } + }, + "required": [ + "amount", + "description", + "partitionids", + "projectid", + "sizeid" + ] + }, + "v1.MachineReservationFindRequest": { + "properties": { + "id": { + "description": "the id of this machine reservation", + "type": "string" + }, + "projectid": { + "description": "the project id of this machine reservation", + "type": "string" + }, + "sizeid": { + "description": "the size id of this machine reservation", + "type": "string" + }, + "tenant": { + "description": "the tenant of this machine reservation", + "type": "string" + } + }, + "required": [ + "id", + "projectid", + "sizeid", + "tenant" + ] + }, + "v1.MachineReservationResponse": { + "properties": { + "amount": { + "format": "int32", + "type": "integer" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "partitionids": { + "items": { + "type": "string" + }, + "type": "array" + }, + "projectid": { + "type": "string" + }, + "sizeid": { + "type": "string" + }, + "tenant": { + "type": "string" + } + }, + "required": [ + "amount", + "id", + "labels", + "partitionids", + "projectid", + "sizeid", + "tenant" + ] + }, + "v1.MachineReservationUpdateRequest": { + "properties": { + "amount": { + "format": "int32", + "type": "integer" + }, + "description": { + "type": "string" + }, + "id": { + "type": "string" + }, + "partitionids": { + "items": { + "type": "string" + }, + "type": "array" + }, + "projectid": { + "type": "string" + }, + "sizeid": { + "type": "string" + } + }, + "required": [ + "amount", + "description", + "id", + "partitionids", + "projectid", + "sizeid" + ] + }, + "v1.MachineReservationUsage": { + "properties": { + "average": { + "description": "the average amount of unused machine reservations in the given time window", + "type": "string" + }, + "contract": { + "description": "the contract number attached to this entity", + "type": "string" + }, + "debtorid": { + "description": "the debtor id attached to this entity", + "type": "string" + }, + "id": { + "description": "the id of this machine reservation", + "type": "string" + }, + "partition": { + "description": "the partition of this machine reservation", + "type": "string" + }, + "projectid": { + "description": "the project id of this entity", + "type": "string" + }, + "projectname": { + "description": "the project name of this entity", + "type": "string" + }, + "reservationseconds": { + "description": "the amount of the number of unused machine reservations multiplied by time", + "type": "string" + }, + "sizeid": { + "description": "the size id of this machine reservation", + "type": "string" + }, + "tenant": { + "description": "the tenant of this entity", + "type": "string" + }, + "tenantname": { + "description": "the tenant name of this entity", + "type": "string" + } + }, + "required": [ + "average", + "contract", + "debtorid", + "id", + "partition", + "projectid", + "projectname", + "reservationseconds", + "sizeid", + "tenant", + "tenantname" + ] + }, + "v1.MachineReservationUsageAccumuluated": { + "properties": { + "average": { + "description": "the average amount of unused machine reservations in the given time window", + "type": "string" + }, + "reservationseconds": { + "description": "the amount of the number of unused machine reservations multiplied by time", + "type": "string" + } + }, + "required": [ + "average", + "reservationseconds" + ] + }, + "v1.MachineReservationUsageRequest": { + "properties": { + "clusterid": { + "description": "the cluster id to account for", + "type": "string" + }, + "from": { + "description": "the start time in the accounting window to look at", + "format": "date-time", + "type": "string" + }, + "id": { + "description": "the id of the machine reservation", + "type": "string" + }, + "partition": { + "description": "the partition of the machine reservation", + "type": "string" + }, + "projectid": { + "description": "the project id to account for", + "type": "string" + }, + "sizeid": { + "description": "the size of the machine reservation", + "type": "string" + }, + "tenant": { + "description": "the tenant to get the container usage for (defaults to all tenants)", + "type": "string" + }, + "to": { + "description": "the end time in the accounting window to look at (defaults to current system time)", + "format": "date-time", + "type": "string" + } + }, + "required": [ + "from" + ] + }, + "v1.MachineReservationUsageResponse": { + "properties": { + "id": { + "type": "string" + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "partitionid": { + "type": "string" + }, + "projectallocations": { + "format": "int32", + "type": "integer" + }, + "projectid": { + "type": "string" + }, + "projectname": { + "type": "string" + }, + "reservations": { + "format": "int32", + "type": "integer" + }, + "sizeid": { + "type": "string" + }, + "tenant": { + "type": "string" + }, + "usedreservations": { + "format": "int32", + "type": "integer" + } + }, + "required": [ + "id", + "labels", + "partitionid", + "projectallocations", + "projectid", + "projectname", + "reservations", + "sizeid", + "tenant", + "usedreservations" + ] + }, "v1.MachineUsage": { "properties": { "allocationid": { @@ -6224,7 +6525,8 @@ "name": "MIT", "url": "http://mit.org" }, - "title": "cloud-api" + "title": "cloud-api", + "version": "v0.29.0" }, "paths": { "/v1/accounting/cluster-usage": { @@ -6464,6 +6766,45 @@ ] } }, + "/v1/accounting/machine-reservation-usage": { + "post": { + "consumes": [ + "application/json" + ], + "operationId": "machineReservationUsage", + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.MachineReservationUsageRequest" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.MachineReservationBillingUsageResponse" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "#/definitions/httperrors.HTTPErrorResponse" + } + } + }, + "summary": "find machine reservation usage for given accounting query", + "tags": [ + "accounting" + ] + } + }, "/v1/accounting/machine-usage": { "post": { "consumes": [ @@ -8734,6 +9075,260 @@ ] } }, + "/v1/project/reservation/machine": { + "post": { + "consumes": [ + "application/json" + ], + "operationId": "updateMachineReservation", + "parameters": [ + { + "default": false, + "description": "if true, allows overbooking of a partition", + "in": "query", + "name": "force", + "type": "boolean" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.MachineReservationUpdateRequest" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Updated", + "schema": { + "$ref": "#/definitions/v1.MachineReservationResponse" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "#/definitions/httperrors.HTTPErrorResponse" + } + } + }, + "summary": "update a machine reservation", + "tags": [ + "project" + ] + }, + "put": { + "consumes": [ + "application/json" + ], + "operationId": "createMachineReservation", + "parameters": [ + { + "default": false, + "description": "if true, allows overbooking of a partition", + "in": "query", + "name": "force", + "type": "boolean" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.MachineReservationCreateRequest" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/v1.MachineReservationResponse" + } + }, + "409": { + "description": "Conflict", + "schema": { + "$ref": "#/definitions/httperrors.HTTPErrorResponse" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "#/definitions/httperrors.HTTPErrorResponse" + } + } + }, + "summary": "create a machine reservation", + "tags": [ + "project" + ] + } + }, + "/v1/project/reservation/machine/find": { + "post": { + "consumes": [ + "application/json" + ], + "operationId": "listMachineReservations", + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.MachineReservationFindRequest" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "items": { + "$ref": "#/definitions/v1.MachineReservationResponse" + }, + "type": "array" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "#/definitions/httperrors.HTTPErrorResponse" + } + } + }, + "summary": "get all machine reservations", + "tags": [ + "project" + ] + } + }, + "/v1/project/reservation/machine/usage": { + "post": { + "consumes": [ + "application/json" + ], + "operationId": "machineReservationsUsage", + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.MachineReservationFindRequest" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "items": { + "$ref": "#/definitions/v1.MachineReservationUsageResponse" + }, + "type": "array" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "#/definitions/httperrors.HTTPErrorResponse" + } + } + }, + "summary": "get usage of machine reservations", + "tags": [ + "project" + ] + } + }, + "/v1/project/reservation/machine/{id}": { + "delete": { + "consumes": [ + "application/json" + ], + "operationId": "deleteMachineReservation", + "parameters": [ + { + "description": "identifier of the machine reservation", + "in": "path", + "name": "id", + "required": true, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.MachineReservationResponse" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "#/definitions/httperrors.HTTPErrorResponse" + } + } + }, + "summary": "delete a machine reservation", + "tags": [ + "project" + ] + }, + "get": { + "consumes": [ + "application/json" + ], + "operationId": "getMachineReservation", + "parameters": [ + { + "description": "identifier of the machine reservation", + "in": "path", + "name": "id", + "required": true, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.MachineReservationResponse" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "#/definitions/httperrors.HTTPErrorResponse" + } + } + }, + "summary": "get a machine reservation", + "tags": [ + "project" + ] + } + }, "/v1/project/{id}": { "delete": { "consumes": [ diff --git a/go.mod b/go.mod index d8fada0..fed63ad 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/go-openapi/strfmt v0.23.0 github.com/go-openapi/swag v0.23.0 github.com/go-openapi/validate v0.24.0 + github.com/go-task/slim-sprig/v3 v3.0.0 github.com/metal-stack/metal-lib v0.18.2 github.com/metal-stack/security v0.8.1 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index 4d918be..a549e26 100644 --- a/go.sum +++ b/go.sum @@ -34,6 +34,8 @@ github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+Gr github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-openapi/validate v0.24.0 h1:LdfDKwNbpB6Vn40xhTdNZAnfLECL81w+VX3BumrGD58= github.com/go-openapi/validate v0.24.0/go.mod h1:iyeX1sEufmv3nPbBdX3ieNviWnOZaJ1+zquzJEf2BAQ= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= diff --git a/test/client/generate/generate_mock_client.go b/test/client/generate/generate_mock_client.go new file mode 100644 index 0000000..7f6ec61 --- /dev/null +++ b/test/client/generate/generate_mock_client.go @@ -0,0 +1,96 @@ +package main + +import ( + "bytes" + "fmt" + "go/ast" + "go/format" + "go/parser" + "go/token" + "os" + "text/template" + + _ "embed" + + sprig "github.com/go-task/slim-sprig/v3" +) + +//go:embed mock_client.tpl +var clientTpl string + +type services []service + +type service struct { + Name string +} + +func main() { + svcs, err := svcs() + if err != nil { + panic(err) + } + + err = writeTemplate("test/client/mock_client.go", clientTpl, svcs) + if err != nil { + panic(err) + } +} + +func svcs() (services, error) { + var ( + result = services{} + set = token.NewFileSet() + ) + + f, err := parser.ParseFile(set, "api/client/cloud_api_client.go", nil, parser.ParseComments) + if err != nil { + return nil, err + } + + for _, decl := range f.Decls { + if gen, isGen := decl.(*ast.GenDecl); isGen { + for _, spec := range gen.Specs { + if t, isType := spec.(*ast.TypeSpec); isType { + if t.Name.String() != "CloudAPI" { + continue + } + if s, isStruct := t.Type.(*ast.StructType); isStruct { + for _, m := range s.Fields.List { + for _, name := range m.Names { + if name.Name == "Transport" { + continue + } + result = append(result, service{ + Name: name.Name, + }) + } + } + } + } + } + } + } + + return result, nil +} + +func writeTemplate(dest, text string, data any) error { + t, err := template.New("").Funcs(sprig.FuncMap()).Parse(text) + if err != nil { + return err + } + + var buf bytes.Buffer + if err := t.Execute(&buf, data); err != nil { + return err + } + + p, err := format.Source(buf.Bytes()) + if err != nil { + return err + } + + fmt.Printf("writing to %s\n", dest) + + return os.WriteFile(dest, p, 0755) // nolint:gosec +} diff --git a/test/client/generate/mock_client.tpl b/test/client/generate/mock_client.tpl new file mode 100644 index 0000000..336e301 --- /dev/null +++ b/test/client/generate/mock_client.tpl @@ -0,0 +1,46 @@ +// Code generated by generate_mock_client.go. DO NOT EDIT. +package client + +import ( + "testing" + + cloudgo "github.com/fi-ts/cloud-go/api/client" + +{{ range $svc := . -}} + {{ $svc.Name | lower }}mocks "github.com/fi-ts/cloud-go/test/mocks/{{ $svc.Name | lower }}" +{{ end }} + + "github.com/stretchr/testify/mock" +) + +type CloudMockFns struct { +{{ range $svc := . -}} + {{ $svc.Name }} func(mock *mock.Mock) +{{ end }} +} + +func NewCloudMockClient(t *testing.T, mockFns *CloudMockFns) *cloudgo.CloudAPI { + var ( +{{ range $svc := . -}} + {{ $svc.Name | lower }} = {{ $svc.Name | lower }}mocks.NewClientService(t) +{{ end }} + ) + + client := &cloudgo.CloudAPI{ +{{ range $svc := . -}} + {{ $svc.Name }}: {{ $svc.Name | lower }}, +{{ end }} + } + + if mockFns == nil { + return client + } + +{{ range $svc := . -}} + if mockFns.{{ $svc.Name }} != nil { + mockFns.{{ $svc.Name }}(&{{ $svc.Name | lower }}.Mock) + } +{{ end }} + + return client +} diff --git a/test/client/mock_client.go b/test/client/mock_client.go new file mode 100755 index 0000000..ddd1f08 --- /dev/null +++ b/test/client/mock_client.go @@ -0,0 +1,113 @@ +// Code generated by generate_mock_client.go. DO NOT EDIT. +package client + +import ( + "testing" + + cloudgo "github.com/fi-ts/cloud-go/api/client" + + accountingmocks "github.com/fi-ts/cloud-go/test/mocks/accounting" + auditmocks "github.com/fi-ts/cloud-go/test/mocks/audit" + clustermocks "github.com/fi-ts/cloud-go/test/mocks/cluster" + databasemocks "github.com/fi-ts/cloud-go/test/mocks/database" + healthmocks "github.com/fi-ts/cloud-go/test/mocks/health" + ipmocks "github.com/fi-ts/cloud-go/test/mocks/ip" + masterdatamocks "github.com/fi-ts/cloud-go/test/mocks/masterdata" + projectmocks "github.com/fi-ts/cloud-go/test/mocks/project" + s3mocks "github.com/fi-ts/cloud-go/test/mocks/s3" + tenantmocks "github.com/fi-ts/cloud-go/test/mocks/tenant" + versionmocks "github.com/fi-ts/cloud-go/test/mocks/version" + volumemocks "github.com/fi-ts/cloud-go/test/mocks/volume" + + "github.com/stretchr/testify/mock" +) + +type CloudMockFns struct { + Accounting func(mock *mock.Mock) + Audit func(mock *mock.Mock) + Cluster func(mock *mock.Mock) + Database func(mock *mock.Mock) + Health func(mock *mock.Mock) + IP func(mock *mock.Mock) + Masterdata func(mock *mock.Mock) + Project func(mock *mock.Mock) + S3 func(mock *mock.Mock) + Tenant func(mock *mock.Mock) + Version func(mock *mock.Mock) + Volume func(mock *mock.Mock) +} + +func NewCloudMockClient(t *testing.T, mockFns *CloudMockFns) *cloudgo.CloudAPI { + var ( + accounting = accountingmocks.NewClientService(t) + audit = auditmocks.NewClientService(t) + cluster = clustermocks.NewClientService(t) + database = databasemocks.NewClientService(t) + health = healthmocks.NewClientService(t) + ip = ipmocks.NewClientService(t) + masterdata = masterdatamocks.NewClientService(t) + project = projectmocks.NewClientService(t) + s3 = s3mocks.NewClientService(t) + tenant = tenantmocks.NewClientService(t) + version = versionmocks.NewClientService(t) + volume = volumemocks.NewClientService(t) + ) + + client := &cloudgo.CloudAPI{ + Accounting: accounting, + Audit: audit, + Cluster: cluster, + Database: database, + Health: health, + IP: ip, + Masterdata: masterdata, + Project: project, + S3: s3, + Tenant: tenant, + Version: version, + Volume: volume, + } + + if mockFns == nil { + return client + } + + if mockFns.Accounting != nil { + mockFns.Accounting(&accounting.Mock) + } + if mockFns.Audit != nil { + mockFns.Audit(&audit.Mock) + } + if mockFns.Cluster != nil { + mockFns.Cluster(&cluster.Mock) + } + if mockFns.Database != nil { + mockFns.Database(&database.Mock) + } + if mockFns.Health != nil { + mockFns.Health(&health.Mock) + } + if mockFns.IP != nil { + mockFns.IP(&ip.Mock) + } + if mockFns.Masterdata != nil { + mockFns.Masterdata(&masterdata.Mock) + } + if mockFns.Project != nil { + mockFns.Project(&project.Mock) + } + if mockFns.S3 != nil { + mockFns.S3(&s3.Mock) + } + if mockFns.Tenant != nil { + mockFns.Tenant(&tenant.Mock) + } + if mockFns.Version != nil { + mockFns.Version(&version.Mock) + } + if mockFns.Volume != nil { + mockFns.Volume(&volume.Mock) + } + + return client +} diff --git a/test/mocks/accounting/ClientOption.go b/test/mocks/accounting/ClientOption.go index fb8db64..a17c234 100644 --- a/test/mocks/accounting/ClientOption.go +++ b/test/mocks/accounting/ClientOption.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package accounting diff --git a/test/mocks/accounting/ClientService.go b/test/mocks/accounting/ClientService.go index baa2829..265d28f 100644 --- a/test/mocks/accounting/ClientService.go +++ b/test/mocks/accounting/ClientService.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package accounting @@ -236,6 +236,43 @@ func (_m *ClientService) IPUsageCSV(params *clientaccounting.IPUsageCSVParams, a return r0, r1 } +// MachineReservationUsage provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) MachineReservationUsage(params *clientaccounting.MachineReservationUsageParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientaccounting.ClientOption) (*clientaccounting.MachineReservationUsageOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for MachineReservationUsage") + } + + var r0 *clientaccounting.MachineReservationUsageOK + var r1 error + if rf, ok := ret.Get(0).(func(*clientaccounting.MachineReservationUsageParams, runtime.ClientAuthInfoWriter, ...clientaccounting.ClientOption) (*clientaccounting.MachineReservationUsageOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*clientaccounting.MachineReservationUsageParams, runtime.ClientAuthInfoWriter, ...clientaccounting.ClientOption) *clientaccounting.MachineReservationUsageOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*clientaccounting.MachineReservationUsageOK) + } + } + + if rf, ok := ret.Get(1).(func(*clientaccounting.MachineReservationUsageParams, runtime.ClientAuthInfoWriter, ...clientaccounting.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // MachineUsage provides a mock function with given fields: params, authInfo, opts func (_m *ClientService) MachineUsage(params *clientaccounting.MachineUsageParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientaccounting.ClientOption) (*clientaccounting.MachineUsageOK, error) { _va := make([]interface{}, len(opts)) diff --git a/test/mocks/audit/ClientOption.go b/test/mocks/audit/ClientOption.go index d4f0f9f..6cd2831 100644 --- a/test/mocks/audit/ClientOption.go +++ b/test/mocks/audit/ClientOption.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package audit diff --git a/test/mocks/audit/ClientService.go b/test/mocks/audit/ClientService.go index dbb70ad..b4d758c 100644 --- a/test/mocks/audit/ClientService.go +++ b/test/mocks/audit/ClientService.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package audit diff --git a/test/mocks/cluster/ClientOption.go b/test/mocks/cluster/ClientOption.go index 81a1fc1..d6e516c 100644 --- a/test/mocks/cluster/ClientOption.go +++ b/test/mocks/cluster/ClientOption.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package cluster diff --git a/test/mocks/cluster/ClientService.go b/test/mocks/cluster/ClientService.go index 9786028..5e22b0d 100644 --- a/test/mocks/cluster/ClientService.go +++ b/test/mocks/cluster/ClientService.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package cluster diff --git a/test/mocks/database/ClientOption.go b/test/mocks/database/ClientOption.go index f92da6b..fe75aa6 100644 --- a/test/mocks/database/ClientOption.go +++ b/test/mocks/database/ClientOption.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package database diff --git a/test/mocks/database/ClientService.go b/test/mocks/database/ClientService.go index fd592a5..cc8dfd3 100644 --- a/test/mocks/database/ClientService.go +++ b/test/mocks/database/ClientService.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package database diff --git a/test/mocks/health/ClientOption.go b/test/mocks/health/ClientOption.go index d0e092e..f0ede39 100644 --- a/test/mocks/health/ClientOption.go +++ b/test/mocks/health/ClientOption.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package health diff --git a/test/mocks/health/ClientService.go b/test/mocks/health/ClientService.go index 278dad7..cb3e5e2 100644 --- a/test/mocks/health/ClientService.go +++ b/test/mocks/health/ClientService.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package health diff --git a/test/mocks/ip/ClientOption.go b/test/mocks/ip/ClientOption.go index 87fd998..8612eec 100644 --- a/test/mocks/ip/ClientOption.go +++ b/test/mocks/ip/ClientOption.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package ip diff --git a/test/mocks/ip/ClientService.go b/test/mocks/ip/ClientService.go index 2b4cb59..f1dd355 100644 --- a/test/mocks/ip/ClientService.go +++ b/test/mocks/ip/ClientService.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package ip diff --git a/test/mocks/masterdata/ClientOption.go b/test/mocks/masterdata/ClientOption.go index ae33817..b30a373 100644 --- a/test/mocks/masterdata/ClientOption.go +++ b/test/mocks/masterdata/ClientOption.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package masterdata diff --git a/test/mocks/masterdata/ClientService.go b/test/mocks/masterdata/ClientService.go index b70f3c6..a0e8ddc 100644 --- a/test/mocks/masterdata/ClientService.go +++ b/test/mocks/masterdata/ClientService.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package masterdata diff --git a/test/mocks/project/ClientOption.go b/test/mocks/project/ClientOption.go index 69265d1..5719dc5 100644 --- a/test/mocks/project/ClientOption.go +++ b/test/mocks/project/ClientOption.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package project diff --git a/test/mocks/project/ClientService.go b/test/mocks/project/ClientService.go index b20e716..2bf1eac 100644 --- a/test/mocks/project/ClientService.go +++ b/test/mocks/project/ClientService.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package project @@ -14,6 +14,43 @@ type ClientService struct { mock.Mock } +// CreateMachineReservation provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) CreateMachineReservation(params *clientproject.CreateMachineReservationParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientproject.ClientOption) (*clientproject.CreateMachineReservationCreated, 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...) + + if len(ret) == 0 { + panic("no return value specified for CreateMachineReservation") + } + + var r0 *clientproject.CreateMachineReservationCreated + var r1 error + if rf, ok := ret.Get(0).(func(*clientproject.CreateMachineReservationParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) (*clientproject.CreateMachineReservationCreated, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*clientproject.CreateMachineReservationParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) *clientproject.CreateMachineReservationCreated); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*clientproject.CreateMachineReservationCreated) + } + } + + if rf, ok := ret.Get(1).(func(*clientproject.CreateMachineReservationParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // CreateProject provides a mock function with given fields: params, authInfo, opts func (_m *ClientService) CreateProject(params *clientproject.CreateProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientproject.ClientOption) (*clientproject.CreateProjectCreated, error) { _va := make([]interface{}, len(opts)) @@ -51,6 +88,43 @@ func (_m *ClientService) CreateProject(params *clientproject.CreateProjectParams return r0, r1 } +// DeleteMachineReservation provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) DeleteMachineReservation(params *clientproject.DeleteMachineReservationParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientproject.ClientOption) (*clientproject.DeleteMachineReservationOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for DeleteMachineReservation") + } + + var r0 *clientproject.DeleteMachineReservationOK + var r1 error + if rf, ok := ret.Get(0).(func(*clientproject.DeleteMachineReservationParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) (*clientproject.DeleteMachineReservationOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*clientproject.DeleteMachineReservationParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) *clientproject.DeleteMachineReservationOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*clientproject.DeleteMachineReservationOK) + } + } + + if rf, ok := ret.Get(1).(func(*clientproject.DeleteMachineReservationParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // DeleteProject provides a mock function with given fields: params, authInfo, opts func (_m *ClientService) DeleteProject(params *clientproject.DeleteProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientproject.ClientOption) (*clientproject.DeleteProjectOK, error) { _va := make([]interface{}, len(opts)) @@ -162,6 +236,80 @@ func (_m *ClientService) FindProjects(params *clientproject.FindProjectsParams, return r0, r1 } +// GetMachineReservation provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) GetMachineReservation(params *clientproject.GetMachineReservationParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientproject.ClientOption) (*clientproject.GetMachineReservationOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for GetMachineReservation") + } + + var r0 *clientproject.GetMachineReservationOK + var r1 error + if rf, ok := ret.Get(0).(func(*clientproject.GetMachineReservationParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) (*clientproject.GetMachineReservationOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*clientproject.GetMachineReservationParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) *clientproject.GetMachineReservationOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*clientproject.GetMachineReservationOK) + } + } + + if rf, ok := ret.Get(1).(func(*clientproject.GetMachineReservationParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ListMachineReservations provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) ListMachineReservations(params *clientproject.ListMachineReservationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientproject.ClientOption) (*clientproject.ListMachineReservationsOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for ListMachineReservations") + } + + var r0 *clientproject.ListMachineReservationsOK + var r1 error + if rf, ok := ret.Get(0).(func(*clientproject.ListMachineReservationsParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) (*clientproject.ListMachineReservationsOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*clientproject.ListMachineReservationsParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) *clientproject.ListMachineReservationsOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*clientproject.ListMachineReservationsOK) + } + } + + if rf, ok := ret.Get(1).(func(*clientproject.ListMachineReservationsParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ListProjects provides a mock function with given fields: params, authInfo, opts func (_m *ClientService) ListProjects(params *clientproject.ListProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientproject.ClientOption) (*clientproject.ListProjectsOK, error) { _va := make([]interface{}, len(opts)) @@ -199,11 +347,85 @@ func (_m *ClientService) ListProjects(params *clientproject.ListProjectsParams, return r0, r1 } +// MachineReservationsUsage provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) MachineReservationsUsage(params *clientproject.MachineReservationsUsageParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientproject.ClientOption) (*clientproject.MachineReservationsUsageOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for MachineReservationsUsage") + } + + var r0 *clientproject.MachineReservationsUsageOK + var r1 error + if rf, ok := ret.Get(0).(func(*clientproject.MachineReservationsUsageParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) (*clientproject.MachineReservationsUsageOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*clientproject.MachineReservationsUsageParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) *clientproject.MachineReservationsUsageOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*clientproject.MachineReservationsUsageOK) + } + } + + if rf, ok := ret.Get(1).(func(*clientproject.MachineReservationsUsageParams, runtime.ClientAuthInfoWriter, ...clientproject.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) } +// UpdateMachineReservation provides a mock function with given fields: params, authInfo, opts +func (_m *ClientService) UpdateMachineReservation(params *clientproject.UpdateMachineReservationParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientproject.ClientOption) (*clientproject.UpdateMachineReservationOK, 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...) + + if len(ret) == 0 { + panic("no return value specified for UpdateMachineReservation") + } + + var r0 *clientproject.UpdateMachineReservationOK + var r1 error + if rf, ok := ret.Get(0).(func(*clientproject.UpdateMachineReservationParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) (*clientproject.UpdateMachineReservationOK, error)); ok { + return rf(params, authInfo, opts...) + } + if rf, ok := ret.Get(0).(func(*clientproject.UpdateMachineReservationParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) *clientproject.UpdateMachineReservationOK); ok { + r0 = rf(params, authInfo, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*clientproject.UpdateMachineReservationOK) + } + } + + if rf, ok := ret.Get(1).(func(*clientproject.UpdateMachineReservationParams, runtime.ClientAuthInfoWriter, ...clientproject.ClientOption) error); ok { + r1 = rf(params, authInfo, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // UpdateProject provides a mock function with given fields: params, authInfo, opts func (_m *ClientService) UpdateProject(params *clientproject.UpdateProjectParams, authInfo runtime.ClientAuthInfoWriter, opts ...clientproject.ClientOption) (*clientproject.UpdateProjectOK, error) { _va := make([]interface{}, len(opts)) diff --git a/test/mocks/s3/ClientOption.go b/test/mocks/s3/ClientOption.go index e609c17..8a0575c 100644 --- a/test/mocks/s3/ClientOption.go +++ b/test/mocks/s3/ClientOption.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package s3 diff --git a/test/mocks/s3/ClientService.go b/test/mocks/s3/ClientService.go index 8605f98..e999adc 100644 --- a/test/mocks/s3/ClientService.go +++ b/test/mocks/s3/ClientService.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package s3 diff --git a/test/mocks/tenant/ClientOption.go b/test/mocks/tenant/ClientOption.go index 881ba7e..7cc5a43 100644 --- a/test/mocks/tenant/ClientOption.go +++ b/test/mocks/tenant/ClientOption.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package tenant diff --git a/test/mocks/tenant/ClientService.go b/test/mocks/tenant/ClientService.go index 9dab318..ee27353 100644 --- a/test/mocks/tenant/ClientService.go +++ b/test/mocks/tenant/ClientService.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package tenant diff --git a/test/mocks/version/ClientOption.go b/test/mocks/version/ClientOption.go index fabb43c..0e09b8c 100644 --- a/test/mocks/version/ClientOption.go +++ b/test/mocks/version/ClientOption.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package version diff --git a/test/mocks/version/ClientService.go b/test/mocks/version/ClientService.go index c971be3..e821c7d 100644 --- a/test/mocks/version/ClientService.go +++ b/test/mocks/version/ClientService.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package version diff --git a/test/mocks/volume/ClientOption.go b/test/mocks/volume/ClientOption.go index a112b7e..730f4dd 100644 --- a/test/mocks/volume/ClientOption.go +++ b/test/mocks/volume/ClientOption.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package volume diff --git a/test/mocks/volume/ClientService.go b/test/mocks/volume/ClientService.go index 1177ca4..caf1f9c 100644 --- a/test/mocks/volume/ClientService.go +++ b/test/mocks/volume/ClientService.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.45.1. DO NOT EDIT. +// Code generated by mockery v2.46.1. DO NOT EDIT. package volume