2023-07-05 13:20:01 +03:00
// 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"
2024-05-23 10:24:44 +00:00
httptransport "github.com/go-openapi/runtime/client"
2023-07-05 13:20:01 +03:00
"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 }
}
2024-05-23 10:24:44 +00:00
// New creates a new instances API client with basic auth credentials.
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth ( host , basePath , scheme , user , password string ) ClientService {
transport := httptransport . New ( host , basePath , [ ] string { scheme } )
transport . DefaultAuthentication = httptransport . BasicAuth ( user , password )
return & Client { transport : transport , formats : strfmt . Default }
}
// New creates a new instances API client with a bearer token for authentication.
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken ( host , basePath , scheme , bearerToken string ) ClientService {
transport := httptransport . New ( host , basePath , [ ] string { scheme } )
transport . DefaultAuthentication = httptransport . BearerToken ( bearerToken )
return & Client { transport : transport , formats : strfmt . Default }
}
2023-07-05 13:20:01 +03:00
/ *
Client for instances API
* /
type Client struct {
transport runtime . ClientTransport
formats strfmt . Registry
}
2024-05-23 10:24:44 +00:00
// ClientOption may be used to customize the behavior of Client methods.
2023-07-05 13:20:01 +03:00
type ClientOption func ( * runtime . ClientOperation )
// ClientService is the interface for Client methods
type ClientService interface {
2023-07-05 14:25:31 +03:00
DeleteInstance ( params * DeleteInstanceParams , authInfo runtime . ClientAuthInfoWriter , opts ... ClientOption ) error
2023-07-05 13:20:01 +03:00
2023-07-05 14:25:31 +03:00
GetInstance ( params * GetInstanceParams , authInfo runtime . ClientAuthInfoWriter , opts ... ClientOption ) ( * GetInstanceOK , error )
2023-07-05 13:20:01 +03:00
2023-07-05 14:25:31 +03:00
ListInstances ( params * ListInstancesParams , authInfo runtime . ClientAuthInfoWriter , opts ... ClientOption ) ( * ListInstancesOK , error )
2023-07-05 13:20:01 +03:00
2023-07-10 17:30:59 +03:00
ListPoolInstances ( params * ListPoolInstancesParams , authInfo runtime . ClientAuthInfoWriter , opts ... ClientOption ) ( * ListPoolInstancesOK , error )
2025-04-11 10:42:31 +00:00
ListScaleSetInstances ( params * ListScaleSetInstancesParams , authInfo runtime . ClientAuthInfoWriter , opts ... ClientOption ) ( * ListScaleSetInstancesOK , error )
2023-07-05 13:20:01 +03:00
SetTransport ( transport runtime . ClientTransport )
}
/ *
DeleteInstance deletes runner instance by name
* /
2023-07-05 14:25:31 +03:00
func ( a * Client ) DeleteInstance ( params * DeleteInstanceParams , authInfo runtime . ClientAuthInfoWriter , opts ... ClientOption ) error {
2023-07-05 13:20:01 +03:00
// 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 } ,
2023-07-05 14:25:31 +03:00
AuthInfo : authInfo ,
2023-07-05 13:20:01 +03:00
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
* /
2023-07-05 14:25:31 +03:00
func ( a * Client ) GetInstance ( params * GetInstanceParams , authInfo runtime . ClientAuthInfoWriter , opts ... ClientOption ) ( * GetInstanceOK , error ) {
2023-07-05 13:20:01 +03:00
// 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 } ,
2023-07-05 14:25:31 +03:00
AuthInfo : authInfo ,
2023-07-05 13:20:01 +03:00
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
* /
2023-07-05 14:25:31 +03:00
func ( a * Client ) ListInstances ( params * ListInstancesParams , authInfo runtime . ClientAuthInfoWriter , opts ... ClientOption ) ( * ListInstancesOK , error ) {
2023-07-05 13:20:01 +03:00
// 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 } ,
2023-07-05 14:25:31 +03:00
AuthInfo : authInfo ,
2023-07-05 13:20:01 +03:00
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 ( ) )
}
2023-07-10 17:30:59 +03:00
/ *
ListPoolInstances lists runner instances in a pool
* /
func ( a * Client ) ListPoolInstances ( params * ListPoolInstancesParams , authInfo runtime . ClientAuthInfoWriter , opts ... ClientOption ) ( * ListPoolInstancesOK , error ) {
// TODO: Validate the params before sending
if params == nil {
params = NewListPoolInstancesParams ( )
}
op := & runtime . ClientOperation {
ID : "ListPoolInstances" ,
Method : "GET" ,
PathPattern : "/pools/{poolID}/instances" ,
ProducesMediaTypes : [ ] string { "application/json" } ,
ConsumesMediaTypes : [ ] string { "application/json" } ,
Schemes : [ ] string { "http" } ,
Params : params ,
Reader : & ListPoolInstancesReader { 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 . ( * ListPoolInstancesOK )
if ok {
return success , nil
}
// unexpected success response
unexpectedSuccess := result . ( * ListPoolInstancesDefault )
return nil , runtime . NewAPIError ( "unexpected success response: content available as default response in error" , unexpectedSuccess , unexpectedSuccess . Code ( ) )
}
2025-04-11 10:42:31 +00:00
/ *
ListScaleSetInstances lists runner instances in a scale set
* /
func ( a * Client ) ListScaleSetInstances ( params * ListScaleSetInstancesParams , authInfo runtime . ClientAuthInfoWriter , opts ... ClientOption ) ( * ListScaleSetInstancesOK , error ) {
// TODO: Validate the params before sending
if params == nil {
params = NewListScaleSetInstancesParams ( )
}
op := & runtime . ClientOperation {
ID : "ListScaleSetInstances" ,
Method : "GET" ,
PathPattern : "/scalesets/{scalesetID}/instances" ,
ProducesMediaTypes : [ ] string { "application/json" } ,
ConsumesMediaTypes : [ ] string { "application/json" } ,
Schemes : [ ] string { "http" } ,
Params : params ,
Reader : & ListScaleSetInstancesReader { 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 . ( * ListScaleSetInstancesOK )
if ok {
return success , nil
}
// unexpected success response
unexpectedSuccess := result . ( * ListScaleSetInstancesDefault )
return nil , runtime . NewAPIError ( "unexpected success response: content available as default response in error" , unexpectedSuccess , unexpectedSuccess . Code ( ) )
}
2023-07-05 13:20:01 +03:00
// SetTransport changes the transport on the client
func ( a * Client ) SetTransport ( transport runtime . ClientTransport ) {
a . transport = transport
}