diff --git a/apiserver/controllers/enterprises.go b/apiserver/controllers/enterprises.go index 1a3c1b5d..5ade050a 100644 --- a/apiserver/controllers/enterprises.go +++ b/apiserver/controllers/enterprises.go @@ -26,6 +26,20 @@ import ( "github.com/gorilla/mux" ) +// swagger:route POST /enterprises enterprises CreateEnterprise +// +// Create enterprise with the given parameters. +// +// Parameters: +// + name: Body +// description: Parameters used to create the enterprise. +// type: CreateEnterpriseParams +// in: body +// required: true +// +// Responses: +// 200: Enterprise +// default: APIErrorResponse func (a *APIController) CreateEnterpriseHandler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() @@ -48,6 +62,13 @@ func (a *APIController) CreateEnterpriseHandler(w http.ResponseWriter, r *http.R } } +// swagger:route GET /enterprises enterprises ListEnterprises +// +// List all enterprises. +// +// Responses: +// 200: Enterprises +// default: APIErrorResponse func (a *APIController) ListEnterprisesHandler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() @@ -64,6 +85,20 @@ func (a *APIController) ListEnterprisesHandler(w http.ResponseWriter, r *http.Re } } +// swagger:route GET /enterprises/{enterpriseID} enterprises GetEnterprise +// +// Get enterprise by ID. +// +// Parameters: +// + name: enterpriseID +// description: The ID of the enterprise to fetch. +// type: string +// in: path +// required: true +// +// Responses: +// 200: Enterprise +// default: APIErrorResponse func (a *APIController) GetEnterpriseByIDHandler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() @@ -93,6 +128,19 @@ func (a *APIController) GetEnterpriseByIDHandler(w http.ResponseWriter, r *http. } } +// swagger:route DELETE /enterprises/{enterpriseID} enterprises DeleteEnterprise +// +// Delete enterprise by ID. +// +// Parameters: +// + name: enterpriseID +// description: ID of the enterprise to delete. +// type: string +// in: path +// required: true +// +// Responses: +// default: APIErrorResponse func (a *APIController) DeleteEnterpriseHandler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() @@ -120,6 +168,25 @@ func (a *APIController) DeleteEnterpriseHandler(w http.ResponseWriter, r *http.R } +// swagger:route PUT /enterprises/{enterpriseID} enterprises UpdateEnterprise +// +// Update enterprise with the given parameters. +// +// Parameters: +// + name: enterpriseID +// description: The ID of the enterprise to update. +// type: string +// in: path +// required: true +// + name: Body +// description: Parameters used when updating the enterprise. +// type: UpdateEntityParams +// in: body +// required: true +// +// Responses: +// 200: Enterprise +// default: APIErrorResponse func (a *APIController) UpdateEnterpriseHandler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() @@ -155,6 +222,26 @@ func (a *APIController) UpdateEnterpriseHandler(w http.ResponseWriter, r *http.R } } +// swagger:route POST /enterprises/{enterpriseID}/pools enterprises pools CreateEnterprisePool +// +// Create enterprise pool with the parameters given. +// +// Parameters: +// + name: enterpriseID +// description: Enterprise ID. +// type: string +// in: path +// required: true +// +// + name: Body +// description: Parameters used when creating the enterprise pool. +// type: CreatePoolParams +// in: body +// required: true +// +// Responses: +// 200: Pool +// default: APIErrorResponse func (a *APIController) CreateEnterprisePoolHandler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() @@ -191,6 +278,20 @@ func (a *APIController) CreateEnterprisePoolHandler(w http.ResponseWriter, r *ht } } +// swagger:route GET /enterprises/{enterpriseID}/pools enterprises pools ListEnterprisePools +// +// List enterprise pools. +// +// Parameters: +// + name: enterpriseID +// description: Enterprise ID. +// type: string +// in: path +// required: true +// +// Responses: +// 200: Pools +// default: APIErrorResponse func (a *APIController) ListEnterprisePoolsHandler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() vars := mux.Vars(r) @@ -220,6 +321,26 @@ func (a *APIController) ListEnterprisePoolsHandler(w http.ResponseWriter, r *htt } +// swagger:route GET /enterprises/{enterpriseID}/pools/{poolID} enterprises pools GetEnterprisePool +// +// Get enterprise pool by ID. +// +// Parameters: +// + name: enterpriseID +// description: Enterprise ID. +// type: string +// in: path +// required: true +// +// + name: poolID +// description: Pool ID. +// type: string +// in: path +// required: true +// +// Responses: +// 200: Pool +// default: APIErrorResponse func (a *APIController) GetEnterprisePoolHandler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() vars := mux.Vars(r) @@ -249,6 +370,25 @@ func (a *APIController) GetEnterprisePoolHandler(w http.ResponseWriter, r *http. } } +// swagger:route DELETE /enterprises/{enterpriseID}/pools/{poolID} enterprises pools DeleteEnterprisePool +// +// Delete enterprise pool by ID. +// +// Parameters: +// + name: enterpriseID +// description: Enterprise ID. +// type: string +// in: path +// required: true +// +// + name: poolID +// description: ID of the enterprise pool to delete. +// type: string +// in: path +// required: true +// +// Responses: +// default: APIErrorResponse func (a *APIController) DeleteEnterprisePoolHandler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() @@ -277,6 +417,32 @@ func (a *APIController) DeleteEnterprisePoolHandler(w http.ResponseWriter, r *ht } +// swagger:route PUT /enterprises/{enterpriseID}/pools/{poolID} enterprises pools UpdateEnterprisePool +// +// Update enterprise pool with the parameters given. +// +// Parameters: +// + name: enterpriseID +// description: Enterprise ID. +// type: string +// in: path +// required: true +// +// + name: poolID +// description: ID of the enterprise pool to update. +// type: string +// in: path +// required: true +// +// + name: Body +// description: Parameters used when updating the enterprise pool. +// type: UpdatePoolParams +// in: body +// required: true +// +// Responses: +// 200: Pool +// default: APIErrorResponse func (a *APIController) UpdateEnterprisePoolHandler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() diff --git a/apiserver/controllers/instances.go b/apiserver/controllers/instances.go index a9ea528e..35962c36 100644 --- a/apiserver/controllers/instances.go +++ b/apiserver/controllers/instances.go @@ -232,6 +232,20 @@ func (a *APIController) ListOrgInstancesHandler(w http.ResponseWriter, r *http.R } } +// swagger:route GET /enterprises/{enterpriseID}/instances enterprises instances ListEnterpriseInstances +// +// List enterprise instances. +// +// Parameters: +// + name: enterpriseID +// description: Enterprise ID. +// type: string +// in: path +// required: true +// +// Responses: +// 200: Instances +// default: APIErrorResponse func (a *APIController) ListEnterpriseInstancesHandler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() vars := mux.Vars(r) diff --git a/apiserver/swagger-models.yaml b/apiserver/swagger-models.yaml index c3cddd1d..417f178a 100644 --- a/apiserver/swagger-models.yaml +++ b/apiserver/swagger-models.yaml @@ -155,6 +155,29 @@ definitions: import: package: github.com/cloudbase/garm/params alias: garm_params + Enterprises: + type: array + x-go-type: + type: Enterprises + import: + package: github.com/cloudbase/garm/params + alias: garm_params + items: + $ref: '#/definitions/Enterprise' + Enterprise: + type: object + x-go-type: + type: Enterprise + import: + package: github.com/cloudbase/garm/params + alias: garm_params + CreateEnterpriseParams: + type: object + x-go-type: + type: CreateEnterpriseParams + import: + package: github.com/cloudbase/garm/params + alias: garm_params UpdateEntityParams: type: object x-go-type: diff --git a/apiserver/swagger.yaml b/apiserver/swagger.yaml index 73dd5ced..325d7d3d 100644 --- a/apiserver/swagger.yaml +++ b/apiserver/swagger.yaml @@ -9,6 +9,13 @@ definitions: alias: apiserver_params package: github.com/cloudbase/garm/apiserver/params type: APIErrorResponse + CreateEnterpriseParams: + type: object + x-go-type: + import: + alias: garm_params + package: github.com/cloudbase/garm/params + type: CreateEnterpriseParams CreateOrgParams: type: object x-go-type: @@ -39,6 +46,22 @@ definitions: alias: garm_params package: github.com/cloudbase/garm/params type: Credentials + Enterprise: + type: object + x-go-type: + import: + alias: garm_params + package: github.com/cloudbase/garm/params + type: Enterprise + Enterprises: + items: + $ref: '#/definitions/Enterprise' + type: array + x-go-type: + import: + alias: garm_params + package: github.com/cloudbase/garm/params + type: Enterprises GithubCredentials: type: object x-go-type: @@ -231,6 +254,265 @@ paths: summary: List all credentials. tags: - credentials + /enterprises: + get: + operationId: ListEnterprises + responses: + "200": + description: Enterprises + schema: + $ref: '#/definitions/Enterprises' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: List all enterprises. + tags: + - enterprises + post: + operationId: CreateEnterprise + parameters: + - description: Parameters used to create the enterprise. + in: body + name: Body + required: true + schema: + $ref: '#/definitions/CreateEnterpriseParams' + description: Parameters used to create the enterprise. + type: object + responses: + "200": + description: Enterprise + schema: + $ref: '#/definitions/Enterprise' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Create enterprise with the given parameters. + tags: + - enterprises + /enterprises/{enterpriseID}: + delete: + operationId: DeleteEnterprise + parameters: + - description: ID of the enterprise to delete. + in: path + name: enterpriseID + required: true + type: string + responses: + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Delete enterprise by ID. + tags: + - enterprises + get: + operationId: GetEnterprise + parameters: + - description: The ID of the enterprise to fetch. + in: path + name: enterpriseID + required: true + type: string + responses: + "200": + description: Enterprise + schema: + $ref: '#/definitions/Enterprise' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Get enterprise by ID. + tags: + - enterprises + put: + operationId: UpdateEnterprise + parameters: + - description: The ID of the enterprise to update. + in: path + name: enterpriseID + required: true + type: string + - description: Parameters used to update the enterprise. + in: body + name: Body + required: true + schema: + $ref: '#/definitions/UpdateEntityParams' + description: Parameters used to update the enterprise. + type: object + responses: + "200": + description: Enterprise + schema: + $ref: '#/definitions/Enterprise' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Update an enterprise with the given parameters. + tags: + - enterprises + /enterprises/{enterpriseID}/instances: + get: + operationId: ListEnterpriseInstances + parameters: + - description: Enterprise ID. + in: path + name: enterpriseID + required: true + type: string + responses: + "200": + description: Instances + schema: + $ref: '#/definitions/Instances' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: List enterprise instances. + tags: + - enterprises + - instances + /enterprises/{enterpriseID}/pools: + get: + operationId: ListEnterprisePools + parameters: + - description: Enterprise ID. + in: path + name: enterpriseID + required: true + type: string + responses: + "200": + description: Pools + schema: + $ref: '#/definitions/Pools' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: List enterprise pools. + tags: + - enterprises + - pools + post: + operationId: CreateEnterprisePool + parameters: + - description: Enterprise ID. + in: path + name: enterpriseID + required: true + type: string + - description: Parameters used when creating the enterprise pool. + in: body + name: Body + required: true + schema: + $ref: '#/definitions/CreatePoolParams' + description: Parameters used when creating the enterprise pool. + type: object + responses: + "200": + description: Pool + schema: + $ref: '#/definitions/Pool' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Create enterprise pool with the parameters given. + tags: + - enterprises + - pools + /enterprises/{enterpriseID}/pools/{poolID}: + delete: + operationId: DeleteEnterprisePool + parameters: + - description: Enterprise ID. + in: path + name: enterpriseID + required: true + type: string + - description: ID of the enterprise pool to delete. + in: path + name: poolID + required: true + type: string + responses: + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Delete enterprise pool by ID. + tags: + - enterprises + - pools + get: + operationId: GetEnterprisePool + parameters: + - description: Enterprise ID. + in: path + name: enterpriseID + 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 enterprise pool by ID. + tags: + - enterprises + - pools + put: + operationId: UpdateEnterprisePool + parameters: + - description: Enterprise ID. + in: path + name: enterpriseID + required: true + type: string + - description: ID of the enterprise pool to update. + in: path + name: poolID + required: true + type: string + - description: Parameters used when updating the enterprise pool. + in: body + name: Body + required: true + schema: + $ref: '#/definitions/UpdatePoolParams' + description: Parameters used when updating the enterprise pool. + type: object + responses: + "200": + description: Pool + schema: + $ref: '#/definitions/Pool' + default: + description: APIErrorResponse + schema: + $ref: '#/definitions/APIErrorResponse' + summary: Update enterprise pool with the parameters given. + tags: + - enterprises + - pools /first-run: post: operationId: FirstRun diff --git a/client/enterprises/create_enterprise_parameters.go b/client/enterprises/create_enterprise_parameters.go new file mode 100644 index 00000000..9b62264a --- /dev/null +++ b/client/enterprises/create_enterprise_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// NewCreateEnterpriseParams creates a new CreateEnterpriseParams 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 NewCreateEnterpriseParams() *CreateEnterpriseParams { + return &CreateEnterpriseParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCreateEnterpriseParamsWithTimeout creates a new CreateEnterpriseParams object +// with the ability to set a timeout on a request. +func NewCreateEnterpriseParamsWithTimeout(timeout time.Duration) *CreateEnterpriseParams { + return &CreateEnterpriseParams{ + timeout: timeout, + } +} + +// NewCreateEnterpriseParamsWithContext creates a new CreateEnterpriseParams object +// with the ability to set a context for a request. +func NewCreateEnterpriseParamsWithContext(ctx context.Context) *CreateEnterpriseParams { + return &CreateEnterpriseParams{ + Context: ctx, + } +} + +// NewCreateEnterpriseParamsWithHTTPClient creates a new CreateEnterpriseParams object +// with the ability to set a custom HTTPClient for a request. +func NewCreateEnterpriseParamsWithHTTPClient(client *http.Client) *CreateEnterpriseParams { + return &CreateEnterpriseParams{ + HTTPClient: client, + } +} + +/* +CreateEnterpriseParams contains all the parameters to send to the API endpoint + + for the create enterprise operation. + + Typically these are written to a http.Request. +*/ +type CreateEnterpriseParams struct { + + /* Body. + + Parameters used to create the enterprise. + */ + Body garm_params.CreateEnterpriseParams + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the create enterprise params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateEnterpriseParams) WithDefaults() *CreateEnterpriseParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the create enterprise params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateEnterpriseParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the create enterprise params +func (o *CreateEnterpriseParams) WithTimeout(timeout time.Duration) *CreateEnterpriseParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create enterprise params +func (o *CreateEnterpriseParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create enterprise params +func (o *CreateEnterpriseParams) WithContext(ctx context.Context) *CreateEnterpriseParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create enterprise params +func (o *CreateEnterpriseParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create enterprise params +func (o *CreateEnterpriseParams) WithHTTPClient(client *http.Client) *CreateEnterpriseParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create enterprise params +func (o *CreateEnterpriseParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the create enterprise params +func (o *CreateEnterpriseParams) WithBody(body garm_params.CreateEnterpriseParams) *CreateEnterpriseParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the create enterprise params +func (o *CreateEnterpriseParams) SetBody(body garm_params.CreateEnterpriseParams) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateEnterpriseParams) 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/enterprises/create_enterprise_pool_parameters.go b/client/enterprises/create_enterprise_pool_parameters.go new file mode 100644 index 00000000..348d080e --- /dev/null +++ b/client/enterprises/create_enterprise_pool_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// NewCreateEnterprisePoolParams creates a new CreateEnterprisePoolParams 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 NewCreateEnterprisePoolParams() *CreateEnterprisePoolParams { + return &CreateEnterprisePoolParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCreateEnterprisePoolParamsWithTimeout creates a new CreateEnterprisePoolParams object +// with the ability to set a timeout on a request. +func NewCreateEnterprisePoolParamsWithTimeout(timeout time.Duration) *CreateEnterprisePoolParams { + return &CreateEnterprisePoolParams{ + timeout: timeout, + } +} + +// NewCreateEnterprisePoolParamsWithContext creates a new CreateEnterprisePoolParams object +// with the ability to set a context for a request. +func NewCreateEnterprisePoolParamsWithContext(ctx context.Context) *CreateEnterprisePoolParams { + return &CreateEnterprisePoolParams{ + Context: ctx, + } +} + +// NewCreateEnterprisePoolParamsWithHTTPClient creates a new CreateEnterprisePoolParams object +// with the ability to set a custom HTTPClient for a request. +func NewCreateEnterprisePoolParamsWithHTTPClient(client *http.Client) *CreateEnterprisePoolParams { + return &CreateEnterprisePoolParams{ + HTTPClient: client, + } +} + +/* +CreateEnterprisePoolParams contains all the parameters to send to the API endpoint + + for the create enterprise pool operation. + + Typically these are written to a http.Request. +*/ +type CreateEnterprisePoolParams struct { + + /* Body. + + Parameters used when creating the enterprise pool. + */ + Body garm_params.CreatePoolParams + + /* EnterpriseID. + + Enterprise ID. + */ + EnterpriseID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the create enterprise pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateEnterprisePoolParams) WithDefaults() *CreateEnterprisePoolParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the create enterprise pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateEnterprisePoolParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the create enterprise pool params +func (o *CreateEnterprisePoolParams) WithTimeout(timeout time.Duration) *CreateEnterprisePoolParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create enterprise pool params +func (o *CreateEnterprisePoolParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create enterprise pool params +func (o *CreateEnterprisePoolParams) WithContext(ctx context.Context) *CreateEnterprisePoolParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create enterprise pool params +func (o *CreateEnterprisePoolParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create enterprise pool params +func (o *CreateEnterprisePoolParams) WithHTTPClient(client *http.Client) *CreateEnterprisePoolParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create enterprise pool params +func (o *CreateEnterprisePoolParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the create enterprise pool params +func (o *CreateEnterprisePoolParams) WithBody(body garm_params.CreatePoolParams) *CreateEnterprisePoolParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the create enterprise pool params +func (o *CreateEnterprisePoolParams) SetBody(body garm_params.CreatePoolParams) { + o.Body = body +} + +// WithEnterpriseID adds the enterpriseID to the create enterprise pool params +func (o *CreateEnterprisePoolParams) WithEnterpriseID(enterpriseID string) *CreateEnterprisePoolParams { + o.SetEnterpriseID(enterpriseID) + return o +} + +// SetEnterpriseID adds the enterpriseId to the create enterprise pool params +func (o *CreateEnterprisePoolParams) SetEnterpriseID(enterpriseID string) { + o.EnterpriseID = enterpriseID +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateEnterprisePoolParams) 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 enterpriseID + if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/enterprises/create_enterprise_pool_responses.go b/client/enterprises/create_enterprise_pool_responses.go new file mode 100644 index 00000000..55acec14 --- /dev/null +++ b/client/enterprises/create_enterprise_pool_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// CreateEnterprisePoolReader is a Reader for the CreateEnterprisePool structure. +type CreateEnterprisePoolReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateEnterprisePoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateEnterprisePoolOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewCreateEnterprisePoolDefault(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 + } +} + +// NewCreateEnterprisePoolOK creates a CreateEnterprisePoolOK with default headers values +func NewCreateEnterprisePoolOK() *CreateEnterprisePoolOK { + return &CreateEnterprisePoolOK{} +} + +/* +CreateEnterprisePoolOK describes a response with status code 200, with default header values. + +Pool +*/ +type CreateEnterprisePoolOK struct { + Payload garm_params.Pool +} + +// IsSuccess returns true when this create enterprise pool o k response has a 2xx status code +func (o *CreateEnterprisePoolOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this create enterprise pool o k response has a 3xx status code +func (o *CreateEnterprisePoolOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create enterprise pool o k response has a 4xx status code +func (o *CreateEnterprisePoolOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this create enterprise pool o k response has a 5xx status code +func (o *CreateEnterprisePoolOK) IsServerError() bool { + return false +} + +// IsCode returns true when this create enterprise pool o k response a status code equal to that given +func (o *CreateEnterprisePoolOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the create enterprise pool o k response +func (o *CreateEnterprisePoolOK) Code() int { + return 200 +} + +func (o *CreateEnterprisePoolOK) Error() string { + return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] createEnterprisePoolOK %+v", 200, o.Payload) +} + +func (o *CreateEnterprisePoolOK) String() string { + return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] createEnterprisePoolOK %+v", 200, o.Payload) +} + +func (o *CreateEnterprisePoolOK) GetPayload() garm_params.Pool { + return o.Payload +} + +func (o *CreateEnterprisePoolOK) 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 +} + +// NewCreateEnterprisePoolDefault creates a CreateEnterprisePoolDefault with default headers values +func NewCreateEnterprisePoolDefault(code int) *CreateEnterprisePoolDefault { + return &CreateEnterprisePoolDefault{ + _statusCode: code, + } +} + +/* +CreateEnterprisePoolDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type CreateEnterprisePoolDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this create enterprise pool default response has a 2xx status code +func (o *CreateEnterprisePoolDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this create enterprise pool default response has a 3xx status code +func (o *CreateEnterprisePoolDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this create enterprise pool default response has a 4xx status code +func (o *CreateEnterprisePoolDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this create enterprise pool default response has a 5xx status code +func (o *CreateEnterprisePoolDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this create enterprise pool default response a status code equal to that given +func (o *CreateEnterprisePoolDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the create enterprise pool default response +func (o *CreateEnterprisePoolDefault) Code() int { + return o._statusCode +} + +func (o *CreateEnterprisePoolDefault) Error() string { + return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] CreateEnterprisePool default %+v", o._statusCode, o.Payload) +} + +func (o *CreateEnterprisePoolDefault) String() string { + return fmt.Sprintf("[POST /enterprises/{enterpriseID}/pools][%d] CreateEnterprisePool default %+v", o._statusCode, o.Payload) +} + +func (o *CreateEnterprisePoolDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *CreateEnterprisePoolDefault) 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/enterprises/create_enterprise_responses.go b/client/enterprises/create_enterprise_responses.go new file mode 100644 index 00000000..04a8bdfa --- /dev/null +++ b/client/enterprises/create_enterprise_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// CreateEnterpriseReader is a Reader for the CreateEnterprise structure. +type CreateEnterpriseReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateEnterpriseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateEnterpriseOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewCreateEnterpriseDefault(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 + } +} + +// NewCreateEnterpriseOK creates a CreateEnterpriseOK with default headers values +func NewCreateEnterpriseOK() *CreateEnterpriseOK { + return &CreateEnterpriseOK{} +} + +/* +CreateEnterpriseOK describes a response with status code 200, with default header values. + +Enterprise +*/ +type CreateEnterpriseOK struct { + Payload garm_params.Enterprise +} + +// IsSuccess returns true when this create enterprise o k response has a 2xx status code +func (o *CreateEnterpriseOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this create enterprise o k response has a 3xx status code +func (o *CreateEnterpriseOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create enterprise o k response has a 4xx status code +func (o *CreateEnterpriseOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this create enterprise o k response has a 5xx status code +func (o *CreateEnterpriseOK) IsServerError() bool { + return false +} + +// IsCode returns true when this create enterprise o k response a status code equal to that given +func (o *CreateEnterpriseOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the create enterprise o k response +func (o *CreateEnterpriseOK) Code() int { + return 200 +} + +func (o *CreateEnterpriseOK) Error() string { + return fmt.Sprintf("[POST /enterprises][%d] createEnterpriseOK %+v", 200, o.Payload) +} + +func (o *CreateEnterpriseOK) String() string { + return fmt.Sprintf("[POST /enterprises][%d] createEnterpriseOK %+v", 200, o.Payload) +} + +func (o *CreateEnterpriseOK) GetPayload() garm_params.Enterprise { + return o.Payload +} + +func (o *CreateEnterpriseOK) 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 +} + +// NewCreateEnterpriseDefault creates a CreateEnterpriseDefault with default headers values +func NewCreateEnterpriseDefault(code int) *CreateEnterpriseDefault { + return &CreateEnterpriseDefault{ + _statusCode: code, + } +} + +/* +CreateEnterpriseDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type CreateEnterpriseDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this create enterprise default response has a 2xx status code +func (o *CreateEnterpriseDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this create enterprise default response has a 3xx status code +func (o *CreateEnterpriseDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this create enterprise default response has a 4xx status code +func (o *CreateEnterpriseDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this create enterprise default response has a 5xx status code +func (o *CreateEnterpriseDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this create enterprise default response a status code equal to that given +func (o *CreateEnterpriseDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the create enterprise default response +func (o *CreateEnterpriseDefault) Code() int { + return o._statusCode +} + +func (o *CreateEnterpriseDefault) Error() string { + return fmt.Sprintf("[POST /enterprises][%d] CreateEnterprise default %+v", o._statusCode, o.Payload) +} + +func (o *CreateEnterpriseDefault) String() string { + return fmt.Sprintf("[POST /enterprises][%d] CreateEnterprise default %+v", o._statusCode, o.Payload) +} + +func (o *CreateEnterpriseDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *CreateEnterpriseDefault) 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/enterprises/delete_enterprise_parameters.go b/client/enterprises/delete_enterprise_parameters.go new file mode 100644 index 00000000..5b6b7e5e --- /dev/null +++ b/client/enterprises/delete_enterprise_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// NewDeleteEnterpriseParams creates a new DeleteEnterpriseParams 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 NewDeleteEnterpriseParams() *DeleteEnterpriseParams { + return &DeleteEnterpriseParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteEnterpriseParamsWithTimeout creates a new DeleteEnterpriseParams object +// with the ability to set a timeout on a request. +func NewDeleteEnterpriseParamsWithTimeout(timeout time.Duration) *DeleteEnterpriseParams { + return &DeleteEnterpriseParams{ + timeout: timeout, + } +} + +// NewDeleteEnterpriseParamsWithContext creates a new DeleteEnterpriseParams object +// with the ability to set a context for a request. +func NewDeleteEnterpriseParamsWithContext(ctx context.Context) *DeleteEnterpriseParams { + return &DeleteEnterpriseParams{ + Context: ctx, + } +} + +// NewDeleteEnterpriseParamsWithHTTPClient creates a new DeleteEnterpriseParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteEnterpriseParamsWithHTTPClient(client *http.Client) *DeleteEnterpriseParams { + return &DeleteEnterpriseParams{ + HTTPClient: client, + } +} + +/* +DeleteEnterpriseParams contains all the parameters to send to the API endpoint + + for the delete enterprise operation. + + Typically these are written to a http.Request. +*/ +type DeleteEnterpriseParams struct { + + /* EnterpriseID. + + ID of the enterprise to delete. + */ + EnterpriseID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete enterprise params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteEnterpriseParams) WithDefaults() *DeleteEnterpriseParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete enterprise params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteEnterpriseParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete enterprise params +func (o *DeleteEnterpriseParams) WithTimeout(timeout time.Duration) *DeleteEnterpriseParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete enterprise params +func (o *DeleteEnterpriseParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete enterprise params +func (o *DeleteEnterpriseParams) WithContext(ctx context.Context) *DeleteEnterpriseParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete enterprise params +func (o *DeleteEnterpriseParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete enterprise params +func (o *DeleteEnterpriseParams) WithHTTPClient(client *http.Client) *DeleteEnterpriseParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete enterprise params +func (o *DeleteEnterpriseParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithEnterpriseID adds the enterpriseID to the delete enterprise params +func (o *DeleteEnterpriseParams) WithEnterpriseID(enterpriseID string) *DeleteEnterpriseParams { + o.SetEnterpriseID(enterpriseID) + return o +} + +// SetEnterpriseID adds the enterpriseId to the delete enterprise params +func (o *DeleteEnterpriseParams) SetEnterpriseID(enterpriseID string) { + o.EnterpriseID = enterpriseID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteEnterpriseParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param enterpriseID + if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/enterprises/delete_enterprise_pool_parameters.go b/client/enterprises/delete_enterprise_pool_parameters.go new file mode 100644 index 00000000..bfb7d875 --- /dev/null +++ b/client/enterprises/delete_enterprise_pool_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// NewDeleteEnterprisePoolParams creates a new DeleteEnterprisePoolParams 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 NewDeleteEnterprisePoolParams() *DeleteEnterprisePoolParams { + return &DeleteEnterprisePoolParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteEnterprisePoolParamsWithTimeout creates a new DeleteEnterprisePoolParams object +// with the ability to set a timeout on a request. +func NewDeleteEnterprisePoolParamsWithTimeout(timeout time.Duration) *DeleteEnterprisePoolParams { + return &DeleteEnterprisePoolParams{ + timeout: timeout, + } +} + +// NewDeleteEnterprisePoolParamsWithContext creates a new DeleteEnterprisePoolParams object +// with the ability to set a context for a request. +func NewDeleteEnterprisePoolParamsWithContext(ctx context.Context) *DeleteEnterprisePoolParams { + return &DeleteEnterprisePoolParams{ + Context: ctx, + } +} + +// NewDeleteEnterprisePoolParamsWithHTTPClient creates a new DeleteEnterprisePoolParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteEnterprisePoolParamsWithHTTPClient(client *http.Client) *DeleteEnterprisePoolParams { + return &DeleteEnterprisePoolParams{ + HTTPClient: client, + } +} + +/* +DeleteEnterprisePoolParams contains all the parameters to send to the API endpoint + + for the delete enterprise pool operation. + + Typically these are written to a http.Request. +*/ +type DeleteEnterprisePoolParams struct { + + /* EnterpriseID. + + Enterprise ID. + */ + EnterpriseID string + + /* PoolID. + + ID of the enterprise pool to delete. + */ + PoolID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete enterprise pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteEnterprisePoolParams) WithDefaults() *DeleteEnterprisePoolParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete enterprise pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteEnterprisePoolParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete enterprise pool params +func (o *DeleteEnterprisePoolParams) WithTimeout(timeout time.Duration) *DeleteEnterprisePoolParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete enterprise pool params +func (o *DeleteEnterprisePoolParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete enterprise pool params +func (o *DeleteEnterprisePoolParams) WithContext(ctx context.Context) *DeleteEnterprisePoolParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete enterprise pool params +func (o *DeleteEnterprisePoolParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete enterprise pool params +func (o *DeleteEnterprisePoolParams) WithHTTPClient(client *http.Client) *DeleteEnterprisePoolParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete enterprise pool params +func (o *DeleteEnterprisePoolParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithEnterpriseID adds the enterpriseID to the delete enterprise pool params +func (o *DeleteEnterprisePoolParams) WithEnterpriseID(enterpriseID string) *DeleteEnterprisePoolParams { + o.SetEnterpriseID(enterpriseID) + return o +} + +// SetEnterpriseID adds the enterpriseId to the delete enterprise pool params +func (o *DeleteEnterprisePoolParams) SetEnterpriseID(enterpriseID string) { + o.EnterpriseID = enterpriseID +} + +// WithPoolID adds the poolID to the delete enterprise pool params +func (o *DeleteEnterprisePoolParams) WithPoolID(poolID string) *DeleteEnterprisePoolParams { + o.SetPoolID(poolID) + return o +} + +// SetPoolID adds the poolId to the delete enterprise pool params +func (o *DeleteEnterprisePoolParams) SetPoolID(poolID string) { + o.PoolID = poolID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteEnterprisePoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param enterpriseID + if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil { + return err + } + + // path param poolID + if err := r.SetPathParam("poolID", o.PoolID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/enterprises/delete_enterprise_pool_responses.go b/client/enterprises/delete_enterprise_pool_responses.go new file mode 100644 index 00000000..c0348754 --- /dev/null +++ b/client/enterprises/delete_enterprise_pool_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// DeleteEnterprisePoolReader is a Reader for the DeleteEnterprisePool structure. +type DeleteEnterprisePoolReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteEnterprisePoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + result := NewDeleteEnterprisePoolDefault(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 +} + +// NewDeleteEnterprisePoolDefault creates a DeleteEnterprisePoolDefault with default headers values +func NewDeleteEnterprisePoolDefault(code int) *DeleteEnterprisePoolDefault { + return &DeleteEnterprisePoolDefault{ + _statusCode: code, + } +} + +/* +DeleteEnterprisePoolDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type DeleteEnterprisePoolDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this delete enterprise pool default response has a 2xx status code +func (o *DeleteEnterprisePoolDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this delete enterprise pool default response has a 3xx status code +func (o *DeleteEnterprisePoolDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this delete enterprise pool default response has a 4xx status code +func (o *DeleteEnterprisePoolDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this delete enterprise pool default response has a 5xx status code +func (o *DeleteEnterprisePoolDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this delete enterprise pool default response a status code equal to that given +func (o *DeleteEnterprisePoolDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the delete enterprise pool default response +func (o *DeleteEnterprisePoolDefault) Code() int { + return o._statusCode +} + +func (o *DeleteEnterprisePoolDefault) Error() string { + return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}/pools/{poolID}][%d] DeleteEnterprisePool default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteEnterprisePoolDefault) String() string { + return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}/pools/{poolID}][%d] DeleteEnterprisePool default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteEnterprisePoolDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *DeleteEnterprisePoolDefault) 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/enterprises/delete_enterprise_responses.go b/client/enterprises/delete_enterprise_responses.go new file mode 100644 index 00000000..f846cdd0 --- /dev/null +++ b/client/enterprises/delete_enterprise_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// DeleteEnterpriseReader is a Reader for the DeleteEnterprise structure. +type DeleteEnterpriseReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteEnterpriseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + result := NewDeleteEnterpriseDefault(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 +} + +// NewDeleteEnterpriseDefault creates a DeleteEnterpriseDefault with default headers values +func NewDeleteEnterpriseDefault(code int) *DeleteEnterpriseDefault { + return &DeleteEnterpriseDefault{ + _statusCode: code, + } +} + +/* +DeleteEnterpriseDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type DeleteEnterpriseDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this delete enterprise default response has a 2xx status code +func (o *DeleteEnterpriseDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this delete enterprise default response has a 3xx status code +func (o *DeleteEnterpriseDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this delete enterprise default response has a 4xx status code +func (o *DeleteEnterpriseDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this delete enterprise default response has a 5xx status code +func (o *DeleteEnterpriseDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this delete enterprise default response a status code equal to that given +func (o *DeleteEnterpriseDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the delete enterprise default response +func (o *DeleteEnterpriseDefault) Code() int { + return o._statusCode +} + +func (o *DeleteEnterpriseDefault) Error() string { + return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}][%d] DeleteEnterprise default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteEnterpriseDefault) String() string { + return fmt.Sprintf("[DELETE /enterprises/{enterpriseID}][%d] DeleteEnterprise default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteEnterpriseDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *DeleteEnterpriseDefault) 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/enterprises/enterprises_client.go b/client/enterprises/enterprises_client.go new file mode 100644 index 00000000..7a17cacd --- /dev/null +++ b/client/enterprises/enterprises_client.go @@ -0,0 +1,465 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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 enterprises API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for enterprises 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 { + CreateEnterprise(params *CreateEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateEnterpriseOK, error) + + CreateEnterprisePool(params *CreateEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateEnterprisePoolOK, error) + + DeleteEnterprise(params *DeleteEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error + + DeleteEnterprisePool(params *DeleteEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error + + GetEnterprise(params *GetEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEnterpriseOK, error) + + GetEnterprisePool(params *GetEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEnterprisePoolOK, error) + + ListEnterpriseInstances(params *ListEnterpriseInstancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterpriseInstancesOK, error) + + ListEnterprisePools(params *ListEnterprisePoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterprisePoolsOK, error) + + ListEnterprises(params *ListEnterprisesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterprisesOK, error) + + UpdateEnterprise(params *UpdateEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateEnterpriseOK, error) + + UpdateEnterprisePool(params *UpdateEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateEnterprisePoolOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +CreateEnterprise creates enterprise with the given parameters +*/ +func (a *Client) CreateEnterprise(params *CreateEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateEnterpriseOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateEnterpriseParams() + } + op := &runtime.ClientOperation{ + ID: "CreateEnterprise", + Method: "POST", + PathPattern: "/enterprises", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &CreateEnterpriseReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*CreateEnterpriseOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*CreateEnterpriseDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +CreateEnterprisePool creates enterprise pool with the parameters given +*/ +func (a *Client) CreateEnterprisePool(params *CreateEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateEnterprisePoolOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateEnterprisePoolParams() + } + op := &runtime.ClientOperation{ + ID: "CreateEnterprisePool", + Method: "POST", + PathPattern: "/enterprises/{enterpriseID}/pools", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &CreateEnterprisePoolReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*CreateEnterprisePoolOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*CreateEnterprisePoolDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeleteEnterprise deletes enterprise by ID +*/ +func (a *Client) DeleteEnterprise(params *DeleteEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteEnterpriseParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteEnterprise", + Method: "DELETE", + PathPattern: "/enterprises/{enterpriseID}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteEnterpriseReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + _, err := a.transport.Submit(op) + if err != nil { + return err + } + return nil +} + +/* +DeleteEnterprisePool deletes enterprise pool by ID +*/ +func (a *Client) DeleteEnterprisePool(params *DeleteEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteEnterprisePoolParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteEnterprisePool", + Method: "DELETE", + PathPattern: "/enterprises/{enterpriseID}/pools/{poolID}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteEnterprisePoolReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + _, err := a.transport.Submit(op) + if err != nil { + return err + } + return nil +} + +/* +GetEnterprise gets enterprise by ID +*/ +func (a *Client) GetEnterprise(params *GetEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEnterpriseOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetEnterpriseParams() + } + op := &runtime.ClientOperation{ + ID: "GetEnterprise", + Method: "GET", + PathPattern: "/enterprises/{enterpriseID}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetEnterpriseReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetEnterpriseOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetEnterpriseDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GetEnterprisePool gets enterprise pool by ID +*/ +func (a *Client) GetEnterprisePool(params *GetEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEnterprisePoolOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetEnterprisePoolParams() + } + op := &runtime.ClientOperation{ + ID: "GetEnterprisePool", + Method: "GET", + PathPattern: "/enterprises/{enterpriseID}/pools/{poolID}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetEnterprisePoolReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetEnterprisePoolOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetEnterprisePoolDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListEnterpriseInstances lists enterprise instances +*/ +func (a *Client) ListEnterpriseInstances(params *ListEnterpriseInstancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterpriseInstancesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListEnterpriseInstancesParams() + } + op := &runtime.ClientOperation{ + ID: "ListEnterpriseInstances", + Method: "GET", + PathPattern: "/enterprises/{enterpriseID}/instances", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListEnterpriseInstancesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListEnterpriseInstancesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListEnterpriseInstancesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListEnterprisePools lists enterprise pools +*/ +func (a *Client) ListEnterprisePools(params *ListEnterprisePoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterprisePoolsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListEnterprisePoolsParams() + } + op := &runtime.ClientOperation{ + ID: "ListEnterprisePools", + Method: "GET", + PathPattern: "/enterprises/{enterpriseID}/pools", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListEnterprisePoolsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListEnterprisePoolsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListEnterprisePoolsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListEnterprises lists all enterprises +*/ +func (a *Client) ListEnterprises(params *ListEnterprisesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterprisesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListEnterprisesParams() + } + op := &runtime.ClientOperation{ + ID: "ListEnterprises", + Method: "GET", + PathPattern: "/enterprises", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListEnterprisesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListEnterprisesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListEnterprisesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +UpdateEnterprise updates an enterprise with the given parameters +*/ +func (a *Client) UpdateEnterprise(params *UpdateEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateEnterpriseOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateEnterpriseParams() + } + op := &runtime.ClientOperation{ + ID: "UpdateEnterprise", + Method: "PUT", + PathPattern: "/enterprises/{enterpriseID}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &UpdateEnterpriseReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*UpdateEnterpriseOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UpdateEnterpriseDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +UpdateEnterprisePool updates enterprise pool with the parameters given +*/ +func (a *Client) UpdateEnterprisePool(params *UpdateEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateEnterprisePoolOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateEnterprisePoolParams() + } + op := &runtime.ClientOperation{ + ID: "UpdateEnterprisePool", + Method: "PUT", + PathPattern: "/enterprises/{enterpriseID}/pools/{poolID}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &UpdateEnterprisePoolReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*UpdateEnterprisePoolOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UpdateEnterprisePoolDefault) + 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/enterprises/get_enterprise_parameters.go b/client/enterprises/get_enterprise_parameters.go new file mode 100644 index 00000000..97161943 --- /dev/null +++ b/client/enterprises/get_enterprise_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// NewGetEnterpriseParams creates a new GetEnterpriseParams 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 NewGetEnterpriseParams() *GetEnterpriseParams { + return &GetEnterpriseParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetEnterpriseParamsWithTimeout creates a new GetEnterpriseParams object +// with the ability to set a timeout on a request. +func NewGetEnterpriseParamsWithTimeout(timeout time.Duration) *GetEnterpriseParams { + return &GetEnterpriseParams{ + timeout: timeout, + } +} + +// NewGetEnterpriseParamsWithContext creates a new GetEnterpriseParams object +// with the ability to set a context for a request. +func NewGetEnterpriseParamsWithContext(ctx context.Context) *GetEnterpriseParams { + return &GetEnterpriseParams{ + Context: ctx, + } +} + +// NewGetEnterpriseParamsWithHTTPClient creates a new GetEnterpriseParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetEnterpriseParamsWithHTTPClient(client *http.Client) *GetEnterpriseParams { + return &GetEnterpriseParams{ + HTTPClient: client, + } +} + +/* +GetEnterpriseParams contains all the parameters to send to the API endpoint + + for the get enterprise operation. + + Typically these are written to a http.Request. +*/ +type GetEnterpriseParams struct { + + /* EnterpriseID. + + The ID of the enterprise to fetch. + */ + EnterpriseID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get enterprise params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetEnterpriseParams) WithDefaults() *GetEnterpriseParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get enterprise params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetEnterpriseParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get enterprise params +func (o *GetEnterpriseParams) WithTimeout(timeout time.Duration) *GetEnterpriseParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get enterprise params +func (o *GetEnterpriseParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get enterprise params +func (o *GetEnterpriseParams) WithContext(ctx context.Context) *GetEnterpriseParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get enterprise params +func (o *GetEnterpriseParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get enterprise params +func (o *GetEnterpriseParams) WithHTTPClient(client *http.Client) *GetEnterpriseParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get enterprise params +func (o *GetEnterpriseParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithEnterpriseID adds the enterpriseID to the get enterprise params +func (o *GetEnterpriseParams) WithEnterpriseID(enterpriseID string) *GetEnterpriseParams { + o.SetEnterpriseID(enterpriseID) + return o +} + +// SetEnterpriseID adds the enterpriseId to the get enterprise params +func (o *GetEnterpriseParams) SetEnterpriseID(enterpriseID string) { + o.EnterpriseID = enterpriseID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetEnterpriseParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param enterpriseID + if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/enterprises/get_enterprise_pool_parameters.go b/client/enterprises/get_enterprise_pool_parameters.go new file mode 100644 index 00000000..3d8180e6 --- /dev/null +++ b/client/enterprises/get_enterprise_pool_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// NewGetEnterprisePoolParams creates a new GetEnterprisePoolParams 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 NewGetEnterprisePoolParams() *GetEnterprisePoolParams { + return &GetEnterprisePoolParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetEnterprisePoolParamsWithTimeout creates a new GetEnterprisePoolParams object +// with the ability to set a timeout on a request. +func NewGetEnterprisePoolParamsWithTimeout(timeout time.Duration) *GetEnterprisePoolParams { + return &GetEnterprisePoolParams{ + timeout: timeout, + } +} + +// NewGetEnterprisePoolParamsWithContext creates a new GetEnterprisePoolParams object +// with the ability to set a context for a request. +func NewGetEnterprisePoolParamsWithContext(ctx context.Context) *GetEnterprisePoolParams { + return &GetEnterprisePoolParams{ + Context: ctx, + } +} + +// NewGetEnterprisePoolParamsWithHTTPClient creates a new GetEnterprisePoolParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetEnterprisePoolParamsWithHTTPClient(client *http.Client) *GetEnterprisePoolParams { + return &GetEnterprisePoolParams{ + HTTPClient: client, + } +} + +/* +GetEnterprisePoolParams contains all the parameters to send to the API endpoint + + for the get enterprise pool operation. + + Typically these are written to a http.Request. +*/ +type GetEnterprisePoolParams struct { + + /* EnterpriseID. + + Enterprise ID. + */ + EnterpriseID string + + /* PoolID. + + Pool ID. + */ + PoolID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get enterprise pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetEnterprisePoolParams) WithDefaults() *GetEnterprisePoolParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get enterprise pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetEnterprisePoolParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get enterprise pool params +func (o *GetEnterprisePoolParams) WithTimeout(timeout time.Duration) *GetEnterprisePoolParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get enterprise pool params +func (o *GetEnterprisePoolParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get enterprise pool params +func (o *GetEnterprisePoolParams) WithContext(ctx context.Context) *GetEnterprisePoolParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get enterprise pool params +func (o *GetEnterprisePoolParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get enterprise pool params +func (o *GetEnterprisePoolParams) WithHTTPClient(client *http.Client) *GetEnterprisePoolParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get enterprise pool params +func (o *GetEnterprisePoolParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithEnterpriseID adds the enterpriseID to the get enterprise pool params +func (o *GetEnterprisePoolParams) WithEnterpriseID(enterpriseID string) *GetEnterprisePoolParams { + o.SetEnterpriseID(enterpriseID) + return o +} + +// SetEnterpriseID adds the enterpriseId to the get enterprise pool params +func (o *GetEnterprisePoolParams) SetEnterpriseID(enterpriseID string) { + o.EnterpriseID = enterpriseID +} + +// WithPoolID adds the poolID to the get enterprise pool params +func (o *GetEnterprisePoolParams) WithPoolID(poolID string) *GetEnterprisePoolParams { + o.SetPoolID(poolID) + return o +} + +// SetPoolID adds the poolId to the get enterprise pool params +func (o *GetEnterprisePoolParams) SetPoolID(poolID string) { + o.PoolID = poolID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetEnterprisePoolParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param enterpriseID + if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil { + return err + } + + // path param poolID + if err := r.SetPathParam("poolID", o.PoolID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/enterprises/get_enterprise_pool_responses.go b/client/enterprises/get_enterprise_pool_responses.go new file mode 100644 index 00000000..da0f54ad --- /dev/null +++ b/client/enterprises/get_enterprise_pool_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// GetEnterprisePoolReader is a Reader for the GetEnterprisePool structure. +type GetEnterprisePoolReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetEnterprisePoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetEnterprisePoolOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetEnterprisePoolDefault(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 + } +} + +// NewGetEnterprisePoolOK creates a GetEnterprisePoolOK with default headers values +func NewGetEnterprisePoolOK() *GetEnterprisePoolOK { + return &GetEnterprisePoolOK{} +} + +/* +GetEnterprisePoolOK describes a response with status code 200, with default header values. + +Pool +*/ +type GetEnterprisePoolOK struct { + Payload garm_params.Pool +} + +// IsSuccess returns true when this get enterprise pool o k response has a 2xx status code +func (o *GetEnterprisePoolOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get enterprise pool o k response has a 3xx status code +func (o *GetEnterprisePoolOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get enterprise pool o k response has a 4xx status code +func (o *GetEnterprisePoolOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get enterprise pool o k response has a 5xx status code +func (o *GetEnterprisePoolOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get enterprise pool o k response a status code equal to that given +func (o *GetEnterprisePoolOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get enterprise pool o k response +func (o *GetEnterprisePoolOK) Code() int { + return 200 +} + +func (o *GetEnterprisePoolOK) Error() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] getEnterprisePoolOK %+v", 200, o.Payload) +} + +func (o *GetEnterprisePoolOK) String() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] getEnterprisePoolOK %+v", 200, o.Payload) +} + +func (o *GetEnterprisePoolOK) GetPayload() garm_params.Pool { + return o.Payload +} + +func (o *GetEnterprisePoolOK) 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 +} + +// NewGetEnterprisePoolDefault creates a GetEnterprisePoolDefault with default headers values +func NewGetEnterprisePoolDefault(code int) *GetEnterprisePoolDefault { + return &GetEnterprisePoolDefault{ + _statusCode: code, + } +} + +/* +GetEnterprisePoolDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type GetEnterprisePoolDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this get enterprise pool default response has a 2xx status code +func (o *GetEnterprisePoolDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get enterprise pool default response has a 3xx status code +func (o *GetEnterprisePoolDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get enterprise pool default response has a 4xx status code +func (o *GetEnterprisePoolDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get enterprise pool default response has a 5xx status code +func (o *GetEnterprisePoolDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get enterprise pool default response a status code equal to that given +func (o *GetEnterprisePoolDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get enterprise pool default response +func (o *GetEnterprisePoolDefault) Code() int { + return o._statusCode +} + +func (o *GetEnterprisePoolDefault) Error() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] GetEnterprisePool default %+v", o._statusCode, o.Payload) +} + +func (o *GetEnterprisePoolDefault) String() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools/{poolID}][%d] GetEnterprisePool default %+v", o._statusCode, o.Payload) +} + +func (o *GetEnterprisePoolDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *GetEnterprisePoolDefault) 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/enterprises/get_enterprise_responses.go b/client/enterprises/get_enterprise_responses.go new file mode 100644 index 00000000..896393bd --- /dev/null +++ b/client/enterprises/get_enterprise_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// GetEnterpriseReader is a Reader for the GetEnterprise structure. +type GetEnterpriseReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetEnterpriseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetEnterpriseOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetEnterpriseDefault(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 + } +} + +// NewGetEnterpriseOK creates a GetEnterpriseOK with default headers values +func NewGetEnterpriseOK() *GetEnterpriseOK { + return &GetEnterpriseOK{} +} + +/* +GetEnterpriseOK describes a response with status code 200, with default header values. + +Enterprise +*/ +type GetEnterpriseOK struct { + Payload garm_params.Enterprise +} + +// IsSuccess returns true when this get enterprise o k response has a 2xx status code +func (o *GetEnterpriseOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get enterprise o k response has a 3xx status code +func (o *GetEnterpriseOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get enterprise o k response has a 4xx status code +func (o *GetEnterpriseOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get enterprise o k response has a 5xx status code +func (o *GetEnterpriseOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get enterprise o k response a status code equal to that given +func (o *GetEnterpriseOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get enterprise o k response +func (o *GetEnterpriseOK) Code() int { + return 200 +} + +func (o *GetEnterpriseOK) Error() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] getEnterpriseOK %+v", 200, o.Payload) +} + +func (o *GetEnterpriseOK) String() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] getEnterpriseOK %+v", 200, o.Payload) +} + +func (o *GetEnterpriseOK) GetPayload() garm_params.Enterprise { + return o.Payload +} + +func (o *GetEnterpriseOK) 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 +} + +// NewGetEnterpriseDefault creates a GetEnterpriseDefault with default headers values +func NewGetEnterpriseDefault(code int) *GetEnterpriseDefault { + return &GetEnterpriseDefault{ + _statusCode: code, + } +} + +/* +GetEnterpriseDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type GetEnterpriseDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this get enterprise default response has a 2xx status code +func (o *GetEnterpriseDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get enterprise default response has a 3xx status code +func (o *GetEnterpriseDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get enterprise default response has a 4xx status code +func (o *GetEnterpriseDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get enterprise default response has a 5xx status code +func (o *GetEnterpriseDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get enterprise default response a status code equal to that given +func (o *GetEnterpriseDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get enterprise default response +func (o *GetEnterpriseDefault) Code() int { + return o._statusCode +} + +func (o *GetEnterpriseDefault) Error() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] GetEnterprise default %+v", o._statusCode, o.Payload) +} + +func (o *GetEnterpriseDefault) String() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}][%d] GetEnterprise default %+v", o._statusCode, o.Payload) +} + +func (o *GetEnterpriseDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *GetEnterpriseDefault) 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/enterprises/list_enterprise_instances_parameters.go b/client/enterprises/list_enterprise_instances_parameters.go new file mode 100644 index 00000000..5e23c3e0 --- /dev/null +++ b/client/enterprises/list_enterprise_instances_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// NewListEnterpriseInstancesParams creates a new ListEnterpriseInstancesParams 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 NewListEnterpriseInstancesParams() *ListEnterpriseInstancesParams { + return &ListEnterpriseInstancesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListEnterpriseInstancesParamsWithTimeout creates a new ListEnterpriseInstancesParams object +// with the ability to set a timeout on a request. +func NewListEnterpriseInstancesParamsWithTimeout(timeout time.Duration) *ListEnterpriseInstancesParams { + return &ListEnterpriseInstancesParams{ + timeout: timeout, + } +} + +// NewListEnterpriseInstancesParamsWithContext creates a new ListEnterpriseInstancesParams object +// with the ability to set a context for a request. +func NewListEnterpriseInstancesParamsWithContext(ctx context.Context) *ListEnterpriseInstancesParams { + return &ListEnterpriseInstancesParams{ + Context: ctx, + } +} + +// NewListEnterpriseInstancesParamsWithHTTPClient creates a new ListEnterpriseInstancesParams object +// with the ability to set a custom HTTPClient for a request. +func NewListEnterpriseInstancesParamsWithHTTPClient(client *http.Client) *ListEnterpriseInstancesParams { + return &ListEnterpriseInstancesParams{ + HTTPClient: client, + } +} + +/* +ListEnterpriseInstancesParams contains all the parameters to send to the API endpoint + + for the list enterprise instances operation. + + Typically these are written to a http.Request. +*/ +type ListEnterpriseInstancesParams struct { + + /* EnterpriseID. + + Enterprise ID. + */ + EnterpriseID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list enterprise instances params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListEnterpriseInstancesParams) WithDefaults() *ListEnterpriseInstancesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list enterprise instances params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListEnterpriseInstancesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list enterprise instances params +func (o *ListEnterpriseInstancesParams) WithTimeout(timeout time.Duration) *ListEnterpriseInstancesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list enterprise instances params +func (o *ListEnterpriseInstancesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list enterprise instances params +func (o *ListEnterpriseInstancesParams) WithContext(ctx context.Context) *ListEnterpriseInstancesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list enterprise instances params +func (o *ListEnterpriseInstancesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list enterprise instances params +func (o *ListEnterpriseInstancesParams) WithHTTPClient(client *http.Client) *ListEnterpriseInstancesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list enterprise instances params +func (o *ListEnterpriseInstancesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithEnterpriseID adds the enterpriseID to the list enterprise instances params +func (o *ListEnterpriseInstancesParams) WithEnterpriseID(enterpriseID string) *ListEnterpriseInstancesParams { + o.SetEnterpriseID(enterpriseID) + return o +} + +// SetEnterpriseID adds the enterpriseId to the list enterprise instances params +func (o *ListEnterpriseInstancesParams) SetEnterpriseID(enterpriseID string) { + o.EnterpriseID = enterpriseID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListEnterpriseInstancesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param enterpriseID + if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/enterprises/list_enterprise_instances_responses.go b/client/enterprises/list_enterprise_instances_responses.go new file mode 100644 index 00000000..bf28ccda --- /dev/null +++ b/client/enterprises/list_enterprise_instances_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// ListEnterpriseInstancesReader is a Reader for the ListEnterpriseInstances structure. +type ListEnterpriseInstancesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListEnterpriseInstancesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListEnterpriseInstancesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListEnterpriseInstancesDefault(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 + } +} + +// NewListEnterpriseInstancesOK creates a ListEnterpriseInstancesOK with default headers values +func NewListEnterpriseInstancesOK() *ListEnterpriseInstancesOK { + return &ListEnterpriseInstancesOK{} +} + +/* +ListEnterpriseInstancesOK describes a response with status code 200, with default header values. + +Instances +*/ +type ListEnterpriseInstancesOK struct { + Payload garm_params.Instances +} + +// IsSuccess returns true when this list enterprise instances o k response has a 2xx status code +func (o *ListEnterpriseInstancesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list enterprise instances o k response has a 3xx status code +func (o *ListEnterpriseInstancesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list enterprise instances o k response has a 4xx status code +func (o *ListEnterpriseInstancesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list enterprise instances o k response has a 5xx status code +func (o *ListEnterpriseInstancesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list enterprise instances o k response a status code equal to that given +func (o *ListEnterpriseInstancesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list enterprise instances o k response +func (o *ListEnterpriseInstancesOK) Code() int { + return 200 +} + +func (o *ListEnterpriseInstancesOK) Error() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] listEnterpriseInstancesOK %+v", 200, o.Payload) +} + +func (o *ListEnterpriseInstancesOK) String() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] listEnterpriseInstancesOK %+v", 200, o.Payload) +} + +func (o *ListEnterpriseInstancesOK) GetPayload() garm_params.Instances { + return o.Payload +} + +func (o *ListEnterpriseInstancesOK) 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 +} + +// NewListEnterpriseInstancesDefault creates a ListEnterpriseInstancesDefault with default headers values +func NewListEnterpriseInstancesDefault(code int) *ListEnterpriseInstancesDefault { + return &ListEnterpriseInstancesDefault{ + _statusCode: code, + } +} + +/* +ListEnterpriseInstancesDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type ListEnterpriseInstancesDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this list enterprise instances default response has a 2xx status code +func (o *ListEnterpriseInstancesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list enterprise instances default response has a 3xx status code +func (o *ListEnterpriseInstancesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list enterprise instances default response has a 4xx status code +func (o *ListEnterpriseInstancesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list enterprise instances default response has a 5xx status code +func (o *ListEnterpriseInstancesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list enterprise instances default response a status code equal to that given +func (o *ListEnterpriseInstancesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list enterprise instances default response +func (o *ListEnterpriseInstancesDefault) Code() int { + return o._statusCode +} + +func (o *ListEnterpriseInstancesDefault) Error() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] ListEnterpriseInstances default %+v", o._statusCode, o.Payload) +} + +func (o *ListEnterpriseInstancesDefault) String() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}/instances][%d] ListEnterpriseInstances default %+v", o._statusCode, o.Payload) +} + +func (o *ListEnterpriseInstancesDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *ListEnterpriseInstancesDefault) 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/enterprises/list_enterprise_pools_parameters.go b/client/enterprises/list_enterprise_pools_parameters.go new file mode 100644 index 00000000..6c58fe0e --- /dev/null +++ b/client/enterprises/list_enterprise_pools_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// NewListEnterprisePoolsParams creates a new ListEnterprisePoolsParams 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 NewListEnterprisePoolsParams() *ListEnterprisePoolsParams { + return &ListEnterprisePoolsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListEnterprisePoolsParamsWithTimeout creates a new ListEnterprisePoolsParams object +// with the ability to set a timeout on a request. +func NewListEnterprisePoolsParamsWithTimeout(timeout time.Duration) *ListEnterprisePoolsParams { + return &ListEnterprisePoolsParams{ + timeout: timeout, + } +} + +// NewListEnterprisePoolsParamsWithContext creates a new ListEnterprisePoolsParams object +// with the ability to set a context for a request. +func NewListEnterprisePoolsParamsWithContext(ctx context.Context) *ListEnterprisePoolsParams { + return &ListEnterprisePoolsParams{ + Context: ctx, + } +} + +// NewListEnterprisePoolsParamsWithHTTPClient creates a new ListEnterprisePoolsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListEnterprisePoolsParamsWithHTTPClient(client *http.Client) *ListEnterprisePoolsParams { + return &ListEnterprisePoolsParams{ + HTTPClient: client, + } +} + +/* +ListEnterprisePoolsParams contains all the parameters to send to the API endpoint + + for the list enterprise pools operation. + + Typically these are written to a http.Request. +*/ +type ListEnterprisePoolsParams struct { + + /* EnterpriseID. + + Enterprise ID. + */ + EnterpriseID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list enterprise pools params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListEnterprisePoolsParams) WithDefaults() *ListEnterprisePoolsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list enterprise pools params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListEnterprisePoolsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list enterprise pools params +func (o *ListEnterprisePoolsParams) WithTimeout(timeout time.Duration) *ListEnterprisePoolsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list enterprise pools params +func (o *ListEnterprisePoolsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list enterprise pools params +func (o *ListEnterprisePoolsParams) WithContext(ctx context.Context) *ListEnterprisePoolsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list enterprise pools params +func (o *ListEnterprisePoolsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list enterprise pools params +func (o *ListEnterprisePoolsParams) WithHTTPClient(client *http.Client) *ListEnterprisePoolsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list enterprise pools params +func (o *ListEnterprisePoolsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithEnterpriseID adds the enterpriseID to the list enterprise pools params +func (o *ListEnterprisePoolsParams) WithEnterpriseID(enterpriseID string) *ListEnterprisePoolsParams { + o.SetEnterpriseID(enterpriseID) + return o +} + +// SetEnterpriseID adds the enterpriseId to the list enterprise pools params +func (o *ListEnterprisePoolsParams) SetEnterpriseID(enterpriseID string) { + o.EnterpriseID = enterpriseID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListEnterprisePoolsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param enterpriseID + if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/enterprises/list_enterprise_pools_responses.go b/client/enterprises/list_enterprise_pools_responses.go new file mode 100644 index 00000000..3c228155 --- /dev/null +++ b/client/enterprises/list_enterprise_pools_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// ListEnterprisePoolsReader is a Reader for the ListEnterprisePools structure. +type ListEnterprisePoolsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListEnterprisePoolsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListEnterprisePoolsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListEnterprisePoolsDefault(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 + } +} + +// NewListEnterprisePoolsOK creates a ListEnterprisePoolsOK with default headers values +func NewListEnterprisePoolsOK() *ListEnterprisePoolsOK { + return &ListEnterprisePoolsOK{} +} + +/* +ListEnterprisePoolsOK describes a response with status code 200, with default header values. + +Pools +*/ +type ListEnterprisePoolsOK struct { + Payload garm_params.Pools +} + +// IsSuccess returns true when this list enterprise pools o k response has a 2xx status code +func (o *ListEnterprisePoolsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list enterprise pools o k response has a 3xx status code +func (o *ListEnterprisePoolsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list enterprise pools o k response has a 4xx status code +func (o *ListEnterprisePoolsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list enterprise pools o k response has a 5xx status code +func (o *ListEnterprisePoolsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list enterprise pools o k response a status code equal to that given +func (o *ListEnterprisePoolsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list enterprise pools o k response +func (o *ListEnterprisePoolsOK) Code() int { + return 200 +} + +func (o *ListEnterprisePoolsOK) Error() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] listEnterprisePoolsOK %+v", 200, o.Payload) +} + +func (o *ListEnterprisePoolsOK) String() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] listEnterprisePoolsOK %+v", 200, o.Payload) +} + +func (o *ListEnterprisePoolsOK) GetPayload() garm_params.Pools { + return o.Payload +} + +func (o *ListEnterprisePoolsOK) 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 +} + +// NewListEnterprisePoolsDefault creates a ListEnterprisePoolsDefault with default headers values +func NewListEnterprisePoolsDefault(code int) *ListEnterprisePoolsDefault { + return &ListEnterprisePoolsDefault{ + _statusCode: code, + } +} + +/* +ListEnterprisePoolsDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type ListEnterprisePoolsDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this list enterprise pools default response has a 2xx status code +func (o *ListEnterprisePoolsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list enterprise pools default response has a 3xx status code +func (o *ListEnterprisePoolsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list enterprise pools default response has a 4xx status code +func (o *ListEnterprisePoolsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list enterprise pools default response has a 5xx status code +func (o *ListEnterprisePoolsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list enterprise pools default response a status code equal to that given +func (o *ListEnterprisePoolsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list enterprise pools default response +func (o *ListEnterprisePoolsDefault) Code() int { + return o._statusCode +} + +func (o *ListEnterprisePoolsDefault) Error() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] ListEnterprisePools default %+v", o._statusCode, o.Payload) +} + +func (o *ListEnterprisePoolsDefault) String() string { + return fmt.Sprintf("[GET /enterprises/{enterpriseID}/pools][%d] ListEnterprisePools default %+v", o._statusCode, o.Payload) +} + +func (o *ListEnterprisePoolsDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *ListEnterprisePoolsDefault) 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/enterprises/list_enterprises_parameters.go b/client/enterprises/list_enterprises_parameters.go new file mode 100644 index 00000000..83291c5f --- /dev/null +++ b/client/enterprises/list_enterprises_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// NewListEnterprisesParams creates a new ListEnterprisesParams 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 NewListEnterprisesParams() *ListEnterprisesParams { + return &ListEnterprisesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListEnterprisesParamsWithTimeout creates a new ListEnterprisesParams object +// with the ability to set a timeout on a request. +func NewListEnterprisesParamsWithTimeout(timeout time.Duration) *ListEnterprisesParams { + return &ListEnterprisesParams{ + timeout: timeout, + } +} + +// NewListEnterprisesParamsWithContext creates a new ListEnterprisesParams object +// with the ability to set a context for a request. +func NewListEnterprisesParamsWithContext(ctx context.Context) *ListEnterprisesParams { + return &ListEnterprisesParams{ + Context: ctx, + } +} + +// NewListEnterprisesParamsWithHTTPClient creates a new ListEnterprisesParams object +// with the ability to set a custom HTTPClient for a request. +func NewListEnterprisesParamsWithHTTPClient(client *http.Client) *ListEnterprisesParams { + return &ListEnterprisesParams{ + HTTPClient: client, + } +} + +/* +ListEnterprisesParams contains all the parameters to send to the API endpoint + + for the list enterprises operation. + + Typically these are written to a http.Request. +*/ +type ListEnterprisesParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list enterprises params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListEnterprisesParams) WithDefaults() *ListEnterprisesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list enterprises params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListEnterprisesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list enterprises params +func (o *ListEnterprisesParams) WithTimeout(timeout time.Duration) *ListEnterprisesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list enterprises params +func (o *ListEnterprisesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list enterprises params +func (o *ListEnterprisesParams) WithContext(ctx context.Context) *ListEnterprisesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list enterprises params +func (o *ListEnterprisesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list enterprises params +func (o *ListEnterprisesParams) WithHTTPClient(client *http.Client) *ListEnterprisesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list enterprises params +func (o *ListEnterprisesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ListEnterprisesParams) 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/enterprises/list_enterprises_responses.go b/client/enterprises/list_enterprises_responses.go new file mode 100644 index 00000000..1bb58307 --- /dev/null +++ b/client/enterprises/list_enterprises_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// ListEnterprisesReader is a Reader for the ListEnterprises structure. +type ListEnterprisesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListEnterprisesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListEnterprisesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListEnterprisesDefault(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 + } +} + +// NewListEnterprisesOK creates a ListEnterprisesOK with default headers values +func NewListEnterprisesOK() *ListEnterprisesOK { + return &ListEnterprisesOK{} +} + +/* +ListEnterprisesOK describes a response with status code 200, with default header values. + +Enterprises +*/ +type ListEnterprisesOK struct { + Payload garm_params.Enterprises +} + +// IsSuccess returns true when this list enterprises o k response has a 2xx status code +func (o *ListEnterprisesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list enterprises o k response has a 3xx status code +func (o *ListEnterprisesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list enterprises o k response has a 4xx status code +func (o *ListEnterprisesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list enterprises o k response has a 5xx status code +func (o *ListEnterprisesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list enterprises o k response a status code equal to that given +func (o *ListEnterprisesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list enterprises o k response +func (o *ListEnterprisesOK) Code() int { + return 200 +} + +func (o *ListEnterprisesOK) Error() string { + return fmt.Sprintf("[GET /enterprises][%d] listEnterprisesOK %+v", 200, o.Payload) +} + +func (o *ListEnterprisesOK) String() string { + return fmt.Sprintf("[GET /enterprises][%d] listEnterprisesOK %+v", 200, o.Payload) +} + +func (o *ListEnterprisesOK) GetPayload() garm_params.Enterprises { + return o.Payload +} + +func (o *ListEnterprisesOK) 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 +} + +// NewListEnterprisesDefault creates a ListEnterprisesDefault with default headers values +func NewListEnterprisesDefault(code int) *ListEnterprisesDefault { + return &ListEnterprisesDefault{ + _statusCode: code, + } +} + +/* +ListEnterprisesDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type ListEnterprisesDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this list enterprises default response has a 2xx status code +func (o *ListEnterprisesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list enterprises default response has a 3xx status code +func (o *ListEnterprisesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list enterprises default response has a 4xx status code +func (o *ListEnterprisesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list enterprises default response has a 5xx status code +func (o *ListEnterprisesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list enterprises default response a status code equal to that given +func (o *ListEnterprisesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list enterprises default response +func (o *ListEnterprisesDefault) Code() int { + return o._statusCode +} + +func (o *ListEnterprisesDefault) Error() string { + return fmt.Sprintf("[GET /enterprises][%d] ListEnterprises default %+v", o._statusCode, o.Payload) +} + +func (o *ListEnterprisesDefault) String() string { + return fmt.Sprintf("[GET /enterprises][%d] ListEnterprises default %+v", o._statusCode, o.Payload) +} + +func (o *ListEnterprisesDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *ListEnterprisesDefault) 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/enterprises/update_enterprise_parameters.go b/client/enterprises/update_enterprise_parameters.go new file mode 100644 index 00000000..144de727 --- /dev/null +++ b/client/enterprises/update_enterprise_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// NewUpdateEnterpriseParams creates a new UpdateEnterpriseParams 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 NewUpdateEnterpriseParams() *UpdateEnterpriseParams { + return &UpdateEnterpriseParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateEnterpriseParamsWithTimeout creates a new UpdateEnterpriseParams object +// with the ability to set a timeout on a request. +func NewUpdateEnterpriseParamsWithTimeout(timeout time.Duration) *UpdateEnterpriseParams { + return &UpdateEnterpriseParams{ + timeout: timeout, + } +} + +// NewUpdateEnterpriseParamsWithContext creates a new UpdateEnterpriseParams object +// with the ability to set a context for a request. +func NewUpdateEnterpriseParamsWithContext(ctx context.Context) *UpdateEnterpriseParams { + return &UpdateEnterpriseParams{ + Context: ctx, + } +} + +// NewUpdateEnterpriseParamsWithHTTPClient creates a new UpdateEnterpriseParams object +// with the ability to set a custom HTTPClient for a request. +func NewUpdateEnterpriseParamsWithHTTPClient(client *http.Client) *UpdateEnterpriseParams { + return &UpdateEnterpriseParams{ + HTTPClient: client, + } +} + +/* +UpdateEnterpriseParams contains all the parameters to send to the API endpoint + + for the update enterprise operation. + + Typically these are written to a http.Request. +*/ +type UpdateEnterpriseParams struct { + + /* Body. + + Parameters used to update the enterprise. + */ + Body garm_params.UpdateEntityParams + + /* EnterpriseID. + + The ID of the enterprise to update. + */ + EnterpriseID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the update enterprise params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateEnterpriseParams) WithDefaults() *UpdateEnterpriseParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the update enterprise params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateEnterpriseParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the update enterprise params +func (o *UpdateEnterpriseParams) WithTimeout(timeout time.Duration) *UpdateEnterpriseParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update enterprise params +func (o *UpdateEnterpriseParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update enterprise params +func (o *UpdateEnterpriseParams) WithContext(ctx context.Context) *UpdateEnterpriseParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update enterprise params +func (o *UpdateEnterpriseParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update enterprise params +func (o *UpdateEnterpriseParams) WithHTTPClient(client *http.Client) *UpdateEnterpriseParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update enterprise params +func (o *UpdateEnterpriseParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the update enterprise params +func (o *UpdateEnterpriseParams) WithBody(body garm_params.UpdateEntityParams) *UpdateEnterpriseParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the update enterprise params +func (o *UpdateEnterpriseParams) SetBody(body garm_params.UpdateEntityParams) { + o.Body = body +} + +// WithEnterpriseID adds the enterpriseID to the update enterprise params +func (o *UpdateEnterpriseParams) WithEnterpriseID(enterpriseID string) *UpdateEnterpriseParams { + o.SetEnterpriseID(enterpriseID) + return o +} + +// SetEnterpriseID adds the enterpriseId to the update enterprise params +func (o *UpdateEnterpriseParams) SetEnterpriseID(enterpriseID string) { + o.EnterpriseID = enterpriseID +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateEnterpriseParams) 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 enterpriseID + if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/enterprises/update_enterprise_pool_parameters.go b/client/enterprises/update_enterprise_pool_parameters.go new file mode 100644 index 00000000..7940eb54 --- /dev/null +++ b/client/enterprises/update_enterprise_pool_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// NewUpdateEnterprisePoolParams creates a new UpdateEnterprisePoolParams 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 NewUpdateEnterprisePoolParams() *UpdateEnterprisePoolParams { + return &UpdateEnterprisePoolParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateEnterprisePoolParamsWithTimeout creates a new UpdateEnterprisePoolParams object +// with the ability to set a timeout on a request. +func NewUpdateEnterprisePoolParamsWithTimeout(timeout time.Duration) *UpdateEnterprisePoolParams { + return &UpdateEnterprisePoolParams{ + timeout: timeout, + } +} + +// NewUpdateEnterprisePoolParamsWithContext creates a new UpdateEnterprisePoolParams object +// with the ability to set a context for a request. +func NewUpdateEnterprisePoolParamsWithContext(ctx context.Context) *UpdateEnterprisePoolParams { + return &UpdateEnterprisePoolParams{ + Context: ctx, + } +} + +// NewUpdateEnterprisePoolParamsWithHTTPClient creates a new UpdateEnterprisePoolParams object +// with the ability to set a custom HTTPClient for a request. +func NewUpdateEnterprisePoolParamsWithHTTPClient(client *http.Client) *UpdateEnterprisePoolParams { + return &UpdateEnterprisePoolParams{ + HTTPClient: client, + } +} + +/* +UpdateEnterprisePoolParams contains all the parameters to send to the API endpoint + + for the update enterprise pool operation. + + Typically these are written to a http.Request. +*/ +type UpdateEnterprisePoolParams struct { + + /* Body. + + Parameters used when updating the enterprise pool. + */ + Body garm_params.UpdatePoolParams + + /* EnterpriseID. + + Enterprise ID. + */ + EnterpriseID string + + /* PoolID. + + ID of the enterprise pool to update. + */ + PoolID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the update enterprise pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateEnterprisePoolParams) WithDefaults() *UpdateEnterprisePoolParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the update enterprise pool params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateEnterprisePoolParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the update enterprise pool params +func (o *UpdateEnterprisePoolParams) WithTimeout(timeout time.Duration) *UpdateEnterprisePoolParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update enterprise pool params +func (o *UpdateEnterprisePoolParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update enterprise pool params +func (o *UpdateEnterprisePoolParams) WithContext(ctx context.Context) *UpdateEnterprisePoolParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update enterprise pool params +func (o *UpdateEnterprisePoolParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update enterprise pool params +func (o *UpdateEnterprisePoolParams) WithHTTPClient(client *http.Client) *UpdateEnterprisePoolParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update enterprise pool params +func (o *UpdateEnterprisePoolParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the update enterprise pool params +func (o *UpdateEnterprisePoolParams) WithBody(body garm_params.UpdatePoolParams) *UpdateEnterprisePoolParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the update enterprise pool params +func (o *UpdateEnterprisePoolParams) SetBody(body garm_params.UpdatePoolParams) { + o.Body = body +} + +// WithEnterpriseID adds the enterpriseID to the update enterprise pool params +func (o *UpdateEnterprisePoolParams) WithEnterpriseID(enterpriseID string) *UpdateEnterprisePoolParams { + o.SetEnterpriseID(enterpriseID) + return o +} + +// SetEnterpriseID adds the enterpriseId to the update enterprise pool params +func (o *UpdateEnterprisePoolParams) SetEnterpriseID(enterpriseID string) { + o.EnterpriseID = enterpriseID +} + +// WithPoolID adds the poolID to the update enterprise pool params +func (o *UpdateEnterprisePoolParams) WithPoolID(poolID string) *UpdateEnterprisePoolParams { + o.SetPoolID(poolID) + return o +} + +// SetPoolID adds the poolId to the update enterprise pool params +func (o *UpdateEnterprisePoolParams) SetPoolID(poolID string) { + o.PoolID = poolID +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateEnterprisePoolParams) 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 enterpriseID + if err := r.SetPathParam("enterpriseID", o.EnterpriseID); err != nil { + return err + } + + // path param poolID + if err := r.SetPathParam("poolID", o.PoolID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/enterprises/update_enterprise_pool_responses.go b/client/enterprises/update_enterprise_pool_responses.go new file mode 100644 index 00000000..e20a51c8 --- /dev/null +++ b/client/enterprises/update_enterprise_pool_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// UpdateEnterprisePoolReader is a Reader for the UpdateEnterprisePool structure. +type UpdateEnterprisePoolReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateEnterprisePoolReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateEnterprisePoolOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUpdateEnterprisePoolDefault(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 + } +} + +// NewUpdateEnterprisePoolOK creates a UpdateEnterprisePoolOK with default headers values +func NewUpdateEnterprisePoolOK() *UpdateEnterprisePoolOK { + return &UpdateEnterprisePoolOK{} +} + +/* +UpdateEnterprisePoolOK describes a response with status code 200, with default header values. + +Pool +*/ +type UpdateEnterprisePoolOK struct { + Payload garm_params.Pool +} + +// IsSuccess returns true when this update enterprise pool o k response has a 2xx status code +func (o *UpdateEnterprisePoolOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this update enterprise pool o k response has a 3xx status code +func (o *UpdateEnterprisePoolOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update enterprise pool o k response has a 4xx status code +func (o *UpdateEnterprisePoolOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this update enterprise pool o k response has a 5xx status code +func (o *UpdateEnterprisePoolOK) IsServerError() bool { + return false +} + +// IsCode returns true when this update enterprise pool o k response a status code equal to that given +func (o *UpdateEnterprisePoolOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the update enterprise pool o k response +func (o *UpdateEnterprisePoolOK) Code() int { + return 200 +} + +func (o *UpdateEnterprisePoolOK) Error() string { + return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] updateEnterprisePoolOK %+v", 200, o.Payload) +} + +func (o *UpdateEnterprisePoolOK) String() string { + return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] updateEnterprisePoolOK %+v", 200, o.Payload) +} + +func (o *UpdateEnterprisePoolOK) GetPayload() garm_params.Pool { + return o.Payload +} + +func (o *UpdateEnterprisePoolOK) 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 +} + +// NewUpdateEnterprisePoolDefault creates a UpdateEnterprisePoolDefault with default headers values +func NewUpdateEnterprisePoolDefault(code int) *UpdateEnterprisePoolDefault { + return &UpdateEnterprisePoolDefault{ + _statusCode: code, + } +} + +/* +UpdateEnterprisePoolDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type UpdateEnterprisePoolDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this update enterprise pool default response has a 2xx status code +func (o *UpdateEnterprisePoolDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this update enterprise pool default response has a 3xx status code +func (o *UpdateEnterprisePoolDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this update enterprise pool default response has a 4xx status code +func (o *UpdateEnterprisePoolDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this update enterprise pool default response has a 5xx status code +func (o *UpdateEnterprisePoolDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this update enterprise pool default response a status code equal to that given +func (o *UpdateEnterprisePoolDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the update enterprise pool default response +func (o *UpdateEnterprisePoolDefault) Code() int { + return o._statusCode +} + +func (o *UpdateEnterprisePoolDefault) Error() string { + return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] UpdateEnterprisePool default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateEnterprisePoolDefault) String() string { + return fmt.Sprintf("[PUT /enterprises/{enterpriseID}/pools/{poolID}][%d] UpdateEnterprisePool default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateEnterprisePoolDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *UpdateEnterprisePoolDefault) 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/enterprises/update_enterprise_responses.go b/client/enterprises/update_enterprise_responses.go new file mode 100644 index 00000000..3bea3347 --- /dev/null +++ b/client/enterprises/update_enterprise_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package enterprises + +// 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" +) + +// UpdateEnterpriseReader is a Reader for the UpdateEnterprise structure. +type UpdateEnterpriseReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateEnterpriseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateEnterpriseOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUpdateEnterpriseDefault(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 + } +} + +// NewUpdateEnterpriseOK creates a UpdateEnterpriseOK with default headers values +func NewUpdateEnterpriseOK() *UpdateEnterpriseOK { + return &UpdateEnterpriseOK{} +} + +/* +UpdateEnterpriseOK describes a response with status code 200, with default header values. + +Enterprise +*/ +type UpdateEnterpriseOK struct { + Payload garm_params.Enterprise +} + +// IsSuccess returns true when this update enterprise o k response has a 2xx status code +func (o *UpdateEnterpriseOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this update enterprise o k response has a 3xx status code +func (o *UpdateEnterpriseOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update enterprise o k response has a 4xx status code +func (o *UpdateEnterpriseOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this update enterprise o k response has a 5xx status code +func (o *UpdateEnterpriseOK) IsServerError() bool { + return false +} + +// IsCode returns true when this update enterprise o k response a status code equal to that given +func (o *UpdateEnterpriseOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the update enterprise o k response +func (o *UpdateEnterpriseOK) Code() int { + return 200 +} + +func (o *UpdateEnterpriseOK) Error() string { + return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] updateEnterpriseOK %+v", 200, o.Payload) +} + +func (o *UpdateEnterpriseOK) String() string { + return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] updateEnterpriseOK %+v", 200, o.Payload) +} + +func (o *UpdateEnterpriseOK) GetPayload() garm_params.Enterprise { + return o.Payload +} + +func (o *UpdateEnterpriseOK) 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 +} + +// NewUpdateEnterpriseDefault creates a UpdateEnterpriseDefault with default headers values +func NewUpdateEnterpriseDefault(code int) *UpdateEnterpriseDefault { + return &UpdateEnterpriseDefault{ + _statusCode: code, + } +} + +/* +UpdateEnterpriseDefault describes a response with status code -1, with default header values. + +APIErrorResponse +*/ +type UpdateEnterpriseDefault struct { + _statusCode int + + Payload apiserver_params.APIErrorResponse +} + +// IsSuccess returns true when this update enterprise default response has a 2xx status code +func (o *UpdateEnterpriseDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this update enterprise default response has a 3xx status code +func (o *UpdateEnterpriseDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this update enterprise default response has a 4xx status code +func (o *UpdateEnterpriseDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this update enterprise default response has a 5xx status code +func (o *UpdateEnterpriseDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this update enterprise default response a status code equal to that given +func (o *UpdateEnterpriseDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the update enterprise default response +func (o *UpdateEnterpriseDefault) Code() int { + return o._statusCode +} + +func (o *UpdateEnterpriseDefault) Error() string { + return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] UpdateEnterprise default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateEnterpriseDefault) String() string { + return fmt.Sprintf("[PUT /enterprises/{enterpriseID}][%d] UpdateEnterprise default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateEnterpriseDefault) GetPayload() apiserver_params.APIErrorResponse { + return o.Payload +} + +func (o *UpdateEnterpriseDefault) 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/garm_api_client.go b/client/garm_api_client.go index 28d192fc..0f9a208a 100644 --- a/client/garm_api_client.go +++ b/client/garm_api_client.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/strfmt" "github.com/cloudbase/garm/client/credentials" + "github.com/cloudbase/garm/client/enterprises" "github.com/cloudbase/garm/client/first_run" "github.com/cloudbase/garm/client/instances" "github.com/cloudbase/garm/client/jobs" @@ -65,6 +66,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *GarmAPI { cli := new(GarmAPI) cli.Transport = transport cli.Credentials = credentials.New(transport, formats) + cli.Enterprises = enterprises.New(transport, formats) cli.FirstRun = first_run.New(transport, formats) cli.Instances = instances.New(transport, formats) cli.Jobs = jobs.New(transport, formats) @@ -120,6 +122,8 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { type GarmAPI struct { Credentials credentials.ClientService + Enterprises enterprises.ClientService + FirstRun first_run.ClientService Instances instances.ClientService @@ -145,6 +149,7 @@ type GarmAPI struct { func (c *GarmAPI) SetTransport(transport runtime.ClientTransport) { c.Transport = transport c.Credentials.SetTransport(transport) + c.Enterprises.SetTransport(transport) c.FirstRun.SetTransport(transport) c.Instances.SetTransport(transport) c.Jobs.SetTransport(transport) diff --git a/params/params.go b/params/params.go index c6797fbd..34c02a09 100644 --- a/params/params.go +++ b/params/params.go @@ -371,6 +371,9 @@ func (e Enterprise) GetID() string { return e.ID } +// used by swagger client generated code +type Enterprises []Enterprise + // Users holds information about a particular user type User struct { ID string `json:"id"`