151 lines
4.6 KiB
Go
151 lines
4.6 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package instances
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"github.com/go-openapi/runtime"
|
|
"github.com/go-openapi/strfmt"
|
|
)
|
|
|
|
// New creates a new instances API client.
|
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
|
return &Client{transport: transport, formats: formats}
|
|
}
|
|
|
|
/*
|
|
Client for instances API
|
|
*/
|
|
type Client struct {
|
|
transport runtime.ClientTransport
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
// ClientOption is the option for Client methods
|
|
type ClientOption func(*runtime.ClientOperation)
|
|
|
|
// ClientService is the interface for Client methods
|
|
type ClientService interface {
|
|
DeleteInstance(params *DeleteInstanceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
|
|
|
|
GetInstance(params *GetInstanceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetInstanceOK, error)
|
|
|
|
ListInstances(params *ListInstancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListInstancesOK, error)
|
|
|
|
SetTransport(transport runtime.ClientTransport)
|
|
}
|
|
|
|
/*
|
|
DeleteInstance deletes runner instance by name
|
|
*/
|
|
func (a *Client) DeleteInstance(params *DeleteInstanceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewDeleteInstanceParams()
|
|
}
|
|
op := &runtime.ClientOperation{
|
|
ID: "DeleteInstance",
|
|
Method: "DELETE",
|
|
PathPattern: "/instances/{instanceName}",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &DeleteInstanceReader{formats: a.formats},
|
|
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
|
|
}
|
|
|
|
/*
|
|
GetInstance gets runner instance by name
|
|
*/
|
|
func (a *Client) GetInstance(params *GetInstanceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetInstanceOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewGetInstanceParams()
|
|
}
|
|
op := &runtime.ClientOperation{
|
|
ID: "GetInstance",
|
|
Method: "GET",
|
|
PathPattern: "/instances/{instanceName}",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &GetInstanceReader{formats: a.formats},
|
|
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.(*GetInstanceOK)
|
|
if ok {
|
|
return success, nil
|
|
}
|
|
// unexpected success response
|
|
unexpectedSuccess := result.(*GetInstanceDefault)
|
|
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
|
}
|
|
|
|
/*
|
|
ListInstances gets all runners instances
|
|
*/
|
|
func (a *Client) ListInstances(params *ListInstancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListInstancesOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewListInstancesParams()
|
|
}
|
|
op := &runtime.ClientOperation{
|
|
ID: "ListInstances",
|
|
Method: "GET",
|
|
PathPattern: "/instances",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &ListInstancesReader{formats: a.formats},
|
|
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.(*ListInstancesOK)
|
|
if ok {
|
|
return success, nil
|
|
}
|
|
// unexpected success response
|
|
unexpectedSuccess := result.(*ListInstancesDefault)
|
|
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
|
}
|
|
|
|
// SetTransport changes the transport on the client
|
|
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
|
a.transport = transport
|
|
}
|