From 58912161793ef2405a95277fec8a9f3817911377 Mon Sep 17 00:00:00 2001 From: Ionut Balutoiu Date: Wed, 5 Jul 2023 13:20:01 +0300 Subject: [PATCH] Update generated swagger client code Signed-off-by: Ionut Balutoiu --- apiserver/swagger.yaml | 293 +++++++++++++++- client/garm_api_client.go | 5 + .../instances/delete_instance_parameters.go | 151 ++++++++ client/instances/delete_instance_responses.go | 103 ++++++ client/instances/get_instance_parameters.go | 151 ++++++++ client/instances/get_instance_responses.go | 179 ++++++++++ client/instances/instances_client.go | 148 ++++++++ client/instances/list_instances_parameters.go | 128 +++++++ client/instances/list_instances_responses.go | 179 ++++++++++ client/repositories/create_parameters.go | 151 -------- client/repositories/create_repo_parameters.go | 151 ++++++++ .../create_repo_pool_parameters.go | 173 +++++++++ .../create_repo_pool_responses.go | 179 ++++++++++ client/repositories/create_repo_responses.go | 179 ++++++++++ client/repositories/create_responses.go | 179 ---------- client/repositories/delete_parameters.go | 151 -------- client/repositories/delete_repo_parameters.go | 151 ++++++++ .../delete_repo_pool_parameters.go | 173 +++++++++ .../delete_repo_pool_responses.go | 103 ++++++ client/repositories/delete_repo_responses.go | 103 ++++++ client/repositories/delete_responses.go | 103 ------ client/repositories/get_parameters.go | 151 -------- client/repositories/get_repo_parameters.go | 151 ++++++++ .../repositories/get_repo_pool_parameters.go | 173 +++++++++ .../repositories/get_repo_pool_responses.go | 179 ++++++++++ client/repositories/get_repo_responses.go | 179 ++++++++++ client/repositories/get_responses.go | 179 ---------- client/repositories/list_parameters.go | 128 ------- .../list_repo_instances_parameters.go | 151 ++++++++ .../list_repo_instances_responses.go | 179 ++++++++++ .../list_repo_pools_parameters.go | 151 ++++++++ .../repositories/list_repo_pools_responses.go | 179 ++++++++++ client/repositories/list_repos_parameters.go | 128 +++++++ client/repositories/list_repos_responses.go | 179 ++++++++++ client/repositories/list_responses.go | 179 ---------- client/repositories/repositories_client.go | 327 ++++++++++++++++-- client/repositories/update_repo_parameters.go | 173 +++++++++ .../update_repo_pool_parameters.go | 195 +++++++++++ .../update_repo_pool_responses.go | 179 ++++++++++ client/repositories/update_repo_responses.go | 179 ++++++++++ 40 files changed, 5217 insertions(+), 1255 deletions(-) create mode 100644 client/instances/delete_instance_parameters.go create mode 100644 client/instances/delete_instance_responses.go create mode 100644 client/instances/get_instance_parameters.go create mode 100644 client/instances/get_instance_responses.go create mode 100644 client/instances/instances_client.go create mode 100644 client/instances/list_instances_parameters.go create mode 100644 client/instances/list_instances_responses.go delete mode 100644 client/repositories/create_parameters.go create mode 100644 client/repositories/create_repo_parameters.go create mode 100644 client/repositories/create_repo_pool_parameters.go create mode 100644 client/repositories/create_repo_pool_responses.go create mode 100644 client/repositories/create_repo_responses.go delete mode 100644 client/repositories/create_responses.go delete mode 100644 client/repositories/delete_parameters.go create mode 100644 client/repositories/delete_repo_parameters.go create mode 100644 client/repositories/delete_repo_pool_parameters.go create mode 100644 client/repositories/delete_repo_pool_responses.go create mode 100644 client/repositories/delete_repo_responses.go delete mode 100644 client/repositories/delete_responses.go delete mode 100644 client/repositories/get_parameters.go create mode 100644 client/repositories/get_repo_parameters.go create mode 100644 client/repositories/get_repo_pool_parameters.go create mode 100644 client/repositories/get_repo_pool_responses.go create mode 100644 client/repositories/get_repo_responses.go delete mode 100644 client/repositories/get_responses.go delete mode 100644 client/repositories/list_parameters.go create mode 100644 client/repositories/list_repo_instances_parameters.go create mode 100644 client/repositories/list_repo_instances_responses.go create mode 100644 client/repositories/list_repo_pools_parameters.go create mode 100644 client/repositories/list_repo_pools_responses.go create mode 100644 client/repositories/list_repos_parameters.go create mode 100644 client/repositories/list_repos_responses.go delete mode 100644 client/repositories/list_responses.go create mode 100644 client/repositories/update_repo_parameters.go create mode 100644 client/repositories/update_repo_pool_parameters.go create mode 100644 client/repositories/update_repo_pool_responses.go create mode 100644 client/repositories/update_repo_responses.go diff --git a/apiserver/swagger.yaml b/apiserver/swagger.yaml index 35ac4f59..5432d201 100644 --- a/apiserver/swagger.yaml +++ b/apiserver/swagger.yaml @@ -7,6 +7,13 @@ definitions: alias: apiserver_params package: github.com/cloudbase/garm/apiserver/params type: APIErrorResponse + CreatePoolParams: + type: object + x-go-type: + import: + alias: garm_params + package: github.com/cloudbase/garm/params + type: CreatePoolParams CreateRepoParams: type: object x-go-type: @@ -14,6 +21,34 @@ definitions: alias: garm_params package: github.com/cloudbase/garm/params type: CreateRepoParams + Instance: + type: object + x-go-type: + import: + alias: garm_params + package: github.com/cloudbase/garm/params + type: Instance + Instances: + type: object + x-go-type: + import: + alias: garm_params + package: github.com/cloudbase/garm/params + type: Instances + Pool: + type: object + x-go-type: + import: + alias: garm_params + package: github.com/cloudbase/garm/params + type: Pool + Pools: + type: object + x-go-type: + import: + alias: garm_params + package: github.com/cloudbase/garm/params + type: Pools Repositories: items: $ref: '#/definitions/Repository' @@ -30,6 +65,20 @@ definitions: alias: garm_params package: github.com/cloudbase/garm/params type: Repository + UpdateEntityParams: + type: object + x-go-type: + import: + alias: garm_params + package: github.com/cloudbase/garm/params + type: UpdateEntityParams + UpdatePoolParams: + type: object + x-go-type: + import: + alias: garm_params + package: github.com/cloudbase/garm/params + type: UpdatePoolParams info: description: The Garm API generated using go-swagger. license: @@ -38,9 +87,61 @@ info: title: Garm API. version: 1.0.0 paths: + /instances: + get: + operationId: ListInstances + responses: + "200": + description: Instances + schema: + $ref: '#/definitions/Instances' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Get all runners' instances. + tags: + - instances + /instances/{instanceName}: + delete: + operationId: DeleteInstance + parameters: + - description: Runner instance name. + in: path + name: instanceName + required: true + type: string + responses: + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Delete runner instance by name. + tags: + - instances + get: + operationId: GetInstance + parameters: + - description: Runner instance name. + in: path + name: instanceName + required: true + type: string + responses: + "200": + description: Instance + schema: + $ref: '#/definitions/Instance' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Get runner instance by name. + tags: + - instances /repositories: get: - operationId: List + operationId: ListRepos responses: "200": description: Repositories @@ -54,7 +155,7 @@ paths: tags: - repositories post: - operationId: Create + operationId: CreateRepo parameters: - description: Parameters used when creating the repository. in: body @@ -78,7 +179,7 @@ paths: - repositories /repositories/{repoID}: delete: - operationId: Delete + operationId: DeleteRepo parameters: - description: ID of the repository to delete. in: path @@ -94,7 +195,7 @@ paths: tags: - repositories get: - operationId: Get + operationId: GetRepo parameters: - description: ID of the repository to fetch. in: path @@ -113,4 +214,188 @@ paths: summary: Get repository by ID. tags: - repositories + put: + operationId: UpdateRepo + parameters: + - description: ID of the repository to update. + in: path + name: repoID + required: true + type: string + - description: Parameters used when updating the repository. + in: body + name: Body + required: true + schema: + $ref: '#/definitions/UpdateEntityParams' + description: Parameters used when updating the repository. + type: object + responses: + "200": + description: Repository + schema: + $ref: '#/definitions/Repository' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Update repository with the parameters given. + tags: + - repositories + /repositories/{repoID}/instances: + get: + operationId: ListRepoInstances + parameters: + - description: Repository ID. + in: path + name: repoID + required: true + type: string + responses: + "200": + description: Instances + schema: + $ref: '#/definitions/Instances' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: List repository instances. + tags: + - repositories + - instances + /repositories/{repoID}/pools: + get: + operationId: ListRepoPools + parameters: + - description: Repository ID. + in: path + name: repoID + required: true + type: string + responses: + "200": + description: Pools + schema: + $ref: '#/definitions/Pools' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: List repository pools. + tags: + - repositories + - pools + post: + operationId: CreateRepoPool + parameters: + - description: Repository ID. + in: path + name: repoID + required: true + type: string + - description: Parameters used when creating the repository pool. + in: body + name: Body + required: true + schema: + $ref: '#/definitions/CreatePoolParams' + description: Parameters used when creating the repository pool. + type: object + responses: + "200": + description: Pool + schema: + $ref: '#/definitions/Pool' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Create repository pool with the parameters given. + tags: + - repositories + - pools + /repositories/{repoID}/pools/{poolID}: + delete: + operationId: DeleteRepoPool + parameters: + - description: Repository ID. + in: path + name: repoID + required: true + type: string + - description: ID of the repository pool to delete. + in: path + name: poolID + required: true + type: string + responses: + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Delete repository pool by ID. + tags: + - repositories + - pools + get: + operationId: GetRepoPool + parameters: + - description: Repository ID. + in: path + name: repoID + required: true + type: string + - description: Pool ID. + in: path + name: poolID + required: true + type: string + responses: + "200": + description: Pool + schema: + $ref: '#/definitions/Pool' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Get repository pool by ID. + tags: + - repositories + - pools + put: + operationId: UpdateRepoPool + parameters: + - description: Repository ID. + in: path + name: repoID + required: true + type: string + - description: ID of the repository pool to update. + in: path + name: poolID + required: true + type: string + - description: Parameters used when updating the repository pool. + in: body + name: Body + required: true + schema: + $ref: '#/definitions/UpdatePoolParams' + description: Parameters used when updating the repository pool. + type: object + responses: + "200": + description: Pool + schema: + $ref: '#/definitions/Pool' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Update repository pool with the parameters given. + tags: + - repositories + - pools swagger: "2.0" diff --git a/client/garm_api_client.go b/client/garm_api_client.go index 1cd832e7..eec535d5 100644 --- a/client/garm_api_client.go +++ b/client/garm_api_client.go @@ -10,6 +10,7 @@ import ( httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + "github.com/cloudbase/garm/client/instances" "github.com/cloudbase/garm/client/repositories" ) @@ -55,6 +56,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *GarmAPI { cli := new(GarmAPI) cli.Transport = transport + cli.Instances = instances.New(transport, formats) cli.Repositories = repositories.New(transport, formats) return cli } @@ -100,6 +102,8 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { // GarmAPI is a client for garm API type GarmAPI struct { + Instances instances.ClientService + Repositories repositories.ClientService Transport runtime.ClientTransport @@ -108,5 +112,6 @@ type GarmAPI struct { // SetTransport changes the transport on the client and all its subresources func (c *GarmAPI) SetTransport(transport runtime.ClientTransport) { c.Transport = transport + c.Instances.SetTransport(transport) c.Repositories.SetTransport(transport) } diff --git a/client/instances/delete_instance_parameters.go b/client/instances/delete_instance_parameters.go new file mode 100644 index 00000000..34cb6eee --- /dev/null +++ b/client/instances/delete_instance_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instances + +// 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" +) + +// NewDeleteInstanceParams creates a new DeleteInstanceParams 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 NewDeleteInstanceParams() *DeleteInstanceParams { + return &DeleteInstanceParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteInstanceParamsWithTimeout creates a new DeleteInstanceParams object +// with the ability to set a timeout on a request. +func NewDeleteInstanceParamsWithTimeout(timeout time.Duration) *DeleteInstanceParams { + return &DeleteInstanceParams{ + timeout: timeout, + } +} + +// NewDeleteInstanceParamsWithContext creates a new DeleteInstanceParams object +// with the ability to set a context for a request. +func NewDeleteInstanceParamsWithContext(ctx context.Context) *DeleteInstanceParams { + return &DeleteInstanceParams{ + Context: ctx, + } +} + +// NewDeleteInstanceParamsWithHTTPClient creates a new DeleteInstanceParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteInstanceParamsWithHTTPClient(client *http.Client) *DeleteInstanceParams { + return &DeleteInstanceParams{ + HTTPClient: client, + } +} + +/* +DeleteInstanceParams contains all the parameters to send to the API endpoint + + for the delete instance operation. + + Typically these are written to a http.Request. +*/ +type DeleteInstanceParams struct { + + /* InstanceName. + + Runner instance name. + */ + InstanceName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete instance params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteInstanceParams) WithDefaults() *DeleteInstanceParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete instance params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteInstanceParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete instance params +func (o *DeleteInstanceParams) WithTimeout(timeout time.Duration) *DeleteInstanceParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete instance params +func (o *DeleteInstanceParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete instance params +func (o *DeleteInstanceParams) WithContext(ctx context.Context) *DeleteInstanceParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete instance params +func (o *DeleteInstanceParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete instance params +func (o *DeleteInstanceParams) WithHTTPClient(client *http.Client) *DeleteInstanceParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete instance params +func (o *DeleteInstanceParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithInstanceName adds the instanceName to the delete instance params +func (o *DeleteInstanceParams) WithInstanceName(instanceName string) *DeleteInstanceParams { + o.SetInstanceName(instanceName) + return o +} + +// SetInstanceName adds the instanceName to the delete instance params +func (o *DeleteInstanceParams) SetInstanceName(instanceName string) { + o.InstanceName = instanceName +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteInstanceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param instanceName + if err := r.SetPathParam("instanceName", o.InstanceName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/instances/delete_instance_responses.go b/client/instances/delete_instance_responses.go new file mode 100644 index 00000000..6779c44e --- /dev/null +++ b/client/instances/delete_instance_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" +) + +// DeleteInstanceReader is a Reader for the DeleteInstance structure. +type DeleteInstanceReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteInstanceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + result := NewDeleteInstanceDefault(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 +} + +// NewDeleteInstanceDefault creates a DeleteInstanceDefault with default headers values +func NewDeleteInstanceDefault(code int) *DeleteInstanceDefault { + return &DeleteInstanceDefault{ + _statusCode: code, + } +} + +/* +DeleteInstanceDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type DeleteInstanceDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this delete instance default response has a 2xx status code +func (o *DeleteInstanceDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this delete instance default response has a 3xx status code +func (o *DeleteInstanceDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this delete instance default response has a 4xx status code +func (o *DeleteInstanceDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this delete instance default response has a 5xx status code +func (o *DeleteInstanceDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this delete instance default response a status code equal to that given +func (o *DeleteInstanceDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the delete instance default response +func (o *DeleteInstanceDefault) Code() int { + return o._statusCode +} + +func (o *DeleteInstanceDefault) Error() string { + return fmt.Sprintf("[DELETE /instances/{instanceName}][%d] DeleteInstance default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteInstanceDefault) String() string { + return fmt.Sprintf("[DELETE /instances/{instanceName}][%d] DeleteInstance default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteInstanceDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *DeleteInstanceDefault) 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 +} diff --git a/client/instances/get_instance_parameters.go b/client/instances/get_instance_parameters.go new file mode 100644 index 00000000..6d9e770b --- /dev/null +++ b/client/instances/get_instance_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instances + +// 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" +) + +// NewGetInstanceParams creates a new GetInstanceParams 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 NewGetInstanceParams() *GetInstanceParams { + return &GetInstanceParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetInstanceParamsWithTimeout creates a new GetInstanceParams object +// with the ability to set a timeout on a request. +func NewGetInstanceParamsWithTimeout(timeout time.Duration) *GetInstanceParams { + return &GetInstanceParams{ + timeout: timeout, + } +} + +// NewGetInstanceParamsWithContext creates a new GetInstanceParams object +// with the ability to set a context for a request. +func NewGetInstanceParamsWithContext(ctx context.Context) *GetInstanceParams { + return &GetInstanceParams{ + Context: ctx, + } +} + +// NewGetInstanceParamsWithHTTPClient creates a new GetInstanceParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetInstanceParamsWithHTTPClient(client *http.Client) *GetInstanceParams { + return &GetInstanceParams{ + HTTPClient: client, + } +} + +/* +GetInstanceParams contains all the parameters to send to the API endpoint + + for the get instance operation. + + Typically these are written to a http.Request. +*/ +type GetInstanceParams struct { + + /* InstanceName. + + Runner instance name. + */ + InstanceName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get instance params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetInstanceParams) WithDefaults() *GetInstanceParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get instance params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetInstanceParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get instance params +func (o *GetInstanceParams) WithTimeout(timeout time.Duration) *GetInstanceParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get instance params +func (o *GetInstanceParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get instance params +func (o *GetInstanceParams) WithContext(ctx context.Context) *GetInstanceParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get instance params +func (o *GetInstanceParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get instance params +func (o *GetInstanceParams) WithHTTPClient(client *http.Client) *GetInstanceParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get instance params +func (o *GetInstanceParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithInstanceName adds the instanceName to the get instance params +func (o *GetInstanceParams) WithInstanceName(instanceName string) *GetInstanceParams { + o.SetInstanceName(instanceName) + return o +} + +// SetInstanceName adds the instanceName to the get instance params +func (o *GetInstanceParams) SetInstanceName(instanceName string) { + o.InstanceName = instanceName +} + +// WriteToRequest writes these params to a swagger request +func (o *GetInstanceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param instanceName + if err := r.SetPathParam("instanceName", o.InstanceName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/instances/get_instance_responses.go b/client/instances/get_instance_responses.go new file mode 100644 index 00000000..3f26f1f8 --- /dev/null +++ b/client/instances/get_instance_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" + garm_params "github.com/cloudbase/garm/params" +) + +// GetInstanceReader is a Reader for the GetInstance structure. +type GetInstanceReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetInstanceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetInstanceOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetInstanceDefault(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 + } +} + +// NewGetInstanceOK creates a GetInstanceOK with default headers values +func NewGetInstanceOK() *GetInstanceOK { + return &GetInstanceOK{} +} + +/* +GetInstanceOK describes a response with status code 200, with default header values. + +Instance +*/ +type GetInstanceOK struct { + Payload garm_params.Instance +} + +// IsSuccess returns true when this get instance o k response has a 2xx status code +func (o *GetInstanceOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get instance o k response has a 3xx status code +func (o *GetInstanceOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get instance o k response has a 4xx status code +func (o *GetInstanceOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get instance o k response has a 5xx status code +func (o *GetInstanceOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get instance o k response a status code equal to that given +func (o *GetInstanceOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get instance o k response +func (o *GetInstanceOK) Code() int { + return 200 +} + +func (o *GetInstanceOK) Error() string { + return fmt.Sprintf("[GET /instances/{instanceName}][%d] getInstanceOK %+v", 200, o.Payload) +} + +func (o *GetInstanceOK) String() string { + return fmt.Sprintf("[GET /instances/{instanceName}][%d] getInstanceOK %+v", 200, o.Payload) +} + +func (o *GetInstanceOK) GetPayload() garm_params.Instance { + return o.Payload +} + +func (o *GetInstanceOK) 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 +} + +// NewGetInstanceDefault creates a GetInstanceDefault with default headers values +func NewGetInstanceDefault(code int) *GetInstanceDefault { + return &GetInstanceDefault{ + _statusCode: code, + } +} + +/* +GetInstanceDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type GetInstanceDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this get instance default response has a 2xx status code +func (o *GetInstanceDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get instance default response has a 3xx status code +func (o *GetInstanceDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get instance default response has a 4xx status code +func (o *GetInstanceDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get instance default response has a 5xx status code +func (o *GetInstanceDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get instance default response a status code equal to that given +func (o *GetInstanceDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get instance default response +func (o *GetInstanceDefault) Code() int { + return o._statusCode +} + +func (o *GetInstanceDefault) Error() string { + return fmt.Sprintf("[GET /instances/{instanceName}][%d] GetInstance default %+v", o._statusCode, o.Payload) +} + +func (o *GetInstanceDefault) String() string { + return fmt.Sprintf("[GET /instances/{instanceName}][%d] GetInstance default %+v", o._statusCode, o.Payload) +} + +func (o *GetInstanceDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *GetInstanceDefault) 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 +} diff --git a/client/instances/instances_client.go b/client/instances/instances_client.go new file mode 100644 index 00000000..223f1bcc --- /dev/null +++ b/client/instances/instances_client.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new instances API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for instances API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteInstance(params *DeleteInstanceParams, opts ...ClientOption) error + + GetInstance(params *GetInstanceParams, opts ...ClientOption) (*GetInstanceOK, error) + + ListInstances(params *ListInstancesParams, opts ...ClientOption) (*ListInstancesOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteInstance deletes runner instance by name +*/ +func (a *Client) DeleteInstance(params *DeleteInstanceParams, opts ...ClientOption) error { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteInstanceParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteInstance", + Method: "DELETE", + PathPattern: "/instances/{instanceName}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteInstanceReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + _, err := a.transport.Submit(op) + if err != nil { + return err + } + return nil +} + +/* +GetInstance gets runner instance by name +*/ +func (a *Client) GetInstance(params *GetInstanceParams, opts ...ClientOption) (*GetInstanceOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetInstanceParams() + } + op := &runtime.ClientOperation{ + ID: "GetInstance", + Method: "GET", + PathPattern: "/instances/{instanceName}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetInstanceReader{formats: a.formats}, + 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.(*GetInstanceOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetInstanceDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListInstances gets all runners instances +*/ +func (a *Client) ListInstances(params *ListInstancesParams, opts ...ClientOption) (*ListInstancesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListInstancesParams() + } + op := &runtime.ClientOperation{ + ID: "ListInstances", + Method: "GET", + PathPattern: "/instances", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListInstancesReader{formats: a.formats}, + 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.(*ListInstancesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListInstancesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/instances/list_instances_parameters.go b/client/instances/list_instances_parameters.go new file mode 100644 index 00000000..1c84ec1f --- /dev/null +++ b/client/instances/list_instances_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instances + +// 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" +) + +// NewListInstancesParams creates a new ListInstancesParams 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 NewListInstancesParams() *ListInstancesParams { + return &ListInstancesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListInstancesParamsWithTimeout creates a new ListInstancesParams object +// with the ability to set a timeout on a request. +func NewListInstancesParamsWithTimeout(timeout time.Duration) *ListInstancesParams { + return &ListInstancesParams{ + timeout: timeout, + } +} + +// NewListInstancesParamsWithContext creates a new ListInstancesParams object +// with the ability to set a context for a request. +func NewListInstancesParamsWithContext(ctx context.Context) *ListInstancesParams { + return &ListInstancesParams{ + Context: ctx, + } +} + +// NewListInstancesParamsWithHTTPClient creates a new ListInstancesParams object +// with the ability to set a custom HTTPClient for a request. +func NewListInstancesParamsWithHTTPClient(client *http.Client) *ListInstancesParams { + return &ListInstancesParams{ + HTTPClient: client, + } +} + +/* +ListInstancesParams contains all the parameters to send to the API endpoint + + for the list instances operation. + + Typically these are written to a http.Request. +*/ +type ListInstancesParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list instances params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListInstancesParams) WithDefaults() *ListInstancesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list instances params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListInstancesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list instances params +func (o *ListInstancesParams) WithTimeout(timeout time.Duration) *ListInstancesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list instances params +func (o *ListInstancesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list instances params +func (o *ListInstancesParams) WithContext(ctx context.Context) *ListInstancesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list instances params +func (o *ListInstancesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list instances params +func (o *ListInstancesParams) WithHTTPClient(client *http.Client) *ListInstancesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list instances params +func (o *ListInstancesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ListInstancesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/instances/list_instances_responses.go b/client/instances/list_instances_responses.go new file mode 100644 index 00000000..5f9953cb --- /dev/null +++ b/client/instances/list_instances_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" + garm_params "github.com/cloudbase/garm/params" +) + +// ListInstancesReader is a Reader for the ListInstances structure. +type ListInstancesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListInstancesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListInstancesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListInstancesDefault(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 + } +} + +// NewListInstancesOK creates a ListInstancesOK with default headers values +func NewListInstancesOK() *ListInstancesOK { + return &ListInstancesOK{} +} + +/* +ListInstancesOK describes a response with status code 200, with default header values. + +Instances +*/ +type ListInstancesOK struct { + Payload garm_params.Instances +} + +// IsSuccess returns true when this list instances o k response has a 2xx status code +func (o *ListInstancesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list instances o k response has a 3xx status code +func (o *ListInstancesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list instances o k response has a 4xx status code +func (o *ListInstancesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list instances o k response has a 5xx status code +func (o *ListInstancesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list instances o k response a status code equal to that given +func (o *ListInstancesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list instances o k response +func (o *ListInstancesOK) Code() int { + return 200 +} + +func (o *ListInstancesOK) Error() string { + return fmt.Sprintf("[GET /instances][%d] listInstancesOK %+v", 200, o.Payload) +} + +func (o *ListInstancesOK) String() string { + return fmt.Sprintf("[GET /instances][%d] listInstancesOK %+v", 200, o.Payload) +} + +func (o *ListInstancesOK) GetPayload() garm_params.Instances { + return o.Payload +} + +func (o *ListInstancesOK) 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 +} + +// NewListInstancesDefault creates a ListInstancesDefault with default headers values +func NewListInstancesDefault(code int) *ListInstancesDefault { + return &ListInstancesDefault{ + _statusCode: code, + } +} + +/* +ListInstancesDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type ListInstancesDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this list instances default response has a 2xx status code +func (o *ListInstancesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list instances default response has a 3xx status code +func (o *ListInstancesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list instances default response has a 4xx status code +func (o *ListInstancesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list instances default response has a 5xx status code +func (o *ListInstancesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list instances default response a status code equal to that given +func (o *ListInstancesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list instances default response +func (o *ListInstancesDefault) Code() int { + return o._statusCode +} + +func (o *ListInstancesDefault) Error() string { + return fmt.Sprintf("[GET /instances][%d] ListInstances default %+v", o._statusCode, o.Payload) +} + +func (o *ListInstancesDefault) String() string { + return fmt.Sprintf("[GET /instances][%d] ListInstances default %+v", o._statusCode, o.Payload) +} + +func (o *ListInstancesDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *ListInstancesDefault) 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 +} diff --git a/client/repositories/create_parameters.go b/client/repositories/create_parameters.go deleted file mode 100644 index 366bbfe3..00000000 --- a/client/repositories/create_parameters.go +++ /dev/null @@ -1,151 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package repositories - -// 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" - - garm_params "github.com/cloudbase/garm/params" -) - -// NewCreateParams creates a new CreateParams 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 NewCreateParams() *CreateParams { - return &CreateParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewCreateParamsWithTimeout creates a new CreateParams object -// with the ability to set a timeout on a request. -func NewCreateParamsWithTimeout(timeout time.Duration) *CreateParams { - return &CreateParams{ - timeout: timeout, - } -} - -// NewCreateParamsWithContext creates a new CreateParams object -// with the ability to set a context for a request. -func NewCreateParamsWithContext(ctx context.Context) *CreateParams { - return &CreateParams{ - Context: ctx, - } -} - -// NewCreateParamsWithHTTPClient creates a new CreateParams object -// with the ability to set a custom HTTPClient for a request. -func NewCreateParamsWithHTTPClient(client *http.Client) *CreateParams { - return &CreateParams{ - HTTPClient: client, - } -} - -/* -CreateParams contains all the parameters to send to the API endpoint - - for the create operation. - - Typically these are written to a http.Request. -*/ -type CreateParams struct { - - /* Body. - - Parameters used when creating the repository. - */ - Body garm_params.CreateRepoParams - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the create params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *CreateParams) WithDefaults() *CreateParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the create params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *CreateParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the create params -func (o *CreateParams) WithTimeout(timeout time.Duration) *CreateParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the create params -func (o *CreateParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the create params -func (o *CreateParams) WithContext(ctx context.Context) *CreateParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the create params -func (o *CreateParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the create params -func (o *CreateParams) WithHTTPClient(client *http.Client) *CreateParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the create params -func (o *CreateParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the create params -func (o *CreateParams) WithBody(body garm_params.CreateRepoParams) *CreateParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the create params -func (o *CreateParams) SetBody(body garm_params.CreateRepoParams) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *CreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/client/repositories/create_repo_parameters.go b/client/repositories/create_repo_parameters.go new file mode 100644 index 00000000..56b22e09 --- /dev/null +++ b/client/repositories/create_repo_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// 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" + + garm_params "github.com/cloudbase/garm/params" +) + +// NewCreateRepoParams creates a new CreateRepoParams 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 NewCreateRepoParams() *CreateRepoParams { + return &CreateRepoParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCreateRepoParamsWithTimeout creates a new CreateRepoParams object +// with the ability to set a timeout on a request. +func NewCreateRepoParamsWithTimeout(timeout time.Duration) *CreateRepoParams { + return &CreateRepoParams{ + timeout: timeout, + } +} + +// NewCreateRepoParamsWithContext creates a new CreateRepoParams object +// with the ability to set a context for a request. +func NewCreateRepoParamsWithContext(ctx context.Context) *CreateRepoParams { + return &CreateRepoParams{ + Context: ctx, + } +} + +// NewCreateRepoParamsWithHTTPClient creates a new CreateRepoParams object +// with the ability to set a custom HTTPClient for a request. +func NewCreateRepoParamsWithHTTPClient(client *http.Client) *CreateRepoParams { + return &CreateRepoParams{ + HTTPClient: client, + } +} + +/* +CreateRepoParams contains all the parameters to send to the API endpoint + + for the create repo operation. + + Typically these are written to a http.Request. +*/ +type CreateRepoParams struct { + + /* Body. + + Parameters used when creating the repository. + */ + Body garm_params.CreateRepoParams + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the create repo params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateRepoParams) WithDefaults() *CreateRepoParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the create repo params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateRepoParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the create repo params +func (o *CreateRepoParams) WithTimeout(timeout time.Duration) *CreateRepoParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create repo params +func (o *CreateRepoParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create repo params +func (o *CreateRepoParams) WithContext(ctx context.Context) *CreateRepoParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create repo params +func (o *CreateRepoParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create repo params +func (o *CreateRepoParams) WithHTTPClient(client *http.Client) *CreateRepoParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create repo params +func (o *CreateRepoParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the create repo params +func (o *CreateRepoParams) WithBody(body garm_params.CreateRepoParams) *CreateRepoParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the create repo params +func (o *CreateRepoParams) SetBody(body garm_params.CreateRepoParams) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateRepoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/repositories/create_repo_pool_parameters.go b/client/repositories/create_repo_pool_parameters.go new file mode 100644 index 00000000..d4b7fa40 --- /dev/null +++ b/client/repositories/create_repo_pool_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// 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" + + garm_params "github.com/cloudbase/garm/params" +) + +// NewCreateRepoPoolParams creates a new CreateRepoPoolParams 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 NewCreateRepoPoolParams() *CreateRepoPoolParams { + return &CreateRepoPoolParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCreateRepoPoolParamsWithTimeout creates a new CreateRepoPoolParams object +// with the ability to set a timeout on a request. +func NewCreateRepoPoolParamsWithTimeout(timeout time.Duration) *CreateRepoPoolParams { + return &CreateRepoPoolParams{ + timeout: timeout, + } +} + +// NewCreateRepoPoolParamsWithContext creates a new CreateRepoPoolParams object +// with the ability to set a context for a request. +func NewCreateRepoPoolParamsWithContext(ctx context.Context) *CreateRepoPoolParams { + return &CreateRepoPoolParams{ + Context: ctx, + } +} + +// NewCreateRepoPoolParamsWithHTTPClient creates a new CreateRepoPoolParams object +// with the ability to set a custom HTTPClient for a request. +func NewCreateRepoPoolParamsWithHTTPClient(client *http.Client) *CreateRepoPoolParams { + return &CreateRepoPoolParams{ + HTTPClient: client, + } +} + +/* +CreateRepoPoolParams contains all the parameters to send to the API endpoint + + for the create repo pool operation. + + Typically these are written to a http.Request. +*/ +type CreateRepoPoolParams struct { + + /* Body. + + Parameters used when creating the repository pool. + */ + Body garm_params.CreatePoolParams + + /* RepoID. + + Repository ID. + */ + RepoID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the create repo pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateRepoPoolParams) WithDefaults() *CreateRepoPoolParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the create repo pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateRepoPoolParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the create repo pool params +func (o *CreateRepoPoolParams) WithTimeout(timeout time.Duration) *CreateRepoPoolParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create repo pool params +func (o *CreateRepoPoolParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create repo pool params +func (o *CreateRepoPoolParams) WithContext(ctx context.Context) *CreateRepoPoolParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create repo pool params +func (o *CreateRepoPoolParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create repo pool params +func (o *CreateRepoPoolParams) WithHTTPClient(client *http.Client) *CreateRepoPoolParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create repo pool params +func (o *CreateRepoPoolParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the create repo pool params +func (o *CreateRepoPoolParams) WithBody(body garm_params.CreatePoolParams) *CreateRepoPoolParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the create repo pool params +func (o *CreateRepoPoolParams) SetBody(body garm_params.CreatePoolParams) { + o.Body = body +} + +// WithRepoID adds the repoID to the create repo pool params +func (o *CreateRepoPoolParams) WithRepoID(repoID string) *CreateRepoPoolParams { + o.SetRepoID(repoID) + return o +} + +// SetRepoID adds the repoId to the create repo pool params +func (o *CreateRepoPoolParams) SetRepoID(repoID string) { + o.RepoID = repoID +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateRepoPoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param repoID + if err := r.SetPathParam("repoID", o.RepoID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/repositories/create_repo_pool_responses.go b/client/repositories/create_repo_pool_responses.go new file mode 100644 index 00000000..e366c67a --- /dev/null +++ b/client/repositories/create_repo_pool_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" + garm_params "github.com/cloudbase/garm/params" +) + +// CreateRepoPoolReader is a Reader for the CreateRepoPool structure. +type CreateRepoPoolReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateRepoPoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateRepoPoolOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewCreateRepoPoolDefault(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 + } +} + +// NewCreateRepoPoolOK creates a CreateRepoPoolOK with default headers values +func NewCreateRepoPoolOK() *CreateRepoPoolOK { + return &CreateRepoPoolOK{} +} + +/* +CreateRepoPoolOK describes a response with status code 200, with default header values. + +Pool +*/ +type CreateRepoPoolOK struct { + Payload garm_params.Pool +} + +// IsSuccess returns true when this create repo pool o k response has a 2xx status code +func (o *CreateRepoPoolOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this create repo pool o k response has a 3xx status code +func (o *CreateRepoPoolOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create repo pool o k response has a 4xx status code +func (o *CreateRepoPoolOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this create repo pool o k response has a 5xx status code +func (o *CreateRepoPoolOK) IsServerError() bool { + return false +} + +// IsCode returns true when this create repo pool o k response a status code equal to that given +func (o *CreateRepoPoolOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the create repo pool o k response +func (o *CreateRepoPoolOK) Code() int { + return 200 +} + +func (o *CreateRepoPoolOK) Error() string { + return fmt.Sprintf("[POST /repositories/{repoID}/pools][%d] createRepoPoolOK %+v", 200, o.Payload) +} + +func (o *CreateRepoPoolOK) String() string { + return fmt.Sprintf("[POST /repositories/{repoID}/pools][%d] createRepoPoolOK %+v", 200, o.Payload) +} + +func (o *CreateRepoPoolOK) GetPayload() garm_params.Pool { + return o.Payload +} + +func (o *CreateRepoPoolOK) 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 +} + +// NewCreateRepoPoolDefault creates a CreateRepoPoolDefault with default headers values +func NewCreateRepoPoolDefault(code int) *CreateRepoPoolDefault { + return &CreateRepoPoolDefault{ + _statusCode: code, + } +} + +/* +CreateRepoPoolDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type CreateRepoPoolDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this create repo pool default response has a 2xx status code +func (o *CreateRepoPoolDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this create repo pool default response has a 3xx status code +func (o *CreateRepoPoolDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this create repo pool default response has a 4xx status code +func (o *CreateRepoPoolDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this create repo pool default response has a 5xx status code +func (o *CreateRepoPoolDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this create repo pool default response a status code equal to that given +func (o *CreateRepoPoolDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the create repo pool default response +func (o *CreateRepoPoolDefault) Code() int { + return o._statusCode +} + +func (o *CreateRepoPoolDefault) Error() string { + return fmt.Sprintf("[POST /repositories/{repoID}/pools][%d] CreateRepoPool default %+v", o._statusCode, o.Payload) +} + +func (o *CreateRepoPoolDefault) String() string { + return fmt.Sprintf("[POST /repositories/{repoID}/pools][%d] CreateRepoPool default %+v", o._statusCode, o.Payload) +} + +func (o *CreateRepoPoolDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *CreateRepoPoolDefault) 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 +} diff --git a/client/repositories/create_repo_responses.go b/client/repositories/create_repo_responses.go new file mode 100644 index 00000000..347e9e0a --- /dev/null +++ b/client/repositories/create_repo_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" + garm_params "github.com/cloudbase/garm/params" +) + +// CreateRepoReader is a Reader for the CreateRepo structure. +type CreateRepoReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateRepoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateRepoOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewCreateRepoDefault(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 + } +} + +// NewCreateRepoOK creates a CreateRepoOK with default headers values +func NewCreateRepoOK() *CreateRepoOK { + return &CreateRepoOK{} +} + +/* +CreateRepoOK describes a response with status code 200, with default header values. + +Repository +*/ +type CreateRepoOK struct { + Payload garm_params.Repository +} + +// IsSuccess returns true when this create repo o k response has a 2xx status code +func (o *CreateRepoOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this create repo o k response has a 3xx status code +func (o *CreateRepoOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create repo o k response has a 4xx status code +func (o *CreateRepoOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this create repo o k response has a 5xx status code +func (o *CreateRepoOK) IsServerError() bool { + return false +} + +// IsCode returns true when this create repo o k response a status code equal to that given +func (o *CreateRepoOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the create repo o k response +func (o *CreateRepoOK) Code() int { + return 200 +} + +func (o *CreateRepoOK) Error() string { + return fmt.Sprintf("[POST /repositories][%d] createRepoOK %+v", 200, o.Payload) +} + +func (o *CreateRepoOK) String() string { + return fmt.Sprintf("[POST /repositories][%d] createRepoOK %+v", 200, o.Payload) +} + +func (o *CreateRepoOK) GetPayload() garm_params.Repository { + return o.Payload +} + +func (o *CreateRepoOK) 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 +} + +// NewCreateRepoDefault creates a CreateRepoDefault with default headers values +func NewCreateRepoDefault(code int) *CreateRepoDefault { + return &CreateRepoDefault{ + _statusCode: code, + } +} + +/* +CreateRepoDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type CreateRepoDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this create repo default response has a 2xx status code +func (o *CreateRepoDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this create repo default response has a 3xx status code +func (o *CreateRepoDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this create repo default response has a 4xx status code +func (o *CreateRepoDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this create repo default response has a 5xx status code +func (o *CreateRepoDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this create repo default response a status code equal to that given +func (o *CreateRepoDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the create repo default response +func (o *CreateRepoDefault) Code() int { + return o._statusCode +} + +func (o *CreateRepoDefault) Error() string { + return fmt.Sprintf("[POST /repositories][%d] CreateRepo default %+v", o._statusCode, o.Payload) +} + +func (o *CreateRepoDefault) String() string { + return fmt.Sprintf("[POST /repositories][%d] CreateRepo default %+v", o._statusCode, o.Payload) +} + +func (o *CreateRepoDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *CreateRepoDefault) 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 +} diff --git a/client/repositories/create_responses.go b/client/repositories/create_responses.go deleted file mode 100644 index b4e72423..00000000 --- a/client/repositories/create_responses.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package repositories - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - apiserver_params "github.com/cloudbase/garm/apiserver/params" - garm_params "github.com/cloudbase/garm/params" -) - -// CreateReader is a Reader for the Create structure. -type CreateReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *CreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewCreateOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewCreateDefault(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 - } -} - -// NewCreateOK creates a CreateOK with default headers values -func NewCreateOK() *CreateOK { - return &CreateOK{} -} - -/* -CreateOK describes a response with status code 200, with default header values. - -Repository -*/ -type CreateOK struct { - Payload garm_params.Repository -} - -// IsSuccess returns true when this create o k response has a 2xx status code -func (o *CreateOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this create o k response has a 3xx status code -func (o *CreateOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this create o k response has a 4xx status code -func (o *CreateOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this create o k response has a 5xx status code -func (o *CreateOK) IsServerError() bool { - return false -} - -// IsCode returns true when this create o k response a status code equal to that given -func (o *CreateOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the create o k response -func (o *CreateOK) Code() int { - return 200 -} - -func (o *CreateOK) Error() string { - return fmt.Sprintf("[POST /repositories][%d] createOK %+v", 200, o.Payload) -} - -func (o *CreateOK) String() string { - return fmt.Sprintf("[POST /repositories][%d] createOK %+v", 200, o.Payload) -} - -func (o *CreateOK) GetPayload() garm_params.Repository { - return o.Payload -} - -func (o *CreateOK) 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 -} - -// NewCreateDefault creates a CreateDefault with default headers values -func NewCreateDefault(code int) *CreateDefault { - return &CreateDefault{ - _statusCode: code, - } -} - -/* -CreateDefault describes a response with status code -1, with default header values. - -APIErrorResponse -*/ -type CreateDefault struct { - _statusCode int - - Payload apiserver_params.APIErrorResponse -} - -// IsSuccess returns true when this create default response has a 2xx status code -func (o *CreateDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this create default response has a 3xx status code -func (o *CreateDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this create default response has a 4xx status code -func (o *CreateDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this create default response has a 5xx status code -func (o *CreateDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this create default response a status code equal to that given -func (o *CreateDefault) IsCode(code int) bool { - return o._statusCode == code -} - -// Code gets the status code for the create default response -func (o *CreateDefault) Code() int { - return o._statusCode -} - -func (o *CreateDefault) Error() string { - return fmt.Sprintf("[POST /repositories][%d] Create default %+v", o._statusCode, o.Payload) -} - -func (o *CreateDefault) String() string { - return fmt.Sprintf("[POST /repositories][%d] Create default %+v", o._statusCode, o.Payload) -} - -func (o *CreateDefault) GetPayload() apiserver_params.APIErrorResponse { - return o.Payload -} - -func (o *CreateDefault) 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 -} diff --git a/client/repositories/delete_parameters.go b/client/repositories/delete_parameters.go deleted file mode 100644 index 947b8c07..00000000 --- a/client/repositories/delete_parameters.go +++ /dev/null @@ -1,151 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package repositories - -// 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" -) - -// NewDeleteParams creates a new DeleteParams 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 NewDeleteParams() *DeleteParams { - return &DeleteParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewDeleteParamsWithTimeout creates a new DeleteParams object -// with the ability to set a timeout on a request. -func NewDeleteParamsWithTimeout(timeout time.Duration) *DeleteParams { - return &DeleteParams{ - timeout: timeout, - } -} - -// NewDeleteParamsWithContext creates a new DeleteParams object -// with the ability to set a context for a request. -func NewDeleteParamsWithContext(ctx context.Context) *DeleteParams { - return &DeleteParams{ - Context: ctx, - } -} - -// NewDeleteParamsWithHTTPClient creates a new DeleteParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeleteParamsWithHTTPClient(client *http.Client) *DeleteParams { - return &DeleteParams{ - HTTPClient: client, - } -} - -/* -DeleteParams contains all the parameters to send to the API endpoint - - for the delete operation. - - Typically these are written to a http.Request. -*/ -type DeleteParams struct { - - /* RepoID. - - ID of the repository to delete. - */ - RepoID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the delete params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteParams) WithDefaults() *DeleteParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete params -func (o *DeleteParams) WithTimeout(timeout time.Duration) *DeleteParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete params -func (o *DeleteParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the delete params -func (o *DeleteParams) WithContext(ctx context.Context) *DeleteParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete params -func (o *DeleteParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete params -func (o *DeleteParams) WithHTTPClient(client *http.Client) *DeleteParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete params -func (o *DeleteParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithRepoID adds the repoID to the delete params -func (o *DeleteParams) WithRepoID(repoID string) *DeleteParams { - o.SetRepoID(repoID) - return o -} - -// SetRepoID adds the repoId to the delete params -func (o *DeleteParams) SetRepoID(repoID string) { - o.RepoID = repoID -} - -// WriteToRequest writes these params to a swagger request -func (o *DeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param repoID - if err := r.SetPathParam("repoID", o.RepoID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/client/repositories/delete_repo_parameters.go b/client/repositories/delete_repo_parameters.go new file mode 100644 index 00000000..08ea11d9 --- /dev/null +++ b/client/repositories/delete_repo_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// 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" +) + +// NewDeleteRepoParams creates a new DeleteRepoParams 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 NewDeleteRepoParams() *DeleteRepoParams { + return &DeleteRepoParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteRepoParamsWithTimeout creates a new DeleteRepoParams object +// with the ability to set a timeout on a request. +func NewDeleteRepoParamsWithTimeout(timeout time.Duration) *DeleteRepoParams { + return &DeleteRepoParams{ + timeout: timeout, + } +} + +// NewDeleteRepoParamsWithContext creates a new DeleteRepoParams object +// with the ability to set a context for a request. +func NewDeleteRepoParamsWithContext(ctx context.Context) *DeleteRepoParams { + return &DeleteRepoParams{ + Context: ctx, + } +} + +// NewDeleteRepoParamsWithHTTPClient creates a new DeleteRepoParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteRepoParamsWithHTTPClient(client *http.Client) *DeleteRepoParams { + return &DeleteRepoParams{ + HTTPClient: client, + } +} + +/* +DeleteRepoParams contains all the parameters to send to the API endpoint + + for the delete repo operation. + + Typically these are written to a http.Request. +*/ +type DeleteRepoParams struct { + + /* RepoID. + + ID of the repository to delete. + */ + RepoID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete repo params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteRepoParams) WithDefaults() *DeleteRepoParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete repo params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteRepoParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete repo params +func (o *DeleteRepoParams) WithTimeout(timeout time.Duration) *DeleteRepoParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete repo params +func (o *DeleteRepoParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete repo params +func (o *DeleteRepoParams) WithContext(ctx context.Context) *DeleteRepoParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete repo params +func (o *DeleteRepoParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete repo params +func (o *DeleteRepoParams) WithHTTPClient(client *http.Client) *DeleteRepoParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete repo params +func (o *DeleteRepoParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRepoID adds the repoID to the delete repo params +func (o *DeleteRepoParams) WithRepoID(repoID string) *DeleteRepoParams { + o.SetRepoID(repoID) + return o +} + +// SetRepoID adds the repoId to the delete repo params +func (o *DeleteRepoParams) SetRepoID(repoID string) { + o.RepoID = repoID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteRepoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param repoID + if err := r.SetPathParam("repoID", o.RepoID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/repositories/delete_repo_pool_parameters.go b/client/repositories/delete_repo_pool_parameters.go new file mode 100644 index 00000000..98aceac0 --- /dev/null +++ b/client/repositories/delete_repo_pool_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// 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" +) + +// NewDeleteRepoPoolParams creates a new DeleteRepoPoolParams 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 NewDeleteRepoPoolParams() *DeleteRepoPoolParams { + return &DeleteRepoPoolParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteRepoPoolParamsWithTimeout creates a new DeleteRepoPoolParams object +// with the ability to set a timeout on a request. +func NewDeleteRepoPoolParamsWithTimeout(timeout time.Duration) *DeleteRepoPoolParams { + return &DeleteRepoPoolParams{ + timeout: timeout, + } +} + +// NewDeleteRepoPoolParamsWithContext creates a new DeleteRepoPoolParams object +// with the ability to set a context for a request. +func NewDeleteRepoPoolParamsWithContext(ctx context.Context) *DeleteRepoPoolParams { + return &DeleteRepoPoolParams{ + Context: ctx, + } +} + +// NewDeleteRepoPoolParamsWithHTTPClient creates a new DeleteRepoPoolParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteRepoPoolParamsWithHTTPClient(client *http.Client) *DeleteRepoPoolParams { + return &DeleteRepoPoolParams{ + HTTPClient: client, + } +} + +/* +DeleteRepoPoolParams contains all the parameters to send to the API endpoint + + for the delete repo pool operation. + + Typically these are written to a http.Request. +*/ +type DeleteRepoPoolParams struct { + + /* PoolID. + + ID of the repository pool to delete. + */ + PoolID string + + /* RepoID. + + Repository ID. + */ + RepoID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete repo pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteRepoPoolParams) WithDefaults() *DeleteRepoPoolParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete repo pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteRepoPoolParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete repo pool params +func (o *DeleteRepoPoolParams) WithTimeout(timeout time.Duration) *DeleteRepoPoolParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete repo pool params +func (o *DeleteRepoPoolParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete repo pool params +func (o *DeleteRepoPoolParams) WithContext(ctx context.Context) *DeleteRepoPoolParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete repo pool params +func (o *DeleteRepoPoolParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete repo pool params +func (o *DeleteRepoPoolParams) WithHTTPClient(client *http.Client) *DeleteRepoPoolParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete repo pool params +func (o *DeleteRepoPoolParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithPoolID adds the poolID to the delete repo pool params +func (o *DeleteRepoPoolParams) WithPoolID(poolID string) *DeleteRepoPoolParams { + o.SetPoolID(poolID) + return o +} + +// SetPoolID adds the poolId to the delete repo pool params +func (o *DeleteRepoPoolParams) SetPoolID(poolID string) { + o.PoolID = poolID +} + +// WithRepoID adds the repoID to the delete repo pool params +func (o *DeleteRepoPoolParams) WithRepoID(repoID string) *DeleteRepoPoolParams { + o.SetRepoID(repoID) + return o +} + +// SetRepoID adds the repoId to the delete repo pool params +func (o *DeleteRepoPoolParams) SetRepoID(repoID string) { + o.RepoID = repoID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteRepoPoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param poolID + if err := r.SetPathParam("poolID", o.PoolID); err != nil { + return err + } + + // path param repoID + if err := r.SetPathParam("repoID", o.RepoID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/repositories/delete_repo_pool_responses.go b/client/repositories/delete_repo_pool_responses.go new file mode 100644 index 00000000..41f0e9fe --- /dev/null +++ b/client/repositories/delete_repo_pool_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" +) + +// DeleteRepoPoolReader is a Reader for the DeleteRepoPool structure. +type DeleteRepoPoolReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteRepoPoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + result := NewDeleteRepoPoolDefault(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 +} + +// NewDeleteRepoPoolDefault creates a DeleteRepoPoolDefault with default headers values +func NewDeleteRepoPoolDefault(code int) *DeleteRepoPoolDefault { + return &DeleteRepoPoolDefault{ + _statusCode: code, + } +} + +/* +DeleteRepoPoolDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type DeleteRepoPoolDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this delete repo pool default response has a 2xx status code +func (o *DeleteRepoPoolDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this delete repo pool default response has a 3xx status code +func (o *DeleteRepoPoolDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this delete repo pool default response has a 4xx status code +func (o *DeleteRepoPoolDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this delete repo pool default response has a 5xx status code +func (o *DeleteRepoPoolDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this delete repo pool default response a status code equal to that given +func (o *DeleteRepoPoolDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the delete repo pool default response +func (o *DeleteRepoPoolDefault) Code() int { + return o._statusCode +} + +func (o *DeleteRepoPoolDefault) Error() string { + return fmt.Sprintf("[DELETE /repositories/{repoID}/pools/{poolID}][%d] DeleteRepoPool default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteRepoPoolDefault) String() string { + return fmt.Sprintf("[DELETE /repositories/{repoID}/pools/{poolID}][%d] DeleteRepoPool default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteRepoPoolDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *DeleteRepoPoolDefault) 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 +} diff --git a/client/repositories/delete_repo_responses.go b/client/repositories/delete_repo_responses.go new file mode 100644 index 00000000..a49de666 --- /dev/null +++ b/client/repositories/delete_repo_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" +) + +// DeleteRepoReader is a Reader for the DeleteRepo structure. +type DeleteRepoReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteRepoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + result := NewDeleteRepoDefault(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 +} + +// NewDeleteRepoDefault creates a DeleteRepoDefault with default headers values +func NewDeleteRepoDefault(code int) *DeleteRepoDefault { + return &DeleteRepoDefault{ + _statusCode: code, + } +} + +/* +DeleteRepoDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type DeleteRepoDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this delete repo default response has a 2xx status code +func (o *DeleteRepoDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this delete repo default response has a 3xx status code +func (o *DeleteRepoDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this delete repo default response has a 4xx status code +func (o *DeleteRepoDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this delete repo default response has a 5xx status code +func (o *DeleteRepoDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this delete repo default response a status code equal to that given +func (o *DeleteRepoDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the delete repo default response +func (o *DeleteRepoDefault) Code() int { + return o._statusCode +} + +func (o *DeleteRepoDefault) Error() string { + return fmt.Sprintf("[DELETE /repositories/{repoID}][%d] DeleteRepo default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteRepoDefault) String() string { + return fmt.Sprintf("[DELETE /repositories/{repoID}][%d] DeleteRepo default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteRepoDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *DeleteRepoDefault) 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 +} diff --git a/client/repositories/delete_responses.go b/client/repositories/delete_responses.go deleted file mode 100644 index 0b3590f7..00000000 --- a/client/repositories/delete_responses.go +++ /dev/null @@ -1,103 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package repositories - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - apiserver_params "github.com/cloudbase/garm/apiserver/params" -) - -// DeleteReader is a Reader for the Delete structure. -type DeleteReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - result := NewDeleteDefault(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 -} - -// NewDeleteDefault creates a DeleteDefault with default headers values -func NewDeleteDefault(code int) *DeleteDefault { - return &DeleteDefault{ - _statusCode: code, - } -} - -/* -DeleteDefault describes a response with status code -1, with default header values. - -APIErrorResponse -*/ -type DeleteDefault struct { - _statusCode int - - Payload apiserver_params.APIErrorResponse -} - -// IsSuccess returns true when this delete default response has a 2xx status code -func (o *DeleteDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this delete default response has a 3xx status code -func (o *DeleteDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this delete default response has a 4xx status code -func (o *DeleteDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this delete default response has a 5xx status code -func (o *DeleteDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this delete default response a status code equal to that given -func (o *DeleteDefault) IsCode(code int) bool { - return o._statusCode == code -} - -// Code gets the status code for the delete default response -func (o *DeleteDefault) Code() int { - return o._statusCode -} - -func (o *DeleteDefault) Error() string { - return fmt.Sprintf("[DELETE /repositories/{repoID}][%d] Delete default %+v", o._statusCode, o.Payload) -} - -func (o *DeleteDefault) String() string { - return fmt.Sprintf("[DELETE /repositories/{repoID}][%d] Delete default %+v", o._statusCode, o.Payload) -} - -func (o *DeleteDefault) GetPayload() apiserver_params.APIErrorResponse { - return o.Payload -} - -func (o *DeleteDefault) 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 -} diff --git a/client/repositories/get_parameters.go b/client/repositories/get_parameters.go deleted file mode 100644 index 7cbb5407..00000000 --- a/client/repositories/get_parameters.go +++ /dev/null @@ -1,151 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package repositories - -// 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" -) - -// NewGetParams creates a new GetParams 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 NewGetParams() *GetParams { - return &GetParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetParamsWithTimeout creates a new GetParams object -// with the ability to set a timeout on a request. -func NewGetParamsWithTimeout(timeout time.Duration) *GetParams { - return &GetParams{ - timeout: timeout, - } -} - -// NewGetParamsWithContext creates a new GetParams object -// with the ability to set a context for a request. -func NewGetParamsWithContext(ctx context.Context) *GetParams { - return &GetParams{ - Context: ctx, - } -} - -// NewGetParamsWithHTTPClient creates a new GetParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetParamsWithHTTPClient(client *http.Client) *GetParams { - return &GetParams{ - HTTPClient: client, - } -} - -/* -GetParams contains all the parameters to send to the API endpoint - - for the get operation. - - Typically these are written to a http.Request. -*/ -type GetParams struct { - - /* RepoID. - - ID of the repository to fetch. - */ - RepoID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetParams) WithDefaults() *GetParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get params -func (o *GetParams) WithTimeout(timeout time.Duration) *GetParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get params -func (o *GetParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get params -func (o *GetParams) WithContext(ctx context.Context) *GetParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get params -func (o *GetParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get params -func (o *GetParams) WithHTTPClient(client *http.Client) *GetParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get params -func (o *GetParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithRepoID adds the repoID to the get params -func (o *GetParams) WithRepoID(repoID string) *GetParams { - o.SetRepoID(repoID) - return o -} - -// SetRepoID adds the repoId to the get params -func (o *GetParams) SetRepoID(repoID string) { - o.RepoID = repoID -} - -// WriteToRequest writes these params to a swagger request -func (o *GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param repoID - if err := r.SetPathParam("repoID", o.RepoID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/client/repositories/get_repo_parameters.go b/client/repositories/get_repo_parameters.go new file mode 100644 index 00000000..5bbd2555 --- /dev/null +++ b/client/repositories/get_repo_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// 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" +) + +// NewGetRepoParams creates a new GetRepoParams 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 NewGetRepoParams() *GetRepoParams { + return &GetRepoParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetRepoParamsWithTimeout creates a new GetRepoParams object +// with the ability to set a timeout on a request. +func NewGetRepoParamsWithTimeout(timeout time.Duration) *GetRepoParams { + return &GetRepoParams{ + timeout: timeout, + } +} + +// NewGetRepoParamsWithContext creates a new GetRepoParams object +// with the ability to set a context for a request. +func NewGetRepoParamsWithContext(ctx context.Context) *GetRepoParams { + return &GetRepoParams{ + Context: ctx, + } +} + +// NewGetRepoParamsWithHTTPClient creates a new GetRepoParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetRepoParamsWithHTTPClient(client *http.Client) *GetRepoParams { + return &GetRepoParams{ + HTTPClient: client, + } +} + +/* +GetRepoParams contains all the parameters to send to the API endpoint + + for the get repo operation. + + Typically these are written to a http.Request. +*/ +type GetRepoParams struct { + + /* RepoID. + + ID of the repository to fetch. + */ + RepoID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get repo params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRepoParams) WithDefaults() *GetRepoParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get repo params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRepoParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get repo params +func (o *GetRepoParams) WithTimeout(timeout time.Duration) *GetRepoParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get repo params +func (o *GetRepoParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get repo params +func (o *GetRepoParams) WithContext(ctx context.Context) *GetRepoParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get repo params +func (o *GetRepoParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get repo params +func (o *GetRepoParams) WithHTTPClient(client *http.Client) *GetRepoParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get repo params +func (o *GetRepoParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRepoID adds the repoID to the get repo params +func (o *GetRepoParams) WithRepoID(repoID string) *GetRepoParams { + o.SetRepoID(repoID) + return o +} + +// SetRepoID adds the repoId to the get repo params +func (o *GetRepoParams) SetRepoID(repoID string) { + o.RepoID = repoID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetRepoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param repoID + if err := r.SetPathParam("repoID", o.RepoID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/repositories/get_repo_pool_parameters.go b/client/repositories/get_repo_pool_parameters.go new file mode 100644 index 00000000..122b8b71 --- /dev/null +++ b/client/repositories/get_repo_pool_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// 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" +) + +// NewGetRepoPoolParams creates a new GetRepoPoolParams 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 NewGetRepoPoolParams() *GetRepoPoolParams { + return &GetRepoPoolParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetRepoPoolParamsWithTimeout creates a new GetRepoPoolParams object +// with the ability to set a timeout on a request. +func NewGetRepoPoolParamsWithTimeout(timeout time.Duration) *GetRepoPoolParams { + return &GetRepoPoolParams{ + timeout: timeout, + } +} + +// NewGetRepoPoolParamsWithContext creates a new GetRepoPoolParams object +// with the ability to set a context for a request. +func NewGetRepoPoolParamsWithContext(ctx context.Context) *GetRepoPoolParams { + return &GetRepoPoolParams{ + Context: ctx, + } +} + +// NewGetRepoPoolParamsWithHTTPClient creates a new GetRepoPoolParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetRepoPoolParamsWithHTTPClient(client *http.Client) *GetRepoPoolParams { + return &GetRepoPoolParams{ + HTTPClient: client, + } +} + +/* +GetRepoPoolParams contains all the parameters to send to the API endpoint + + for the get repo pool operation. + + Typically these are written to a http.Request. +*/ +type GetRepoPoolParams struct { + + /* PoolID. + + Pool ID. + */ + PoolID string + + /* RepoID. + + Repository ID. + */ + RepoID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get repo pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRepoPoolParams) WithDefaults() *GetRepoPoolParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get repo pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetRepoPoolParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get repo pool params +func (o *GetRepoPoolParams) WithTimeout(timeout time.Duration) *GetRepoPoolParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get repo pool params +func (o *GetRepoPoolParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get repo pool params +func (o *GetRepoPoolParams) WithContext(ctx context.Context) *GetRepoPoolParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get repo pool params +func (o *GetRepoPoolParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get repo pool params +func (o *GetRepoPoolParams) WithHTTPClient(client *http.Client) *GetRepoPoolParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get repo pool params +func (o *GetRepoPoolParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithPoolID adds the poolID to the get repo pool params +func (o *GetRepoPoolParams) WithPoolID(poolID string) *GetRepoPoolParams { + o.SetPoolID(poolID) + return o +} + +// SetPoolID adds the poolId to the get repo pool params +func (o *GetRepoPoolParams) SetPoolID(poolID string) { + o.PoolID = poolID +} + +// WithRepoID adds the repoID to the get repo pool params +func (o *GetRepoPoolParams) WithRepoID(repoID string) *GetRepoPoolParams { + o.SetRepoID(repoID) + return o +} + +// SetRepoID adds the repoId to the get repo pool params +func (o *GetRepoPoolParams) SetRepoID(repoID string) { + o.RepoID = repoID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetRepoPoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param poolID + if err := r.SetPathParam("poolID", o.PoolID); err != nil { + return err + } + + // path param repoID + if err := r.SetPathParam("repoID", o.RepoID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/repositories/get_repo_pool_responses.go b/client/repositories/get_repo_pool_responses.go new file mode 100644 index 00000000..0c8fce74 --- /dev/null +++ b/client/repositories/get_repo_pool_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" + garm_params "github.com/cloudbase/garm/params" +) + +// GetRepoPoolReader is a Reader for the GetRepoPool structure. +type GetRepoPoolReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetRepoPoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetRepoPoolOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetRepoPoolDefault(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 + } +} + +// NewGetRepoPoolOK creates a GetRepoPoolOK with default headers values +func NewGetRepoPoolOK() *GetRepoPoolOK { + return &GetRepoPoolOK{} +} + +/* +GetRepoPoolOK describes a response with status code 200, with default header values. + +Pool +*/ +type GetRepoPoolOK struct { + Payload garm_params.Pool +} + +// IsSuccess returns true when this get repo pool o k response has a 2xx status code +func (o *GetRepoPoolOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get repo pool o k response has a 3xx status code +func (o *GetRepoPoolOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get repo pool o k response has a 4xx status code +func (o *GetRepoPoolOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get repo pool o k response has a 5xx status code +func (o *GetRepoPoolOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get repo pool o k response a status code equal to that given +func (o *GetRepoPoolOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get repo pool o k response +func (o *GetRepoPoolOK) Code() int { + return 200 +} + +func (o *GetRepoPoolOK) Error() string { + return fmt.Sprintf("[GET /repositories/{repoID}/pools/{poolID}][%d] getRepoPoolOK %+v", 200, o.Payload) +} + +func (o *GetRepoPoolOK) String() string { + return fmt.Sprintf("[GET /repositories/{repoID}/pools/{poolID}][%d] getRepoPoolOK %+v", 200, o.Payload) +} + +func (o *GetRepoPoolOK) GetPayload() garm_params.Pool { + return o.Payload +} + +func (o *GetRepoPoolOK) 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 +} + +// NewGetRepoPoolDefault creates a GetRepoPoolDefault with default headers values +func NewGetRepoPoolDefault(code int) *GetRepoPoolDefault { + return &GetRepoPoolDefault{ + _statusCode: code, + } +} + +/* +GetRepoPoolDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type GetRepoPoolDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this get repo pool default response has a 2xx status code +func (o *GetRepoPoolDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get repo pool default response has a 3xx status code +func (o *GetRepoPoolDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get repo pool default response has a 4xx status code +func (o *GetRepoPoolDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get repo pool default response has a 5xx status code +func (o *GetRepoPoolDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get repo pool default response a status code equal to that given +func (o *GetRepoPoolDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get repo pool default response +func (o *GetRepoPoolDefault) Code() int { + return o._statusCode +} + +func (o *GetRepoPoolDefault) Error() string { + return fmt.Sprintf("[GET /repositories/{repoID}/pools/{poolID}][%d] GetRepoPool default %+v", o._statusCode, o.Payload) +} + +func (o *GetRepoPoolDefault) String() string { + return fmt.Sprintf("[GET /repositories/{repoID}/pools/{poolID}][%d] GetRepoPool default %+v", o._statusCode, o.Payload) +} + +func (o *GetRepoPoolDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *GetRepoPoolDefault) 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 +} diff --git a/client/repositories/get_repo_responses.go b/client/repositories/get_repo_responses.go new file mode 100644 index 00000000..4b04f1df --- /dev/null +++ b/client/repositories/get_repo_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" + garm_params "github.com/cloudbase/garm/params" +) + +// GetRepoReader is a Reader for the GetRepo structure. +type GetRepoReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetRepoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetRepoOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetRepoDefault(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 + } +} + +// NewGetRepoOK creates a GetRepoOK with default headers values +func NewGetRepoOK() *GetRepoOK { + return &GetRepoOK{} +} + +/* +GetRepoOK describes a response with status code 200, with default header values. + +Repository +*/ +type GetRepoOK struct { + Payload garm_params.Repository +} + +// IsSuccess returns true when this get repo o k response has a 2xx status code +func (o *GetRepoOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get repo o k response has a 3xx status code +func (o *GetRepoOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get repo o k response has a 4xx status code +func (o *GetRepoOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get repo o k response has a 5xx status code +func (o *GetRepoOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get repo o k response a status code equal to that given +func (o *GetRepoOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get repo o k response +func (o *GetRepoOK) Code() int { + return 200 +} + +func (o *GetRepoOK) Error() string { + return fmt.Sprintf("[GET /repositories/{repoID}][%d] getRepoOK %+v", 200, o.Payload) +} + +func (o *GetRepoOK) String() string { + return fmt.Sprintf("[GET /repositories/{repoID}][%d] getRepoOK %+v", 200, o.Payload) +} + +func (o *GetRepoOK) GetPayload() garm_params.Repository { + return o.Payload +} + +func (o *GetRepoOK) 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 +} + +// NewGetRepoDefault creates a GetRepoDefault with default headers values +func NewGetRepoDefault(code int) *GetRepoDefault { + return &GetRepoDefault{ + _statusCode: code, + } +} + +/* +GetRepoDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type GetRepoDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this get repo default response has a 2xx status code +func (o *GetRepoDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get repo default response has a 3xx status code +func (o *GetRepoDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get repo default response has a 4xx status code +func (o *GetRepoDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get repo default response has a 5xx status code +func (o *GetRepoDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get repo default response a status code equal to that given +func (o *GetRepoDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get repo default response +func (o *GetRepoDefault) Code() int { + return o._statusCode +} + +func (o *GetRepoDefault) Error() string { + return fmt.Sprintf("[GET /repositories/{repoID}][%d] GetRepo default %+v", o._statusCode, o.Payload) +} + +func (o *GetRepoDefault) String() string { + return fmt.Sprintf("[GET /repositories/{repoID}][%d] GetRepo default %+v", o._statusCode, o.Payload) +} + +func (o *GetRepoDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *GetRepoDefault) 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 +} diff --git a/client/repositories/get_responses.go b/client/repositories/get_responses.go deleted file mode 100644 index a8ac612c..00000000 --- a/client/repositories/get_responses.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package repositories - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - apiserver_params "github.com/cloudbase/garm/apiserver/params" - garm_params "github.com/cloudbase/garm/params" -) - -// GetReader is a Reader for the Get structure. -type GetReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewGetDefault(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 - } -} - -// NewGetOK creates a GetOK with default headers values -func NewGetOK() *GetOK { - return &GetOK{} -} - -/* -GetOK describes a response with status code 200, with default header values. - -Repository -*/ -type GetOK struct { - Payload garm_params.Repository -} - -// IsSuccess returns true when this get o k response has a 2xx status code -func (o *GetOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get o k response has a 3xx status code -func (o *GetOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get o k response has a 4xx status code -func (o *GetOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get o k response has a 5xx status code -func (o *GetOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get o k response a status code equal to that given -func (o *GetOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get o k response -func (o *GetOK) Code() int { - return 200 -} - -func (o *GetOK) Error() string { - return fmt.Sprintf("[GET /repositories/{repoID}][%d] getOK %+v", 200, o.Payload) -} - -func (o *GetOK) String() string { - return fmt.Sprintf("[GET /repositories/{repoID}][%d] getOK %+v", 200, o.Payload) -} - -func (o *GetOK) GetPayload() garm_params.Repository { - return o.Payload -} - -func (o *GetOK) 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 -} - -// NewGetDefault creates a GetDefault with default headers values -func NewGetDefault(code int) *GetDefault { - return &GetDefault{ - _statusCode: code, - } -} - -/* -GetDefault describes a response with status code -1, with default header values. - -APIErrorResponse -*/ -type GetDefault struct { - _statusCode int - - Payload apiserver_params.APIErrorResponse -} - -// IsSuccess returns true when this get default response has a 2xx status code -func (o *GetDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this get default response has a 3xx status code -func (o *GetDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this get default response has a 4xx status code -func (o *GetDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this get default response has a 5xx status code -func (o *GetDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this get default response a status code equal to that given -func (o *GetDefault) IsCode(code int) bool { - return o._statusCode == code -} - -// Code gets the status code for the get default response -func (o *GetDefault) Code() int { - return o._statusCode -} - -func (o *GetDefault) Error() string { - return fmt.Sprintf("[GET /repositories/{repoID}][%d] Get default %+v", o._statusCode, o.Payload) -} - -func (o *GetDefault) String() string { - return fmt.Sprintf("[GET /repositories/{repoID}][%d] Get default %+v", o._statusCode, o.Payload) -} - -func (o *GetDefault) GetPayload() apiserver_params.APIErrorResponse { - return o.Payload -} - -func (o *GetDefault) 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 -} diff --git a/client/repositories/list_parameters.go b/client/repositories/list_parameters.go deleted file mode 100644 index 8db2f709..00000000 --- a/client/repositories/list_parameters.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package repositories - -// 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" -) - -// NewListParams creates a new ListParams 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 NewListParams() *ListParams { - return &ListParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewListParamsWithTimeout creates a new ListParams object -// with the ability to set a timeout on a request. -func NewListParamsWithTimeout(timeout time.Duration) *ListParams { - return &ListParams{ - timeout: timeout, - } -} - -// NewListParamsWithContext creates a new ListParams object -// with the ability to set a context for a request. -func NewListParamsWithContext(ctx context.Context) *ListParams { - return &ListParams{ - Context: ctx, - } -} - -// NewListParamsWithHTTPClient creates a new ListParams object -// with the ability to set a custom HTTPClient for a request. -func NewListParamsWithHTTPClient(client *http.Client) *ListParams { - return &ListParams{ - HTTPClient: client, - } -} - -/* -ListParams contains all the parameters to send to the API endpoint - - for the list operation. - - Typically these are written to a http.Request. -*/ -type ListParams struct { - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the list params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ListParams) WithDefaults() *ListParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the list params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ListParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the list params -func (o *ListParams) WithTimeout(timeout time.Duration) *ListParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the list params -func (o *ListParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the list params -func (o *ListParams) WithContext(ctx context.Context) *ListParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the list params -func (o *ListParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the list params -func (o *ListParams) WithHTTPClient(client *http.Client) *ListParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the list params -func (o *ListParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WriteToRequest writes these params to a swagger request -func (o *ListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/client/repositories/list_repo_instances_parameters.go b/client/repositories/list_repo_instances_parameters.go new file mode 100644 index 00000000..59f280b8 --- /dev/null +++ b/client/repositories/list_repo_instances_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// 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" +) + +// NewListRepoInstancesParams creates a new ListRepoInstancesParams 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 NewListRepoInstancesParams() *ListRepoInstancesParams { + return &ListRepoInstancesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListRepoInstancesParamsWithTimeout creates a new ListRepoInstancesParams object +// with the ability to set a timeout on a request. +func NewListRepoInstancesParamsWithTimeout(timeout time.Duration) *ListRepoInstancesParams { + return &ListRepoInstancesParams{ + timeout: timeout, + } +} + +// NewListRepoInstancesParamsWithContext creates a new ListRepoInstancesParams object +// with the ability to set a context for a request. +func NewListRepoInstancesParamsWithContext(ctx context.Context) *ListRepoInstancesParams { + return &ListRepoInstancesParams{ + Context: ctx, + } +} + +// NewListRepoInstancesParamsWithHTTPClient creates a new ListRepoInstancesParams object +// with the ability to set a custom HTTPClient for a request. +func NewListRepoInstancesParamsWithHTTPClient(client *http.Client) *ListRepoInstancesParams { + return &ListRepoInstancesParams{ + HTTPClient: client, + } +} + +/* +ListRepoInstancesParams contains all the parameters to send to the API endpoint + + for the list repo instances operation. + + Typically these are written to a http.Request. +*/ +type ListRepoInstancesParams struct { + + /* RepoID. + + Repository ID. + */ + RepoID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list repo instances params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListRepoInstancesParams) WithDefaults() *ListRepoInstancesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list repo instances params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListRepoInstancesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list repo instances params +func (o *ListRepoInstancesParams) WithTimeout(timeout time.Duration) *ListRepoInstancesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list repo instances params +func (o *ListRepoInstancesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list repo instances params +func (o *ListRepoInstancesParams) WithContext(ctx context.Context) *ListRepoInstancesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list repo instances params +func (o *ListRepoInstancesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list repo instances params +func (o *ListRepoInstancesParams) WithHTTPClient(client *http.Client) *ListRepoInstancesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list repo instances params +func (o *ListRepoInstancesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRepoID adds the repoID to the list repo instances params +func (o *ListRepoInstancesParams) WithRepoID(repoID string) *ListRepoInstancesParams { + o.SetRepoID(repoID) + return o +} + +// SetRepoID adds the repoId to the list repo instances params +func (o *ListRepoInstancesParams) SetRepoID(repoID string) { + o.RepoID = repoID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListRepoInstancesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param repoID + if err := r.SetPathParam("repoID", o.RepoID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/repositories/list_repo_instances_responses.go b/client/repositories/list_repo_instances_responses.go new file mode 100644 index 00000000..39c39eb8 --- /dev/null +++ b/client/repositories/list_repo_instances_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" + garm_params "github.com/cloudbase/garm/params" +) + +// ListRepoInstancesReader is a Reader for the ListRepoInstances structure. +type ListRepoInstancesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListRepoInstancesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListRepoInstancesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListRepoInstancesDefault(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 + } +} + +// NewListRepoInstancesOK creates a ListRepoInstancesOK with default headers values +func NewListRepoInstancesOK() *ListRepoInstancesOK { + return &ListRepoInstancesOK{} +} + +/* +ListRepoInstancesOK describes a response with status code 200, with default header values. + +Instances +*/ +type ListRepoInstancesOK struct { + Payload garm_params.Instances +} + +// IsSuccess returns true when this list repo instances o k response has a 2xx status code +func (o *ListRepoInstancesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list repo instances o k response has a 3xx status code +func (o *ListRepoInstancesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list repo instances o k response has a 4xx status code +func (o *ListRepoInstancesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list repo instances o k response has a 5xx status code +func (o *ListRepoInstancesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list repo instances o k response a status code equal to that given +func (o *ListRepoInstancesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list repo instances o k response +func (o *ListRepoInstancesOK) Code() int { + return 200 +} + +func (o *ListRepoInstancesOK) Error() string { + return fmt.Sprintf("[GET /repositories/{repoID}/instances][%d] listRepoInstancesOK %+v", 200, o.Payload) +} + +func (o *ListRepoInstancesOK) String() string { + return fmt.Sprintf("[GET /repositories/{repoID}/instances][%d] listRepoInstancesOK %+v", 200, o.Payload) +} + +func (o *ListRepoInstancesOK) GetPayload() garm_params.Instances { + return o.Payload +} + +func (o *ListRepoInstancesOK) 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 +} + +// NewListRepoInstancesDefault creates a ListRepoInstancesDefault with default headers values +func NewListRepoInstancesDefault(code int) *ListRepoInstancesDefault { + return &ListRepoInstancesDefault{ + _statusCode: code, + } +} + +/* +ListRepoInstancesDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type ListRepoInstancesDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this list repo instances default response has a 2xx status code +func (o *ListRepoInstancesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list repo instances default response has a 3xx status code +func (o *ListRepoInstancesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list repo instances default response has a 4xx status code +func (o *ListRepoInstancesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list repo instances default response has a 5xx status code +func (o *ListRepoInstancesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list repo instances default response a status code equal to that given +func (o *ListRepoInstancesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list repo instances default response +func (o *ListRepoInstancesDefault) Code() int { + return o._statusCode +} + +func (o *ListRepoInstancesDefault) Error() string { + return fmt.Sprintf("[GET /repositories/{repoID}/instances][%d] ListRepoInstances default %+v", o._statusCode, o.Payload) +} + +func (o *ListRepoInstancesDefault) String() string { + return fmt.Sprintf("[GET /repositories/{repoID}/instances][%d] ListRepoInstances default %+v", o._statusCode, o.Payload) +} + +func (o *ListRepoInstancesDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *ListRepoInstancesDefault) 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 +} diff --git a/client/repositories/list_repo_pools_parameters.go b/client/repositories/list_repo_pools_parameters.go new file mode 100644 index 00000000..97d9d57c --- /dev/null +++ b/client/repositories/list_repo_pools_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// 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" +) + +// NewListRepoPoolsParams creates a new ListRepoPoolsParams 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 NewListRepoPoolsParams() *ListRepoPoolsParams { + return &ListRepoPoolsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListRepoPoolsParamsWithTimeout creates a new ListRepoPoolsParams object +// with the ability to set a timeout on a request. +func NewListRepoPoolsParamsWithTimeout(timeout time.Duration) *ListRepoPoolsParams { + return &ListRepoPoolsParams{ + timeout: timeout, + } +} + +// NewListRepoPoolsParamsWithContext creates a new ListRepoPoolsParams object +// with the ability to set a context for a request. +func NewListRepoPoolsParamsWithContext(ctx context.Context) *ListRepoPoolsParams { + return &ListRepoPoolsParams{ + Context: ctx, + } +} + +// NewListRepoPoolsParamsWithHTTPClient creates a new ListRepoPoolsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListRepoPoolsParamsWithHTTPClient(client *http.Client) *ListRepoPoolsParams { + return &ListRepoPoolsParams{ + HTTPClient: client, + } +} + +/* +ListRepoPoolsParams contains all the parameters to send to the API endpoint + + for the list repo pools operation. + + Typically these are written to a http.Request. +*/ +type ListRepoPoolsParams struct { + + /* RepoID. + + Repository ID. + */ + RepoID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list repo pools params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListRepoPoolsParams) WithDefaults() *ListRepoPoolsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list repo pools params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListRepoPoolsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list repo pools params +func (o *ListRepoPoolsParams) WithTimeout(timeout time.Duration) *ListRepoPoolsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list repo pools params +func (o *ListRepoPoolsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list repo pools params +func (o *ListRepoPoolsParams) WithContext(ctx context.Context) *ListRepoPoolsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list repo pools params +func (o *ListRepoPoolsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list repo pools params +func (o *ListRepoPoolsParams) WithHTTPClient(client *http.Client) *ListRepoPoolsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list repo pools params +func (o *ListRepoPoolsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRepoID adds the repoID to the list repo pools params +func (o *ListRepoPoolsParams) WithRepoID(repoID string) *ListRepoPoolsParams { + o.SetRepoID(repoID) + return o +} + +// SetRepoID adds the repoId to the list repo pools params +func (o *ListRepoPoolsParams) SetRepoID(repoID string) { + o.RepoID = repoID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListRepoPoolsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param repoID + if err := r.SetPathParam("repoID", o.RepoID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/repositories/list_repo_pools_responses.go b/client/repositories/list_repo_pools_responses.go new file mode 100644 index 00000000..c6ba64ca --- /dev/null +++ b/client/repositories/list_repo_pools_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" + garm_params "github.com/cloudbase/garm/params" +) + +// ListRepoPoolsReader is a Reader for the ListRepoPools structure. +type ListRepoPoolsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListRepoPoolsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListRepoPoolsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListRepoPoolsDefault(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 + } +} + +// NewListRepoPoolsOK creates a ListRepoPoolsOK with default headers values +func NewListRepoPoolsOK() *ListRepoPoolsOK { + return &ListRepoPoolsOK{} +} + +/* +ListRepoPoolsOK describes a response with status code 200, with default header values. + +Pools +*/ +type ListRepoPoolsOK struct { + Payload garm_params.Pools +} + +// IsSuccess returns true when this list repo pools o k response has a 2xx status code +func (o *ListRepoPoolsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list repo pools o k response has a 3xx status code +func (o *ListRepoPoolsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list repo pools o k response has a 4xx status code +func (o *ListRepoPoolsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list repo pools o k response has a 5xx status code +func (o *ListRepoPoolsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list repo pools o k response a status code equal to that given +func (o *ListRepoPoolsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list repo pools o k response +func (o *ListRepoPoolsOK) Code() int { + return 200 +} + +func (o *ListRepoPoolsOK) Error() string { + return fmt.Sprintf("[GET /repositories/{repoID}/pools][%d] listRepoPoolsOK %+v", 200, o.Payload) +} + +func (o *ListRepoPoolsOK) String() string { + return fmt.Sprintf("[GET /repositories/{repoID}/pools][%d] listRepoPoolsOK %+v", 200, o.Payload) +} + +func (o *ListRepoPoolsOK) GetPayload() garm_params.Pools { + return o.Payload +} + +func (o *ListRepoPoolsOK) 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 +} + +// NewListRepoPoolsDefault creates a ListRepoPoolsDefault with default headers values +func NewListRepoPoolsDefault(code int) *ListRepoPoolsDefault { + return &ListRepoPoolsDefault{ + _statusCode: code, + } +} + +/* +ListRepoPoolsDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type ListRepoPoolsDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this list repo pools default response has a 2xx status code +func (o *ListRepoPoolsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list repo pools default response has a 3xx status code +func (o *ListRepoPoolsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list repo pools default response has a 4xx status code +func (o *ListRepoPoolsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list repo pools default response has a 5xx status code +func (o *ListRepoPoolsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list repo pools default response a status code equal to that given +func (o *ListRepoPoolsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list repo pools default response +func (o *ListRepoPoolsDefault) Code() int { + return o._statusCode +} + +func (o *ListRepoPoolsDefault) Error() string { + return fmt.Sprintf("[GET /repositories/{repoID}/pools][%d] ListRepoPools default %+v", o._statusCode, o.Payload) +} + +func (o *ListRepoPoolsDefault) String() string { + return fmt.Sprintf("[GET /repositories/{repoID}/pools][%d] ListRepoPools default %+v", o._statusCode, o.Payload) +} + +func (o *ListRepoPoolsDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *ListRepoPoolsDefault) 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 +} diff --git a/client/repositories/list_repos_parameters.go b/client/repositories/list_repos_parameters.go new file mode 100644 index 00000000..f4e17d79 --- /dev/null +++ b/client/repositories/list_repos_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// 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" +) + +// NewListReposParams creates a new ListReposParams 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 NewListReposParams() *ListReposParams { + return &ListReposParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListReposParamsWithTimeout creates a new ListReposParams object +// with the ability to set a timeout on a request. +func NewListReposParamsWithTimeout(timeout time.Duration) *ListReposParams { + return &ListReposParams{ + timeout: timeout, + } +} + +// NewListReposParamsWithContext creates a new ListReposParams object +// with the ability to set a context for a request. +func NewListReposParamsWithContext(ctx context.Context) *ListReposParams { + return &ListReposParams{ + Context: ctx, + } +} + +// NewListReposParamsWithHTTPClient creates a new ListReposParams object +// with the ability to set a custom HTTPClient for a request. +func NewListReposParamsWithHTTPClient(client *http.Client) *ListReposParams { + return &ListReposParams{ + HTTPClient: client, + } +} + +/* +ListReposParams contains all the parameters to send to the API endpoint + + for the list repos operation. + + Typically these are written to a http.Request. +*/ +type ListReposParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list repos params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListReposParams) WithDefaults() *ListReposParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list repos params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListReposParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list repos params +func (o *ListReposParams) WithTimeout(timeout time.Duration) *ListReposParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list repos params +func (o *ListReposParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list repos params +func (o *ListReposParams) WithContext(ctx context.Context) *ListReposParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list repos params +func (o *ListReposParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list repos params +func (o *ListReposParams) WithHTTPClient(client *http.Client) *ListReposParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list repos params +func (o *ListReposParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ListReposParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/repositories/list_repos_responses.go b/client/repositories/list_repos_responses.go new file mode 100644 index 00000000..4346f0b5 --- /dev/null +++ b/client/repositories/list_repos_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" + garm_params "github.com/cloudbase/garm/params" +) + +// ListReposReader is a Reader for the ListRepos structure. +type ListReposReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListReposReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListReposOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListReposDefault(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 + } +} + +// NewListReposOK creates a ListReposOK with default headers values +func NewListReposOK() *ListReposOK { + return &ListReposOK{} +} + +/* +ListReposOK describes a response with status code 200, with default header values. + +Repositories +*/ +type ListReposOK struct { + Payload garm_params.Repositories +} + +// IsSuccess returns true when this list repos o k response has a 2xx status code +func (o *ListReposOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list repos o k response has a 3xx status code +func (o *ListReposOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list repos o k response has a 4xx status code +func (o *ListReposOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list repos o k response has a 5xx status code +func (o *ListReposOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list repos o k response a status code equal to that given +func (o *ListReposOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list repos o k response +func (o *ListReposOK) Code() int { + return 200 +} + +func (o *ListReposOK) Error() string { + return fmt.Sprintf("[GET /repositories][%d] listReposOK %+v", 200, o.Payload) +} + +func (o *ListReposOK) String() string { + return fmt.Sprintf("[GET /repositories][%d] listReposOK %+v", 200, o.Payload) +} + +func (o *ListReposOK) GetPayload() garm_params.Repositories { + return o.Payload +} + +func (o *ListReposOK) 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 +} + +// NewListReposDefault creates a ListReposDefault with default headers values +func NewListReposDefault(code int) *ListReposDefault { + return &ListReposDefault{ + _statusCode: code, + } +} + +/* +ListReposDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type ListReposDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this list repos default response has a 2xx status code +func (o *ListReposDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list repos default response has a 3xx status code +func (o *ListReposDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list repos default response has a 4xx status code +func (o *ListReposDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list repos default response has a 5xx status code +func (o *ListReposDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list repos default response a status code equal to that given +func (o *ListReposDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list repos default response +func (o *ListReposDefault) Code() int { + return o._statusCode +} + +func (o *ListReposDefault) Error() string { + return fmt.Sprintf("[GET /repositories][%d] ListRepos default %+v", o._statusCode, o.Payload) +} + +func (o *ListReposDefault) String() string { + return fmt.Sprintf("[GET /repositories][%d] ListRepos default %+v", o._statusCode, o.Payload) +} + +func (o *ListReposDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *ListReposDefault) 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 +} diff --git a/client/repositories/list_responses.go b/client/repositories/list_responses.go deleted file mode 100644 index 3ba6cd84..00000000 --- a/client/repositories/list_responses.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package repositories - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - apiserver_params "github.com/cloudbase/garm/apiserver/params" - garm_params "github.com/cloudbase/garm/params" -) - -// ListReader is a Reader for the List structure. -type ListReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *ListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewListOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewListDefault(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 - } -} - -// NewListOK creates a ListOK with default headers values -func NewListOK() *ListOK { - return &ListOK{} -} - -/* -ListOK describes a response with status code 200, with default header values. - -Repositories -*/ -type ListOK struct { - Payload garm_params.Repositories -} - -// IsSuccess returns true when this list o k response has a 2xx status code -func (o *ListOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this list o k response has a 3xx status code -func (o *ListOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this list o k response has a 4xx status code -func (o *ListOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this list o k response has a 5xx status code -func (o *ListOK) IsServerError() bool { - return false -} - -// IsCode returns true when this list o k response a status code equal to that given -func (o *ListOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the list o k response -func (o *ListOK) Code() int { - return 200 -} - -func (o *ListOK) Error() string { - return fmt.Sprintf("[GET /repositories][%d] listOK %+v", 200, o.Payload) -} - -func (o *ListOK) String() string { - return fmt.Sprintf("[GET /repositories][%d] listOK %+v", 200, o.Payload) -} - -func (o *ListOK) GetPayload() garm_params.Repositories { - return o.Payload -} - -func (o *ListOK) 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 -} - -// NewListDefault creates a ListDefault with default headers values -func NewListDefault(code int) *ListDefault { - return &ListDefault{ - _statusCode: code, - } -} - -/* -ListDefault describes a response with status code -1, with default header values. - -APIErrorResponse -*/ -type ListDefault struct { - _statusCode int - - Payload apiserver_params.APIErrorResponse -} - -// IsSuccess returns true when this list default response has a 2xx status code -func (o *ListDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this list default response has a 3xx status code -func (o *ListDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this list default response has a 4xx status code -func (o *ListDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this list default response has a 5xx status code -func (o *ListDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this list default response a status code equal to that given -func (o *ListDefault) IsCode(code int) bool { - return o._statusCode == code -} - -// Code gets the status code for the list default response -func (o *ListDefault) Code() int { - return o._statusCode -} - -func (o *ListDefault) Error() string { - return fmt.Sprintf("[GET /repositories][%d] List default %+v", o._statusCode, o.Payload) -} - -func (o *ListDefault) String() string { - return fmt.Sprintf("[GET /repositories][%d] List default %+v", o._statusCode, o.Payload) -} - -func (o *ListDefault) GetPayload() apiserver_params.APIErrorResponse { - return o.Payload -} - -func (o *ListDefault) 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 -} diff --git a/client/repositories/repositories_client.go b/client/repositories/repositories_client.go index db3ab0b3..66ab122d 100644 --- a/client/repositories/repositories_client.go +++ b/client/repositories/repositories_client.go @@ -28,34 +28,48 @@ type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods type ClientService interface { - Create(params *CreateParams, opts ...ClientOption) (*CreateOK, error) + CreateRepo(params *CreateRepoParams, opts ...ClientOption) (*CreateRepoOK, error) - Delete(params *DeleteParams, opts ...ClientOption) error + CreateRepoPool(params *CreateRepoPoolParams, opts ...ClientOption) (*CreateRepoPoolOK, error) - Get(params *GetParams, opts ...ClientOption) (*GetOK, error) + DeleteRepo(params *DeleteRepoParams, opts ...ClientOption) error - List(params *ListParams, opts ...ClientOption) (*ListOK, error) + DeleteRepoPool(params *DeleteRepoPoolParams, opts ...ClientOption) error + + GetRepo(params *GetRepoParams, opts ...ClientOption) (*GetRepoOK, error) + + GetRepoPool(params *GetRepoPoolParams, opts ...ClientOption) (*GetRepoPoolOK, error) + + ListRepoInstances(params *ListRepoInstancesParams, opts ...ClientOption) (*ListRepoInstancesOK, error) + + ListRepoPools(params *ListRepoPoolsParams, opts ...ClientOption) (*ListRepoPoolsOK, error) + + ListRepos(params *ListReposParams, opts ...ClientOption) (*ListReposOK, error) + + UpdateRepo(params *UpdateRepoParams, opts ...ClientOption) (*UpdateRepoOK, error) + + UpdateRepoPool(params *UpdateRepoPoolParams, opts ...ClientOption) (*UpdateRepoPoolOK, error) SetTransport(transport runtime.ClientTransport) } /* -Create creates repository with the parameters given +CreateRepo creates repository with the parameters given */ -func (a *Client) Create(params *CreateParams, opts ...ClientOption) (*CreateOK, error) { +func (a *Client) CreateRepo(params *CreateRepoParams, opts ...ClientOption) (*CreateRepoOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewCreateParams() + params = NewCreateRepoParams() } op := &runtime.ClientOperation{ - ID: "Create", + ID: "CreateRepo", Method: "POST", PathPattern: "/repositories", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &CreateReader{formats: a.formats}, + Reader: &CreateRepoReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, } @@ -67,32 +81,69 @@ func (a *Client) Create(params *CreateParams, opts ...ClientOption) (*CreateOK, if err != nil { return nil, err } - success, ok := result.(*CreateOK) + success, ok := result.(*CreateRepoOK) if ok { return success, nil } // unexpected success response - unexpectedSuccess := result.(*CreateDefault) + unexpectedSuccess := result.(*CreateRepoDefault) return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } /* -Delete deletes repository by ID +CreateRepoPool creates repository pool with the parameters given */ -func (a *Client) Delete(params *DeleteParams, opts ...ClientOption) error { +func (a *Client) CreateRepoPool(params *CreateRepoPoolParams, opts ...ClientOption) (*CreateRepoPoolOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewDeleteParams() + params = NewCreateRepoPoolParams() } op := &runtime.ClientOperation{ - ID: "Delete", + ID: "CreateRepoPool", + Method: "POST", + PathPattern: "/repositories/{repoID}/pools", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &CreateRepoPoolReader{formats: a.formats}, + 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.(*CreateRepoPoolOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*CreateRepoPoolDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeleteRepo deletes repository by ID +*/ +func (a *Client) DeleteRepo(params *DeleteRepoParams, opts ...ClientOption) error { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteRepoParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteRepo", Method: "DELETE", PathPattern: "/repositories/{repoID}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &DeleteReader{formats: a.formats}, + Reader: &DeleteRepoReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, } @@ -108,22 +159,53 @@ func (a *Client) Delete(params *DeleteParams, opts ...ClientOption) error { } /* -Get gets repository by ID +DeleteRepoPool deletes repository pool by ID */ -func (a *Client) Get(params *GetParams, opts ...ClientOption) (*GetOK, error) { +func (a *Client) DeleteRepoPool(params *DeleteRepoPoolParams, opts ...ClientOption) error { // TODO: Validate the params before sending if params == nil { - params = NewGetParams() + params = NewDeleteRepoPoolParams() } op := &runtime.ClientOperation{ - ID: "Get", + ID: "DeleteRepoPool", + Method: "DELETE", + PathPattern: "/repositories/{repoID}/pools/{poolID}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteRepoPoolReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + _, err := a.transport.Submit(op) + if err != nil { + return err + } + return nil +} + +/* +GetRepo gets repository by ID +*/ +func (a *Client) GetRepo(params *GetRepoParams, opts ...ClientOption) (*GetRepoOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetRepoParams() + } + op := &runtime.ClientOperation{ + ID: "GetRepo", Method: "GET", PathPattern: "/repositories/{repoID}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &GetReader{formats: a.formats}, + Reader: &GetRepoReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, } @@ -135,32 +217,143 @@ func (a *Client) Get(params *GetParams, opts ...ClientOption) (*GetOK, error) { if err != nil { return nil, err } - success, ok := result.(*GetOK) + success, ok := result.(*GetRepoOK) if ok { return success, nil } // unexpected success response - unexpectedSuccess := result.(*GetDefault) + unexpectedSuccess := result.(*GetRepoDefault) return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } /* -List lists repositories +GetRepoPool gets repository pool by ID */ -func (a *Client) List(params *ListParams, opts ...ClientOption) (*ListOK, error) { +func (a *Client) GetRepoPool(params *GetRepoPoolParams, opts ...ClientOption) (*GetRepoPoolOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewListParams() + params = NewGetRepoPoolParams() } op := &runtime.ClientOperation{ - ID: "List", + ID: "GetRepoPool", + Method: "GET", + PathPattern: "/repositories/{repoID}/pools/{poolID}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetRepoPoolReader{formats: a.formats}, + 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.(*GetRepoPoolOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetRepoPoolDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListRepoInstances lists repository instances +*/ +func (a *Client) ListRepoInstances(params *ListRepoInstancesParams, opts ...ClientOption) (*ListRepoInstancesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListRepoInstancesParams() + } + op := &runtime.ClientOperation{ + ID: "ListRepoInstances", + Method: "GET", + PathPattern: "/repositories/{repoID}/instances", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListRepoInstancesReader{formats: a.formats}, + 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.(*ListRepoInstancesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListRepoInstancesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListRepoPools lists repository pools +*/ +func (a *Client) ListRepoPools(params *ListRepoPoolsParams, opts ...ClientOption) (*ListRepoPoolsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListRepoPoolsParams() + } + op := &runtime.ClientOperation{ + ID: "ListRepoPools", + Method: "GET", + PathPattern: "/repositories/{repoID}/pools", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListRepoPoolsReader{formats: a.formats}, + 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.(*ListRepoPoolsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListRepoPoolsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListRepos lists repositories +*/ +func (a *Client) ListRepos(params *ListReposParams, opts ...ClientOption) (*ListReposOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListReposParams() + } + op := &runtime.ClientOperation{ + ID: "ListRepos", Method: "GET", PathPattern: "/repositories", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &ListReader{formats: a.formats}, + Reader: &ListReposReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, } @@ -172,12 +365,86 @@ func (a *Client) List(params *ListParams, opts ...ClientOption) (*ListOK, error) if err != nil { return nil, err } - success, ok := result.(*ListOK) + success, ok := result.(*ListReposOK) if ok { return success, nil } // unexpected success response - unexpectedSuccess := result.(*ListDefault) + unexpectedSuccess := result.(*ListReposDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +UpdateRepo updates repository with the parameters given +*/ +func (a *Client) UpdateRepo(params *UpdateRepoParams, opts ...ClientOption) (*UpdateRepoOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateRepoParams() + } + op := &runtime.ClientOperation{ + ID: "UpdateRepo", + Method: "PUT", + PathPattern: "/repositories/{repoID}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &UpdateRepoReader{formats: a.formats}, + 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.(*UpdateRepoOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UpdateRepoDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +UpdateRepoPool updates repository pool with the parameters given +*/ +func (a *Client) UpdateRepoPool(params *UpdateRepoPoolParams, opts ...ClientOption) (*UpdateRepoPoolOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateRepoPoolParams() + } + op := &runtime.ClientOperation{ + ID: "UpdateRepoPool", + Method: "PUT", + PathPattern: "/repositories/{repoID}/pools/{poolID}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &UpdateRepoPoolReader{formats: a.formats}, + 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.(*UpdateRepoPoolOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UpdateRepoPoolDefault) return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } diff --git a/client/repositories/update_repo_parameters.go b/client/repositories/update_repo_parameters.go new file mode 100644 index 00000000..58297812 --- /dev/null +++ b/client/repositories/update_repo_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// 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" + + garm_params "github.com/cloudbase/garm/params" +) + +// NewUpdateRepoParams creates a new UpdateRepoParams 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 NewUpdateRepoParams() *UpdateRepoParams { + return &UpdateRepoParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateRepoParamsWithTimeout creates a new UpdateRepoParams object +// with the ability to set a timeout on a request. +func NewUpdateRepoParamsWithTimeout(timeout time.Duration) *UpdateRepoParams { + return &UpdateRepoParams{ + timeout: timeout, + } +} + +// NewUpdateRepoParamsWithContext creates a new UpdateRepoParams object +// with the ability to set a context for a request. +func NewUpdateRepoParamsWithContext(ctx context.Context) *UpdateRepoParams { + return &UpdateRepoParams{ + Context: ctx, + } +} + +// NewUpdateRepoParamsWithHTTPClient creates a new UpdateRepoParams object +// with the ability to set a custom HTTPClient for a request. +func NewUpdateRepoParamsWithHTTPClient(client *http.Client) *UpdateRepoParams { + return &UpdateRepoParams{ + HTTPClient: client, + } +} + +/* +UpdateRepoParams contains all the parameters to send to the API endpoint + + for the update repo operation. + + Typically these are written to a http.Request. +*/ +type UpdateRepoParams struct { + + /* Body. + + Parameters used when updating the repository. + */ + Body garm_params.UpdateEntityParams + + /* RepoID. + + ID of the repository to update. + */ + RepoID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the update repo params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateRepoParams) WithDefaults() *UpdateRepoParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the update repo params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateRepoParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the update repo params +func (o *UpdateRepoParams) WithTimeout(timeout time.Duration) *UpdateRepoParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update repo params +func (o *UpdateRepoParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update repo params +func (o *UpdateRepoParams) WithContext(ctx context.Context) *UpdateRepoParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update repo params +func (o *UpdateRepoParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update repo params +func (o *UpdateRepoParams) WithHTTPClient(client *http.Client) *UpdateRepoParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update repo params +func (o *UpdateRepoParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the update repo params +func (o *UpdateRepoParams) WithBody(body garm_params.UpdateEntityParams) *UpdateRepoParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the update repo params +func (o *UpdateRepoParams) SetBody(body garm_params.UpdateEntityParams) { + o.Body = body +} + +// WithRepoID adds the repoID to the update repo params +func (o *UpdateRepoParams) WithRepoID(repoID string) *UpdateRepoParams { + o.SetRepoID(repoID) + return o +} + +// SetRepoID adds the repoId to the update repo params +func (o *UpdateRepoParams) SetRepoID(repoID string) { + o.RepoID = repoID +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateRepoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param repoID + if err := r.SetPathParam("repoID", o.RepoID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/repositories/update_repo_pool_parameters.go b/client/repositories/update_repo_pool_parameters.go new file mode 100644 index 00000000..e96b6b94 --- /dev/null +++ b/client/repositories/update_repo_pool_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// 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" + + garm_params "github.com/cloudbase/garm/params" +) + +// NewUpdateRepoPoolParams creates a new UpdateRepoPoolParams 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 NewUpdateRepoPoolParams() *UpdateRepoPoolParams { + return &UpdateRepoPoolParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateRepoPoolParamsWithTimeout creates a new UpdateRepoPoolParams object +// with the ability to set a timeout on a request. +func NewUpdateRepoPoolParamsWithTimeout(timeout time.Duration) *UpdateRepoPoolParams { + return &UpdateRepoPoolParams{ + timeout: timeout, + } +} + +// NewUpdateRepoPoolParamsWithContext creates a new UpdateRepoPoolParams object +// with the ability to set a context for a request. +func NewUpdateRepoPoolParamsWithContext(ctx context.Context) *UpdateRepoPoolParams { + return &UpdateRepoPoolParams{ + Context: ctx, + } +} + +// NewUpdateRepoPoolParamsWithHTTPClient creates a new UpdateRepoPoolParams object +// with the ability to set a custom HTTPClient for a request. +func NewUpdateRepoPoolParamsWithHTTPClient(client *http.Client) *UpdateRepoPoolParams { + return &UpdateRepoPoolParams{ + HTTPClient: client, + } +} + +/* +UpdateRepoPoolParams contains all the parameters to send to the API endpoint + + for the update repo pool operation. + + Typically these are written to a http.Request. +*/ +type UpdateRepoPoolParams struct { + + /* Body. + + Parameters used when updating the repository pool. + */ + Body garm_params.UpdatePoolParams + + /* PoolID. + + ID of the repository pool to update. + */ + PoolID string + + /* RepoID. + + Repository ID. + */ + RepoID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the update repo pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateRepoPoolParams) WithDefaults() *UpdateRepoPoolParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the update repo pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateRepoPoolParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the update repo pool params +func (o *UpdateRepoPoolParams) WithTimeout(timeout time.Duration) *UpdateRepoPoolParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update repo pool params +func (o *UpdateRepoPoolParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update repo pool params +func (o *UpdateRepoPoolParams) WithContext(ctx context.Context) *UpdateRepoPoolParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update repo pool params +func (o *UpdateRepoPoolParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update repo pool params +func (o *UpdateRepoPoolParams) WithHTTPClient(client *http.Client) *UpdateRepoPoolParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update repo pool params +func (o *UpdateRepoPoolParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the update repo pool params +func (o *UpdateRepoPoolParams) WithBody(body garm_params.UpdatePoolParams) *UpdateRepoPoolParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the update repo pool params +func (o *UpdateRepoPoolParams) SetBody(body garm_params.UpdatePoolParams) { + o.Body = body +} + +// WithPoolID adds the poolID to the update repo pool params +func (o *UpdateRepoPoolParams) WithPoolID(poolID string) *UpdateRepoPoolParams { + o.SetPoolID(poolID) + return o +} + +// SetPoolID adds the poolId to the update repo pool params +func (o *UpdateRepoPoolParams) SetPoolID(poolID string) { + o.PoolID = poolID +} + +// WithRepoID adds the repoID to the update repo pool params +func (o *UpdateRepoPoolParams) WithRepoID(repoID string) *UpdateRepoPoolParams { + o.SetRepoID(repoID) + return o +} + +// SetRepoID adds the repoId to the update repo pool params +func (o *UpdateRepoPoolParams) SetRepoID(repoID string) { + o.RepoID = repoID +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateRepoPoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param poolID + if err := r.SetPathParam("poolID", o.PoolID); err != nil { + return err + } + + // path param repoID + if err := r.SetPathParam("repoID", o.RepoID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/repositories/update_repo_pool_responses.go b/client/repositories/update_repo_pool_responses.go new file mode 100644 index 00000000..e9f7a7e4 --- /dev/null +++ b/client/repositories/update_repo_pool_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" + garm_params "github.com/cloudbase/garm/params" +) + +// UpdateRepoPoolReader is a Reader for the UpdateRepoPool structure. +type UpdateRepoPoolReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateRepoPoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateRepoPoolOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUpdateRepoPoolDefault(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 + } +} + +// NewUpdateRepoPoolOK creates a UpdateRepoPoolOK with default headers values +func NewUpdateRepoPoolOK() *UpdateRepoPoolOK { + return &UpdateRepoPoolOK{} +} + +/* +UpdateRepoPoolOK describes a response with status code 200, with default header values. + +Pool +*/ +type UpdateRepoPoolOK struct { + Payload garm_params.Pool +} + +// IsSuccess returns true when this update repo pool o k response has a 2xx status code +func (o *UpdateRepoPoolOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this update repo pool o k response has a 3xx status code +func (o *UpdateRepoPoolOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update repo pool o k response has a 4xx status code +func (o *UpdateRepoPoolOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this update repo pool o k response has a 5xx status code +func (o *UpdateRepoPoolOK) IsServerError() bool { + return false +} + +// IsCode returns true when this update repo pool o k response a status code equal to that given +func (o *UpdateRepoPoolOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the update repo pool o k response +func (o *UpdateRepoPoolOK) Code() int { + return 200 +} + +func (o *UpdateRepoPoolOK) Error() string { + return fmt.Sprintf("[PUT /repositories/{repoID}/pools/{poolID}][%d] updateRepoPoolOK %+v", 200, o.Payload) +} + +func (o *UpdateRepoPoolOK) String() string { + return fmt.Sprintf("[PUT /repositories/{repoID}/pools/{poolID}][%d] updateRepoPoolOK %+v", 200, o.Payload) +} + +func (o *UpdateRepoPoolOK) GetPayload() garm_params.Pool { + return o.Payload +} + +func (o *UpdateRepoPoolOK) 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 +} + +// NewUpdateRepoPoolDefault creates a UpdateRepoPoolDefault with default headers values +func NewUpdateRepoPoolDefault(code int) *UpdateRepoPoolDefault { + return &UpdateRepoPoolDefault{ + _statusCode: code, + } +} + +/* +UpdateRepoPoolDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type UpdateRepoPoolDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this update repo pool default response has a 2xx status code +func (o *UpdateRepoPoolDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this update repo pool default response has a 3xx status code +func (o *UpdateRepoPoolDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this update repo pool default response has a 4xx status code +func (o *UpdateRepoPoolDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this update repo pool default response has a 5xx status code +func (o *UpdateRepoPoolDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this update repo pool default response a status code equal to that given +func (o *UpdateRepoPoolDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the update repo pool default response +func (o *UpdateRepoPoolDefault) Code() int { + return o._statusCode +} + +func (o *UpdateRepoPoolDefault) Error() string { + return fmt.Sprintf("[PUT /repositories/{repoID}/pools/{poolID}][%d] UpdateRepoPool default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateRepoPoolDefault) String() string { + return fmt.Sprintf("[PUT /repositories/{repoID}/pools/{poolID}][%d] UpdateRepoPool default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateRepoPoolDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *UpdateRepoPoolDefault) 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 +} diff --git a/client/repositories/update_repo_responses.go b/client/repositories/update_repo_responses.go new file mode 100644 index 00000000..26b6fd8a --- /dev/null +++ b/client/repositories/update_repo_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package repositories + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + apiserver_params "github.com/cloudbase/garm/apiserver/params" + garm_params "github.com/cloudbase/garm/params" +) + +// UpdateRepoReader is a Reader for the UpdateRepo structure. +type UpdateRepoReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateRepoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateRepoOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUpdateRepoDefault(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 + } +} + +// NewUpdateRepoOK creates a UpdateRepoOK with default headers values +func NewUpdateRepoOK() *UpdateRepoOK { + return &UpdateRepoOK{} +} + +/* +UpdateRepoOK describes a response with status code 200, with default header values. + +Repository +*/ +type UpdateRepoOK struct { + Payload garm_params.Repository +} + +// IsSuccess returns true when this update repo o k response has a 2xx status code +func (o *UpdateRepoOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this update repo o k response has a 3xx status code +func (o *UpdateRepoOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update repo o k response has a 4xx status code +func (o *UpdateRepoOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this update repo o k response has a 5xx status code +func (o *UpdateRepoOK) IsServerError() bool { + return false +} + +// IsCode returns true when this update repo o k response a status code equal to that given +func (o *UpdateRepoOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the update repo o k response +func (o *UpdateRepoOK) Code() int { + return 200 +} + +func (o *UpdateRepoOK) Error() string { + return fmt.Sprintf("[PUT /repositories/{repoID}][%d] updateRepoOK %+v", 200, o.Payload) +} + +func (o *UpdateRepoOK) String() string { + return fmt.Sprintf("[PUT /repositories/{repoID}][%d] updateRepoOK %+v", 200, o.Payload) +} + +func (o *UpdateRepoOK) GetPayload() garm_params.Repository { + return o.Payload +} + +func (o *UpdateRepoOK) 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 +} + +// NewUpdateRepoDefault creates a UpdateRepoDefault with default headers values +func NewUpdateRepoDefault(code int) *UpdateRepoDefault { + return &UpdateRepoDefault{ + _statusCode: code, + } +} + +/* +UpdateRepoDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type UpdateRepoDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this update repo default response has a 2xx status code +func (o *UpdateRepoDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this update repo default response has a 3xx status code +func (o *UpdateRepoDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this update repo default response has a 4xx status code +func (o *UpdateRepoDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this update repo default response has a 5xx status code +func (o *UpdateRepoDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this update repo default response a status code equal to that given +func (o *UpdateRepoDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the update repo default response +func (o *UpdateRepoDefault) Code() int { + return o._statusCode +} + +func (o *UpdateRepoDefault) Error() string { + return fmt.Sprintf("[PUT /repositories/{repoID}][%d] UpdateRepo default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateRepoDefault) String() string { + return fmt.Sprintf("[PUT /repositories/{repoID}][%d] UpdateRepo default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateRepoDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *UpdateRepoDefault) 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 +}