Add scaleset commands

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2025-04-11 13:27:35 +00:00
parent 7e1a83c79a
commit 7174e030e2
26 changed files with 3313 additions and 8 deletions

View file

@ -277,6 +277,62 @@ func (a *APIController) CreateEnterprisePoolHandler(w http.ResponseWriter, r *ht
}
}
// swagger:route POST /enterprises/{enterpriseID}/scalesets enterprises scalesets CreateEnterpriseScaleSet
//
// 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 scale set.
// type: CreateScaleSetParams
// in: body
// required: true
//
// Responses:
// 200: ScaleSet
// default: APIErrorResponse
func (a *APIController) CreateEnterpriseScaleSetHandler(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
vars := mux.Vars(r)
enterpriseID, ok := vars["enterpriseID"]
if !ok {
w.WriteHeader(http.StatusBadRequest)
if err := json.NewEncoder(w).Encode(params.APIErrorResponse{
Error: "Bad Request",
Details: "No enterprise ID specified",
}); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
}
return
}
var scaleSetData runnerParams.CreateScaleSetParams
if err := json.NewDecoder(r.Body).Decode(&scaleSetData); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to decode")
handleError(ctx, w, gErrors.ErrBadRequest)
return
}
scaleSet, err := a.r.CreateEntityScaleSet(ctx, runnerParams.GithubEntityTypeEnterprise, enterpriseID, scaleSetData)
if err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "error creating enterprise scale set")
handleError(ctx, w, err)
return
}
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(scaleSet); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
}
}
// swagger:route GET /enterprises/{enterpriseID}/pools enterprises pools ListEnterprisePools
//
// List enterprise pools.
@ -319,6 +375,48 @@ func (a *APIController) ListEnterprisePoolsHandler(w http.ResponseWriter, r *htt
}
}
// swagger:route GET /enterprises/{enterpriseID}/scalesets enterprises scalesets ListEnterpriseScaleSets
//
// List enterprise scale sets.
//
// Parameters:
// + name: enterpriseID
// description: Enterprise ID.
// type: string
// in: path
// required: true
//
// Responses:
// 200: ScaleSets
// default: APIErrorResponse
func (a *APIController) ListEnterpriseScaleSetsHandler(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
vars := mux.Vars(r)
enterpriseID, ok := vars["enterpriseID"]
if !ok {
w.WriteHeader(http.StatusBadRequest)
if err := json.NewEncoder(w).Encode(params.APIErrorResponse{
Error: "Bad Request",
Details: "No enterprise ID specified",
}); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
}
return
}
scaleSets, err := a.r.ListEntityScaleSets(ctx, runnerParams.GithubEntityTypeEnterprise, enterpriseID)
if err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "listing scale sets")
handleError(ctx, w, err)
return
}
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(scaleSets); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
}
}
// swagger:route GET /enterprises/{enterpriseID}/pools/{poolID} enterprises pools GetEnterprisePool
//
// Get enterprise pool by ID.

View file

@ -287,6 +287,62 @@ func (a *APIController) CreateOrgPoolHandler(w http.ResponseWriter, r *http.Requ
}
}
// swagger:route POST /organizations/{orgID}/scalesets organizations scalesets CreateOrgScaleSet
//
// Create organization scale set with the parameters given.
//
// Parameters:
// + name: orgID
// description: Organization ID.
// type: string
// in: path
// required: true
//
// + name: Body
// description: Parameters used when creating the organization scale set.
// type: CreateScaleSetParams
// in: body
// required: true
//
// Responses:
// 200: ScaleSet
// default: APIErrorResponse
func (a *APIController) CreateOrgScaleSetHandler(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
vars := mux.Vars(r)
orgID, ok := vars["orgID"]
if !ok {
w.WriteHeader(http.StatusBadRequest)
if err := json.NewEncoder(w).Encode(params.APIErrorResponse{
Error: "Bad Request",
Details: "No org ID specified",
}); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
}
return
}
var scalesetData runnerParams.CreateScaleSetParams
if err := json.NewDecoder(r.Body).Decode(&scalesetData); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to decode")
handleError(ctx, w, gErrors.ErrBadRequest)
return
}
scaleSet, err := a.r.CreateEntityScaleSet(ctx, runnerParams.GithubEntityTypeOrganization, orgID, scalesetData)
if err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "error creating organization scale set")
handleError(ctx, w, err)
return
}
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(scaleSet); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
}
}
// swagger:route GET /organizations/{orgID}/pools organizations pools ListOrgPools
//
// List organization pools.
@ -329,6 +385,48 @@ func (a *APIController) ListOrgPoolsHandler(w http.ResponseWriter, r *http.Reque
}
}
// swagger:route GET /organizations/{orgID}/scalesets organizations scalesets ListOrgScaleSets
//
// List organization scale sets.
//
// Parameters:
// + name: orgID
// description: Organization ID.
// type: string
// in: path
// required: true
//
// Responses:
// 200: ScaleSets
// default: APIErrorResponse
func (a *APIController) ListOrgScaleSetsHandler(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
vars := mux.Vars(r)
orgID, ok := vars["orgID"]
if !ok {
w.WriteHeader(http.StatusBadRequest)
if err := json.NewEncoder(w).Encode(params.APIErrorResponse{
Error: "Bad Request",
Details: "No org ID specified",
}); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
}
return
}
scaleSets, err := a.r.ListEntityScaleSets(ctx, runnerParams.GithubEntityTypeOrganization, orgID)
if err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "listing scale sets")
handleError(ctx, w, err)
return
}
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(scaleSets); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
}
}
// swagger:route GET /organizations/{orgID}/pools/{poolID} organizations pools GetOrgPool
//
// Get organization pool by ID.

View file

@ -286,6 +286,62 @@ func (a *APIController) CreateRepoPoolHandler(w http.ResponseWriter, r *http.Req
}
}
// swagger:route POST /repositories/{repoID}/scalesets repositories scalesets CreateRepoScaleSet
//
// Create repository scale set with the parameters given.
//
// Parameters:
// + name: repoID
// description: Repository ID.
// type: string
// in: path
// required: true
//
// + name: Body
// description: Parameters used when creating the repository scale set.
// type: CreateScaleSetParams
// in: body
// required: true
//
// Responses:
// 200: ScaleSet
// default: APIErrorResponse
func (a *APIController) CreateRepoScaleSetHandler(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
vars := mux.Vars(r)
repoID, ok := vars["repoID"]
if !ok {
w.WriteHeader(http.StatusBadRequest)
if err := json.NewEncoder(w).Encode(params.APIErrorResponse{
Error: "Bad Request",
Details: "No repo ID specified",
}); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
}
return
}
var scaleSetData runnerParams.CreateScaleSetParams
if err := json.NewDecoder(r.Body).Decode(&scaleSetData); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to decode")
handleError(ctx, w, gErrors.ErrBadRequest)
return
}
scaleSet, err := a.r.CreateEntityScaleSet(ctx, runnerParams.GithubEntityTypeRepository, repoID, scaleSetData)
if err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "error creating repository scale set")
handleError(ctx, w, err)
return
}
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(scaleSet); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
}
}
// swagger:route GET /repositories/{repoID}/pools repositories pools ListRepoPools
//
// List repository pools.
@ -328,6 +384,48 @@ func (a *APIController) ListRepoPoolsHandler(w http.ResponseWriter, r *http.Requ
}
}
// swagger:route GET /repositories/{repoID}/scalesets repositories scalesets ListRepoScaleSets
//
// List repository scale sets.
//
// Parameters:
// + name: repoID
// description: Repository ID.
// type: string
// in: path
// required: true
//
// Responses:
// 200: ScaleSets
// default: APIErrorResponse
func (a *APIController) ListRepoScaleSetsHandler(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
vars := mux.Vars(r)
repoID, ok := vars["repoID"]
if !ok {
w.WriteHeader(http.StatusBadRequest)
if err := json.NewEncoder(w).Encode(params.APIErrorResponse{
Error: "Bad Request",
Details: "No repo ID specified",
}); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
}
return
}
scaleSets, err := a.r.ListEntityScaleSets(ctx, runnerParams.GithubEntityTypeRepository, repoID)
if err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "listing scale sets")
handleError(ctx, w, err)
return
}
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(scaleSets); err != nil {
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
}
}
// swagger:route GET /repositories/{repoID}/pools/{poolID} repositories pools GetRepoPool
//
// Get repository pool by ID.

View file

@ -265,6 +265,14 @@ func NewAPIRouter(han *controllers.APIController, authMiddleware, initMiddleware
apiRouter.Handle("/repositories/{repoID}/pools/", http.HandlerFunc(han.CreateRepoPoolHandler)).Methods("POST", "OPTIONS")
apiRouter.Handle("/repositories/{repoID}/pools", http.HandlerFunc(han.CreateRepoPoolHandler)).Methods("POST", "OPTIONS")
// Create scale set
apiRouter.Handle("/repositories/{repoID}/scalesets/", http.HandlerFunc(han.CreateRepoScaleSetHandler)).Methods("POST", "OPTIONS")
apiRouter.Handle("/repositories/{repoID}/scalesets", http.HandlerFunc(han.CreateRepoScaleSetHandler)).Methods("POST", "OPTIONS")
// List scale sets
apiRouter.Handle("/repositories/{repoID}/scalesets/", http.HandlerFunc(han.ListRepoScaleSetsHandler)).Methods("GET", "OPTIONS")
apiRouter.Handle("/repositories/{repoID}/scalesets", http.HandlerFunc(han.ListRepoScaleSetsHandler)).Methods("GET", "OPTIONS")
// Repo instances list
apiRouter.Handle("/repositories/{repoID}/instances/", http.HandlerFunc(han.ListRepoInstancesHandler)).Methods("GET", "OPTIONS")
apiRouter.Handle("/repositories/{repoID}/instances", http.HandlerFunc(han.ListRepoInstancesHandler)).Methods("GET", "OPTIONS")
@ -315,6 +323,14 @@ func NewAPIRouter(han *controllers.APIController, authMiddleware, initMiddleware
apiRouter.Handle("/organizations/{orgID}/pools/", http.HandlerFunc(han.CreateOrgPoolHandler)).Methods("POST", "OPTIONS")
apiRouter.Handle("/organizations/{orgID}/pools", http.HandlerFunc(han.CreateOrgPoolHandler)).Methods("POST", "OPTIONS")
// Create org scale set
apiRouter.Handle("/organizations/{orgID}/scalesets/", http.HandlerFunc(han.CreateOrgScaleSetHandler)).Methods("POST", "OPTIONS")
apiRouter.Handle("/organizations/{orgID}/scalesets", http.HandlerFunc(han.CreateOrgScaleSetHandler)).Methods("POST", "OPTIONS")
// List org scale sets
apiRouter.Handle("/organizations/{orgID}/scalesets/", http.HandlerFunc(han.ListOrgScaleSetsHandler)).Methods("GET", "OPTIONS")
apiRouter.Handle("/organizations/{orgID}/scalesets", http.HandlerFunc(han.ListOrgScaleSetsHandler)).Methods("GET", "OPTIONS")
// Org instances list
apiRouter.Handle("/organizations/{orgID}/instances/", http.HandlerFunc(han.ListOrgInstancesHandler)).Methods("GET", "OPTIONS")
apiRouter.Handle("/organizations/{orgID}/instances", http.HandlerFunc(han.ListOrgInstancesHandler)).Methods("GET", "OPTIONS")
@ -365,6 +381,14 @@ func NewAPIRouter(han *controllers.APIController, authMiddleware, initMiddleware
apiRouter.Handle("/enterprises/{enterpriseID}/pools/", http.HandlerFunc(han.CreateEnterprisePoolHandler)).Methods("POST", "OPTIONS")
apiRouter.Handle("/enterprises/{enterpriseID}/pools", http.HandlerFunc(han.CreateEnterprisePoolHandler)).Methods("POST", "OPTIONS")
// Create enterprise scale sets
apiRouter.Handle("/enterprises/{enterpriseID}/scalesets/", http.HandlerFunc(han.CreateEnterpriseScaleSetHandler)).Methods("POST", "OPTIONS")
apiRouter.Handle("/enterprises/{enterpriseID}/scalesets", http.HandlerFunc(han.CreateEnterpriseScaleSetHandler)).Methods("POST", "OPTIONS")
// List enterprise scale sets
apiRouter.Handle("/enterprises/{enterpriseID}/scalesets/", http.HandlerFunc(han.ListEnterpriseScaleSetsHandler)).Methods("GET", "OPTIONS")
apiRouter.Handle("/enterprises/{enterpriseID}/scalesets", http.HandlerFunc(han.ListEnterpriseScaleSetsHandler)).Methods("GET", "OPTIONS")
// Enterprise instances list
apiRouter.Handle("/enterprises/{enterpriseID}/instances/", http.HandlerFunc(han.ListEnterpriseInstancesHandler)).Methods("GET", "OPTIONS")
apiRouter.Handle("/enterprises/{enterpriseID}/instances", http.HandlerFunc(han.ListEnterpriseInstancesHandler)).Methods("GET", "OPTIONS")

View file

@ -646,6 +646,57 @@ paths:
tags:
- enterprises
- pools
/enterprises/{enterpriseID}/scalesets:
get:
operationId: ListEnterpriseScaleSets
parameters:
- description: Enterprise ID.
in: path
name: enterpriseID
required: true
type: string
responses:
"200":
description: ScaleSets
schema:
$ref: '#/definitions/ScaleSets'
default:
description: APIErrorResponse
schema:
$ref: '#/definitions/APIErrorResponse'
summary: List enterprise scale sets.
tags:
- enterprises
- scalesets
post:
operationId: CreateEnterpriseScaleSet
parameters:
- description: Enterprise ID.
in: path
name: enterpriseID
required: true
type: string
- description: Parameters used when creating the enterprise scale set.
in: body
name: Body
required: true
schema:
$ref: '#/definitions/CreateScaleSetParams'
description: Parameters used when creating the enterprise scale set.
type: object
responses:
"200":
description: ScaleSet
schema:
$ref: '#/definitions/ScaleSet'
default:
description: APIErrorResponse
schema:
$ref: '#/definitions/APIErrorResponse'
summary: Create enterprise pool with the parameters given.
tags:
- enterprises
- scalesets
/first-run:
post:
operationId: FirstRun
@ -1229,6 +1280,57 @@ paths:
tags:
- organizations
- pools
/organizations/{orgID}/scalesets:
get:
operationId: ListOrgScaleSets
parameters:
- description: Organization ID.
in: path
name: orgID
required: true
type: string
responses:
"200":
description: ScaleSets
schema:
$ref: '#/definitions/ScaleSets'
default:
description: APIErrorResponse
schema:
$ref: '#/definitions/APIErrorResponse'
summary: List organization scale sets.
tags:
- organizations
- scalesets
post:
operationId: CreateOrgScaleSet
parameters:
- description: Organization ID.
in: path
name: orgID
required: true
type: string
- description: Parameters used when creating the organization scale set.
in: body
name: Body
required: true
schema:
$ref: '#/definitions/CreateScaleSetParams'
description: Parameters used when creating the organization scale set.
type: object
responses:
"200":
description: ScaleSet
schema:
$ref: '#/definitions/ScaleSet'
default:
description: APIErrorResponse
schema:
$ref: '#/definitions/APIErrorResponse'
summary: Create organization scale set with the parameters given.
tags:
- organizations
- scalesets
/organizations/{orgID}/webhook:
delete:
operationId: UninstallOrgWebhook
@ -1678,6 +1780,57 @@ paths:
tags:
- repositories
- pools
/repositories/{repoID}/scalesets:
get:
operationId: ListRepoScaleSets
parameters:
- description: Repository ID.
in: path
name: repoID
required: true
type: string
responses:
"200":
description: ScaleSets
schema:
$ref: '#/definitions/ScaleSets'
default:
description: APIErrorResponse
schema:
$ref: '#/definitions/APIErrorResponse'
summary: List repository scale sets.
tags:
- repositories
- scalesets
post:
operationId: CreateRepoScaleSet
parameters:
- description: Repository ID.
in: path
name: repoID
required: true
type: string
- description: Parameters used when creating the repository scale set.
in: body
name: Body
required: true
schema:
$ref: '#/definitions/CreateScaleSetParams'
description: Parameters used when creating the repository scale set.
type: object
responses:
"200":
description: ScaleSet
schema:
$ref: '#/definitions/ScaleSet'
default:
description: APIErrorResponse
schema:
$ref: '#/definitions/APIErrorResponse'
summary: Create repository scale set with the parameters given.
tags:
- repositories
- scalesets
/repositories/{repoID}/webhook:
delete:
operationId: UninstallRepoWebhook

View file

@ -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"
)
// NewCreateEnterpriseScaleSetParams creates a new CreateEnterpriseScaleSetParams 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 NewCreateEnterpriseScaleSetParams() *CreateEnterpriseScaleSetParams {
return &CreateEnterpriseScaleSetParams{
timeout: cr.DefaultTimeout,
}
}
// NewCreateEnterpriseScaleSetParamsWithTimeout creates a new CreateEnterpriseScaleSetParams object
// with the ability to set a timeout on a request.
func NewCreateEnterpriseScaleSetParamsWithTimeout(timeout time.Duration) *CreateEnterpriseScaleSetParams {
return &CreateEnterpriseScaleSetParams{
timeout: timeout,
}
}
// NewCreateEnterpriseScaleSetParamsWithContext creates a new CreateEnterpriseScaleSetParams object
// with the ability to set a context for a request.
func NewCreateEnterpriseScaleSetParamsWithContext(ctx context.Context) *CreateEnterpriseScaleSetParams {
return &CreateEnterpriseScaleSetParams{
Context: ctx,
}
}
// NewCreateEnterpriseScaleSetParamsWithHTTPClient creates a new CreateEnterpriseScaleSetParams object
// with the ability to set a custom HTTPClient for a request.
func NewCreateEnterpriseScaleSetParamsWithHTTPClient(client *http.Client) *CreateEnterpriseScaleSetParams {
return &CreateEnterpriseScaleSetParams{
HTTPClient: client,
}
}
/*
CreateEnterpriseScaleSetParams contains all the parameters to send to the API endpoint
for the create enterprise scale set operation.
Typically these are written to a http.Request.
*/
type CreateEnterpriseScaleSetParams struct {
/* Body.
Parameters used when creating the enterprise scale set.
*/
Body garm_params.CreateScaleSetParams
/* EnterpriseID.
Enterprise ID.
*/
EnterpriseID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the create enterprise scale set params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *CreateEnterpriseScaleSetParams) WithDefaults() *CreateEnterpriseScaleSetParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the create enterprise scale set params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *CreateEnterpriseScaleSetParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the create enterprise scale set params
func (o *CreateEnterpriseScaleSetParams) WithTimeout(timeout time.Duration) *CreateEnterpriseScaleSetParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the create enterprise scale set params
func (o *CreateEnterpriseScaleSetParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the create enterprise scale set params
func (o *CreateEnterpriseScaleSetParams) WithContext(ctx context.Context) *CreateEnterpriseScaleSetParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the create enterprise scale set params
func (o *CreateEnterpriseScaleSetParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the create enterprise scale set params
func (o *CreateEnterpriseScaleSetParams) WithHTTPClient(client *http.Client) *CreateEnterpriseScaleSetParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the create enterprise scale set params
func (o *CreateEnterpriseScaleSetParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the create enterprise scale set params
func (o *CreateEnterpriseScaleSetParams) WithBody(body garm_params.CreateScaleSetParams) *CreateEnterpriseScaleSetParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the create enterprise scale set params
func (o *CreateEnterpriseScaleSetParams) SetBody(body garm_params.CreateScaleSetParams) {
o.Body = body
}
// WithEnterpriseID adds the enterpriseID to the create enterprise scale set params
func (o *CreateEnterpriseScaleSetParams) WithEnterpriseID(enterpriseID string) *CreateEnterpriseScaleSetParams {
o.SetEnterpriseID(enterpriseID)
return o
}
// SetEnterpriseID adds the enterpriseId to the create enterprise scale set params
func (o *CreateEnterpriseScaleSetParams) SetEnterpriseID(enterpriseID string) {
o.EnterpriseID = enterpriseID
}
// WriteToRequest writes these params to a swagger request
func (o *CreateEnterpriseScaleSetParams) 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
}

View file

@ -0,0 +1,184 @@
// 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 (
"encoding/json"
"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"
)
// CreateEnterpriseScaleSetReader is a Reader for the CreateEnterpriseScaleSet structure.
type CreateEnterpriseScaleSetReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CreateEnterpriseScaleSetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewCreateEnterpriseScaleSetOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewCreateEnterpriseScaleSetDefault(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
}
}
// NewCreateEnterpriseScaleSetOK creates a CreateEnterpriseScaleSetOK with default headers values
func NewCreateEnterpriseScaleSetOK() *CreateEnterpriseScaleSetOK {
return &CreateEnterpriseScaleSetOK{}
}
/*
CreateEnterpriseScaleSetOK describes a response with status code 200, with default header values.
ScaleSet
*/
type CreateEnterpriseScaleSetOK struct {
Payload garm_params.ScaleSet
}
// IsSuccess returns true when this create enterprise scale set o k response has a 2xx status code
func (o *CreateEnterpriseScaleSetOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this create enterprise scale set o k response has a 3xx status code
func (o *CreateEnterpriseScaleSetOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this create enterprise scale set o k response has a 4xx status code
func (o *CreateEnterpriseScaleSetOK) IsClientError() bool {
return false
}
// IsServerError returns true when this create enterprise scale set o k response has a 5xx status code
func (o *CreateEnterpriseScaleSetOK) IsServerError() bool {
return false
}
// IsCode returns true when this create enterprise scale set o k response a status code equal to that given
func (o *CreateEnterpriseScaleSetOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the create enterprise scale set o k response
func (o *CreateEnterpriseScaleSetOK) Code() int {
return 200
}
func (o *CreateEnterpriseScaleSetOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/scalesets][%d] createEnterpriseScaleSetOK %s", 200, payload)
}
func (o *CreateEnterpriseScaleSetOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/scalesets][%d] createEnterpriseScaleSetOK %s", 200, payload)
}
func (o *CreateEnterpriseScaleSetOK) GetPayload() garm_params.ScaleSet {
return o.Payload
}
func (o *CreateEnterpriseScaleSetOK) 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
}
// NewCreateEnterpriseScaleSetDefault creates a CreateEnterpriseScaleSetDefault with default headers values
func NewCreateEnterpriseScaleSetDefault(code int) *CreateEnterpriseScaleSetDefault {
return &CreateEnterpriseScaleSetDefault{
_statusCode: code,
}
}
/*
CreateEnterpriseScaleSetDefault describes a response with status code -1, with default header values.
APIErrorResponse
*/
type CreateEnterpriseScaleSetDefault struct {
_statusCode int
Payload apiserver_params.APIErrorResponse
}
// IsSuccess returns true when this create enterprise scale set default response has a 2xx status code
func (o *CreateEnterpriseScaleSetDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this create enterprise scale set default response has a 3xx status code
func (o *CreateEnterpriseScaleSetDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this create enterprise scale set default response has a 4xx status code
func (o *CreateEnterpriseScaleSetDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this create enterprise scale set default response has a 5xx status code
func (o *CreateEnterpriseScaleSetDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this create enterprise scale set default response a status code equal to that given
func (o *CreateEnterpriseScaleSetDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the create enterprise scale set default response
func (o *CreateEnterpriseScaleSetDefault) Code() int {
return o._statusCode
}
func (o *CreateEnterpriseScaleSetDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/scalesets][%d] CreateEnterpriseScaleSet default %s", o._statusCode, payload)
}
func (o *CreateEnterpriseScaleSetDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /enterprises/{enterpriseID}/scalesets][%d] CreateEnterpriseScaleSet default %s", o._statusCode, payload)
}
func (o *CreateEnterpriseScaleSetDefault) GetPayload() apiserver_params.APIErrorResponse {
return o.Payload
}
func (o *CreateEnterpriseScaleSetDefault) 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
}

View file

@ -58,6 +58,8 @@ type ClientService interface {
CreateEnterprisePool(params *CreateEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateEnterprisePoolOK, error)
CreateEnterpriseScaleSet(params *CreateEnterpriseScaleSetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateEnterpriseScaleSetOK, error)
DeleteEnterprise(params *DeleteEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
DeleteEnterprisePool(params *DeleteEnterprisePoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
@ -70,6 +72,8 @@ type ClientService interface {
ListEnterprisePools(params *ListEnterprisePoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterprisePoolsOK, error)
ListEnterpriseScaleSets(params *ListEnterpriseScaleSetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterpriseScaleSetsOK, error)
ListEnterprises(params *ListEnterprisesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterprisesOK, error)
UpdateEnterprise(params *UpdateEnterpriseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateEnterpriseOK, error)
@ -155,6 +159,44 @@ func (a *Client) CreateEnterprisePool(params *CreateEnterprisePoolParams, authIn
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
CreateEnterpriseScaleSet creates enterprise pool with the parameters given
*/
func (a *Client) CreateEnterpriseScaleSet(params *CreateEnterpriseScaleSetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateEnterpriseScaleSetOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateEnterpriseScaleSetParams()
}
op := &runtime.ClientOperation{
ID: "CreateEnterpriseScaleSet",
Method: "POST",
PathPattern: "/enterprises/{enterpriseID}/scalesets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &CreateEnterpriseScaleSetReader{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.(*CreateEnterpriseScaleSetOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*CreateEnterpriseScaleSetDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
DeleteEnterprise deletes enterprise by ID
*/
@ -371,6 +413,44 @@ func (a *Client) ListEnterprisePools(params *ListEnterprisePoolsParams, authInfo
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListEnterpriseScaleSets lists enterprise scale sets
*/
func (a *Client) ListEnterpriseScaleSets(params *ListEnterpriseScaleSetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnterpriseScaleSetsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListEnterpriseScaleSetsParams()
}
op := &runtime.ClientOperation{
ID: "ListEnterpriseScaleSets",
Method: "GET",
PathPattern: "/enterprises/{enterpriseID}/scalesets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &ListEnterpriseScaleSetsReader{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.(*ListEnterpriseScaleSetsOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*ListEnterpriseScaleSetsDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListEnterprises lists all enterprises
*/

View file

@ -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"
)
// NewListEnterpriseScaleSetsParams creates a new ListEnterpriseScaleSetsParams 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 NewListEnterpriseScaleSetsParams() *ListEnterpriseScaleSetsParams {
return &ListEnterpriseScaleSetsParams{
timeout: cr.DefaultTimeout,
}
}
// NewListEnterpriseScaleSetsParamsWithTimeout creates a new ListEnterpriseScaleSetsParams object
// with the ability to set a timeout on a request.
func NewListEnterpriseScaleSetsParamsWithTimeout(timeout time.Duration) *ListEnterpriseScaleSetsParams {
return &ListEnterpriseScaleSetsParams{
timeout: timeout,
}
}
// NewListEnterpriseScaleSetsParamsWithContext creates a new ListEnterpriseScaleSetsParams object
// with the ability to set a context for a request.
func NewListEnterpriseScaleSetsParamsWithContext(ctx context.Context) *ListEnterpriseScaleSetsParams {
return &ListEnterpriseScaleSetsParams{
Context: ctx,
}
}
// NewListEnterpriseScaleSetsParamsWithHTTPClient creates a new ListEnterpriseScaleSetsParams object
// with the ability to set a custom HTTPClient for a request.
func NewListEnterpriseScaleSetsParamsWithHTTPClient(client *http.Client) *ListEnterpriseScaleSetsParams {
return &ListEnterpriseScaleSetsParams{
HTTPClient: client,
}
}
/*
ListEnterpriseScaleSetsParams contains all the parameters to send to the API endpoint
for the list enterprise scale sets operation.
Typically these are written to a http.Request.
*/
type ListEnterpriseScaleSetsParams struct {
/* EnterpriseID.
Enterprise ID.
*/
EnterpriseID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the list enterprise scale sets params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListEnterpriseScaleSetsParams) WithDefaults() *ListEnterpriseScaleSetsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list enterprise scale sets params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListEnterpriseScaleSetsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the list enterprise scale sets params
func (o *ListEnterpriseScaleSetsParams) WithTimeout(timeout time.Duration) *ListEnterpriseScaleSetsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list enterprise scale sets params
func (o *ListEnterpriseScaleSetsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list enterprise scale sets params
func (o *ListEnterpriseScaleSetsParams) WithContext(ctx context.Context) *ListEnterpriseScaleSetsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list enterprise scale sets params
func (o *ListEnterpriseScaleSetsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list enterprise scale sets params
func (o *ListEnterpriseScaleSetsParams) WithHTTPClient(client *http.Client) *ListEnterpriseScaleSetsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list enterprise scale sets params
func (o *ListEnterpriseScaleSetsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithEnterpriseID adds the enterpriseID to the list enterprise scale sets params
func (o *ListEnterpriseScaleSetsParams) WithEnterpriseID(enterpriseID string) *ListEnterpriseScaleSetsParams {
o.SetEnterpriseID(enterpriseID)
return o
}
// SetEnterpriseID adds the enterpriseId to the list enterprise scale sets params
func (o *ListEnterpriseScaleSetsParams) SetEnterpriseID(enterpriseID string) {
o.EnterpriseID = enterpriseID
}
// WriteToRequest writes these params to a swagger request
func (o *ListEnterpriseScaleSetsParams) 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
}

View file

@ -0,0 +1,184 @@
// 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 (
"encoding/json"
"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"
)
// ListEnterpriseScaleSetsReader is a Reader for the ListEnterpriseScaleSets structure.
type ListEnterpriseScaleSetsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListEnterpriseScaleSetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewListEnterpriseScaleSetsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewListEnterpriseScaleSetsDefault(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
}
}
// NewListEnterpriseScaleSetsOK creates a ListEnterpriseScaleSetsOK with default headers values
func NewListEnterpriseScaleSetsOK() *ListEnterpriseScaleSetsOK {
return &ListEnterpriseScaleSetsOK{}
}
/*
ListEnterpriseScaleSetsOK describes a response with status code 200, with default header values.
ScaleSets
*/
type ListEnterpriseScaleSetsOK struct {
Payload garm_params.ScaleSets
}
// IsSuccess returns true when this list enterprise scale sets o k response has a 2xx status code
func (o *ListEnterpriseScaleSetsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this list enterprise scale sets o k response has a 3xx status code
func (o *ListEnterpriseScaleSetsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this list enterprise scale sets o k response has a 4xx status code
func (o *ListEnterpriseScaleSetsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this list enterprise scale sets o k response has a 5xx status code
func (o *ListEnterpriseScaleSetsOK) IsServerError() bool {
return false
}
// IsCode returns true when this list enterprise scale sets o k response a status code equal to that given
func (o *ListEnterpriseScaleSetsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the list enterprise scale sets o k response
func (o *ListEnterpriseScaleSetsOK) Code() int {
return 200
}
func (o *ListEnterpriseScaleSetsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/scalesets][%d] listEnterpriseScaleSetsOK %s", 200, payload)
}
func (o *ListEnterpriseScaleSetsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/scalesets][%d] listEnterpriseScaleSetsOK %s", 200, payload)
}
func (o *ListEnterpriseScaleSetsOK) GetPayload() garm_params.ScaleSets {
return o.Payload
}
func (o *ListEnterpriseScaleSetsOK) 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
}
// NewListEnterpriseScaleSetsDefault creates a ListEnterpriseScaleSetsDefault with default headers values
func NewListEnterpriseScaleSetsDefault(code int) *ListEnterpriseScaleSetsDefault {
return &ListEnterpriseScaleSetsDefault{
_statusCode: code,
}
}
/*
ListEnterpriseScaleSetsDefault describes a response with status code -1, with default header values.
APIErrorResponse
*/
type ListEnterpriseScaleSetsDefault struct {
_statusCode int
Payload apiserver_params.APIErrorResponse
}
// IsSuccess returns true when this list enterprise scale sets default response has a 2xx status code
func (o *ListEnterpriseScaleSetsDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this list enterprise scale sets default response has a 3xx status code
func (o *ListEnterpriseScaleSetsDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this list enterprise scale sets default response has a 4xx status code
func (o *ListEnterpriseScaleSetsDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this list enterprise scale sets default response has a 5xx status code
func (o *ListEnterpriseScaleSetsDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this list enterprise scale sets default response a status code equal to that given
func (o *ListEnterpriseScaleSetsDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the list enterprise scale sets default response
func (o *ListEnterpriseScaleSetsDefault) Code() int {
return o._statusCode
}
func (o *ListEnterpriseScaleSetsDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/scalesets][%d] ListEnterpriseScaleSets default %s", o._statusCode, payload)
}
func (o *ListEnterpriseScaleSetsDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /enterprises/{enterpriseID}/scalesets][%d] ListEnterpriseScaleSets default %s", o._statusCode, payload)
}
func (o *ListEnterpriseScaleSetsDefault) GetPayload() apiserver_params.APIErrorResponse {
return o.Payload
}
func (o *ListEnterpriseScaleSetsDefault) 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
}

View file

@ -0,0 +1,173 @@
// Code generated by go-swagger; DO NOT EDIT.
package organizations
// 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"
)
// NewCreateOrgScaleSetParams creates a new CreateOrgScaleSetParams 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 NewCreateOrgScaleSetParams() *CreateOrgScaleSetParams {
return &CreateOrgScaleSetParams{
timeout: cr.DefaultTimeout,
}
}
// NewCreateOrgScaleSetParamsWithTimeout creates a new CreateOrgScaleSetParams object
// with the ability to set a timeout on a request.
func NewCreateOrgScaleSetParamsWithTimeout(timeout time.Duration) *CreateOrgScaleSetParams {
return &CreateOrgScaleSetParams{
timeout: timeout,
}
}
// NewCreateOrgScaleSetParamsWithContext creates a new CreateOrgScaleSetParams object
// with the ability to set a context for a request.
func NewCreateOrgScaleSetParamsWithContext(ctx context.Context) *CreateOrgScaleSetParams {
return &CreateOrgScaleSetParams{
Context: ctx,
}
}
// NewCreateOrgScaleSetParamsWithHTTPClient creates a new CreateOrgScaleSetParams object
// with the ability to set a custom HTTPClient for a request.
func NewCreateOrgScaleSetParamsWithHTTPClient(client *http.Client) *CreateOrgScaleSetParams {
return &CreateOrgScaleSetParams{
HTTPClient: client,
}
}
/*
CreateOrgScaleSetParams contains all the parameters to send to the API endpoint
for the create org scale set operation.
Typically these are written to a http.Request.
*/
type CreateOrgScaleSetParams struct {
/* Body.
Parameters used when creating the organization scale set.
*/
Body garm_params.CreateScaleSetParams
/* OrgID.
Organization ID.
*/
OrgID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the create org scale set params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *CreateOrgScaleSetParams) WithDefaults() *CreateOrgScaleSetParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the create org scale set params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *CreateOrgScaleSetParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the create org scale set params
func (o *CreateOrgScaleSetParams) WithTimeout(timeout time.Duration) *CreateOrgScaleSetParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the create org scale set params
func (o *CreateOrgScaleSetParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the create org scale set params
func (o *CreateOrgScaleSetParams) WithContext(ctx context.Context) *CreateOrgScaleSetParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the create org scale set params
func (o *CreateOrgScaleSetParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the create org scale set params
func (o *CreateOrgScaleSetParams) WithHTTPClient(client *http.Client) *CreateOrgScaleSetParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the create org scale set params
func (o *CreateOrgScaleSetParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the create org scale set params
func (o *CreateOrgScaleSetParams) WithBody(body garm_params.CreateScaleSetParams) *CreateOrgScaleSetParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the create org scale set params
func (o *CreateOrgScaleSetParams) SetBody(body garm_params.CreateScaleSetParams) {
o.Body = body
}
// WithOrgID adds the orgID to the create org scale set params
func (o *CreateOrgScaleSetParams) WithOrgID(orgID string) *CreateOrgScaleSetParams {
o.SetOrgID(orgID)
return o
}
// SetOrgID adds the orgId to the create org scale set params
func (o *CreateOrgScaleSetParams) SetOrgID(orgID string) {
o.OrgID = orgID
}
// WriteToRequest writes these params to a swagger request
func (o *CreateOrgScaleSetParams) 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 orgID
if err := r.SetPathParam("orgID", o.OrgID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View file

@ -0,0 +1,184 @@
// Code generated by go-swagger; DO NOT EDIT.
package organizations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
apiserver_params "github.com/cloudbase/garm/apiserver/params"
garm_params "github.com/cloudbase/garm/params"
)
// CreateOrgScaleSetReader is a Reader for the CreateOrgScaleSet structure.
type CreateOrgScaleSetReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CreateOrgScaleSetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewCreateOrgScaleSetOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewCreateOrgScaleSetDefault(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
}
}
// NewCreateOrgScaleSetOK creates a CreateOrgScaleSetOK with default headers values
func NewCreateOrgScaleSetOK() *CreateOrgScaleSetOK {
return &CreateOrgScaleSetOK{}
}
/*
CreateOrgScaleSetOK describes a response with status code 200, with default header values.
ScaleSet
*/
type CreateOrgScaleSetOK struct {
Payload garm_params.ScaleSet
}
// IsSuccess returns true when this create org scale set o k response has a 2xx status code
func (o *CreateOrgScaleSetOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this create org scale set o k response has a 3xx status code
func (o *CreateOrgScaleSetOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this create org scale set o k response has a 4xx status code
func (o *CreateOrgScaleSetOK) IsClientError() bool {
return false
}
// IsServerError returns true when this create org scale set o k response has a 5xx status code
func (o *CreateOrgScaleSetOK) IsServerError() bool {
return false
}
// IsCode returns true when this create org scale set o k response a status code equal to that given
func (o *CreateOrgScaleSetOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the create org scale set o k response
func (o *CreateOrgScaleSetOK) Code() int {
return 200
}
func (o *CreateOrgScaleSetOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /organizations/{orgID}/scalesets][%d] createOrgScaleSetOK %s", 200, payload)
}
func (o *CreateOrgScaleSetOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /organizations/{orgID}/scalesets][%d] createOrgScaleSetOK %s", 200, payload)
}
func (o *CreateOrgScaleSetOK) GetPayload() garm_params.ScaleSet {
return o.Payload
}
func (o *CreateOrgScaleSetOK) 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
}
// NewCreateOrgScaleSetDefault creates a CreateOrgScaleSetDefault with default headers values
func NewCreateOrgScaleSetDefault(code int) *CreateOrgScaleSetDefault {
return &CreateOrgScaleSetDefault{
_statusCode: code,
}
}
/*
CreateOrgScaleSetDefault describes a response with status code -1, with default header values.
APIErrorResponse
*/
type CreateOrgScaleSetDefault struct {
_statusCode int
Payload apiserver_params.APIErrorResponse
}
// IsSuccess returns true when this create org scale set default response has a 2xx status code
func (o *CreateOrgScaleSetDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this create org scale set default response has a 3xx status code
func (o *CreateOrgScaleSetDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this create org scale set default response has a 4xx status code
func (o *CreateOrgScaleSetDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this create org scale set default response has a 5xx status code
func (o *CreateOrgScaleSetDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this create org scale set default response a status code equal to that given
func (o *CreateOrgScaleSetDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the create org scale set default response
func (o *CreateOrgScaleSetDefault) Code() int {
return o._statusCode
}
func (o *CreateOrgScaleSetDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /organizations/{orgID}/scalesets][%d] CreateOrgScaleSet default %s", o._statusCode, payload)
}
func (o *CreateOrgScaleSetDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /organizations/{orgID}/scalesets][%d] CreateOrgScaleSet default %s", o._statusCode, payload)
}
func (o *CreateOrgScaleSetDefault) GetPayload() apiserver_params.APIErrorResponse {
return o.Payload
}
func (o *CreateOrgScaleSetDefault) 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
}

View file

@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package organizations
// 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"
)
// NewListOrgScaleSetsParams creates a new ListOrgScaleSetsParams 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 NewListOrgScaleSetsParams() *ListOrgScaleSetsParams {
return &ListOrgScaleSetsParams{
timeout: cr.DefaultTimeout,
}
}
// NewListOrgScaleSetsParamsWithTimeout creates a new ListOrgScaleSetsParams object
// with the ability to set a timeout on a request.
func NewListOrgScaleSetsParamsWithTimeout(timeout time.Duration) *ListOrgScaleSetsParams {
return &ListOrgScaleSetsParams{
timeout: timeout,
}
}
// NewListOrgScaleSetsParamsWithContext creates a new ListOrgScaleSetsParams object
// with the ability to set a context for a request.
func NewListOrgScaleSetsParamsWithContext(ctx context.Context) *ListOrgScaleSetsParams {
return &ListOrgScaleSetsParams{
Context: ctx,
}
}
// NewListOrgScaleSetsParamsWithHTTPClient creates a new ListOrgScaleSetsParams object
// with the ability to set a custom HTTPClient for a request.
func NewListOrgScaleSetsParamsWithHTTPClient(client *http.Client) *ListOrgScaleSetsParams {
return &ListOrgScaleSetsParams{
HTTPClient: client,
}
}
/*
ListOrgScaleSetsParams contains all the parameters to send to the API endpoint
for the list org scale sets operation.
Typically these are written to a http.Request.
*/
type ListOrgScaleSetsParams struct {
/* OrgID.
Organization ID.
*/
OrgID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the list org scale sets params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListOrgScaleSetsParams) WithDefaults() *ListOrgScaleSetsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list org scale sets params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListOrgScaleSetsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the list org scale sets params
func (o *ListOrgScaleSetsParams) WithTimeout(timeout time.Duration) *ListOrgScaleSetsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list org scale sets params
func (o *ListOrgScaleSetsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list org scale sets params
func (o *ListOrgScaleSetsParams) WithContext(ctx context.Context) *ListOrgScaleSetsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list org scale sets params
func (o *ListOrgScaleSetsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list org scale sets params
func (o *ListOrgScaleSetsParams) WithHTTPClient(client *http.Client) *ListOrgScaleSetsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list org scale sets params
func (o *ListOrgScaleSetsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithOrgID adds the orgID to the list org scale sets params
func (o *ListOrgScaleSetsParams) WithOrgID(orgID string) *ListOrgScaleSetsParams {
o.SetOrgID(orgID)
return o
}
// SetOrgID adds the orgId to the list org scale sets params
func (o *ListOrgScaleSetsParams) SetOrgID(orgID string) {
o.OrgID = orgID
}
// WriteToRequest writes these params to a swagger request
func (o *ListOrgScaleSetsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param orgID
if err := r.SetPathParam("orgID", o.OrgID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View file

@ -0,0 +1,184 @@
// Code generated by go-swagger; DO NOT EDIT.
package organizations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
apiserver_params "github.com/cloudbase/garm/apiserver/params"
garm_params "github.com/cloudbase/garm/params"
)
// ListOrgScaleSetsReader is a Reader for the ListOrgScaleSets structure.
type ListOrgScaleSetsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListOrgScaleSetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewListOrgScaleSetsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewListOrgScaleSetsDefault(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
}
}
// NewListOrgScaleSetsOK creates a ListOrgScaleSetsOK with default headers values
func NewListOrgScaleSetsOK() *ListOrgScaleSetsOK {
return &ListOrgScaleSetsOK{}
}
/*
ListOrgScaleSetsOK describes a response with status code 200, with default header values.
ScaleSets
*/
type ListOrgScaleSetsOK struct {
Payload garm_params.ScaleSets
}
// IsSuccess returns true when this list org scale sets o k response has a 2xx status code
func (o *ListOrgScaleSetsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this list org scale sets o k response has a 3xx status code
func (o *ListOrgScaleSetsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this list org scale sets o k response has a 4xx status code
func (o *ListOrgScaleSetsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this list org scale sets o k response has a 5xx status code
func (o *ListOrgScaleSetsOK) IsServerError() bool {
return false
}
// IsCode returns true when this list org scale sets o k response a status code equal to that given
func (o *ListOrgScaleSetsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the list org scale sets o k response
func (o *ListOrgScaleSetsOK) Code() int {
return 200
}
func (o *ListOrgScaleSetsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /organizations/{orgID}/scalesets][%d] listOrgScaleSetsOK %s", 200, payload)
}
func (o *ListOrgScaleSetsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /organizations/{orgID}/scalesets][%d] listOrgScaleSetsOK %s", 200, payload)
}
func (o *ListOrgScaleSetsOK) GetPayload() garm_params.ScaleSets {
return o.Payload
}
func (o *ListOrgScaleSetsOK) 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
}
// NewListOrgScaleSetsDefault creates a ListOrgScaleSetsDefault with default headers values
func NewListOrgScaleSetsDefault(code int) *ListOrgScaleSetsDefault {
return &ListOrgScaleSetsDefault{
_statusCode: code,
}
}
/*
ListOrgScaleSetsDefault describes a response with status code -1, with default header values.
APIErrorResponse
*/
type ListOrgScaleSetsDefault struct {
_statusCode int
Payload apiserver_params.APIErrorResponse
}
// IsSuccess returns true when this list org scale sets default response has a 2xx status code
func (o *ListOrgScaleSetsDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this list org scale sets default response has a 3xx status code
func (o *ListOrgScaleSetsDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this list org scale sets default response has a 4xx status code
func (o *ListOrgScaleSetsDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this list org scale sets default response has a 5xx status code
func (o *ListOrgScaleSetsDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this list org scale sets default response a status code equal to that given
func (o *ListOrgScaleSetsDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the list org scale sets default response
func (o *ListOrgScaleSetsDefault) Code() int {
return o._statusCode
}
func (o *ListOrgScaleSetsDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /organizations/{orgID}/scalesets][%d] ListOrgScaleSets default %s", o._statusCode, payload)
}
func (o *ListOrgScaleSetsDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /organizations/{orgID}/scalesets][%d] ListOrgScaleSets default %s", o._statusCode, payload)
}
func (o *ListOrgScaleSetsDefault) GetPayload() apiserver_params.APIErrorResponse {
return o.Payload
}
func (o *ListOrgScaleSetsDefault) 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
}

View file

@ -58,6 +58,8 @@ type ClientService interface {
CreateOrgPool(params *CreateOrgPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrgPoolOK, error)
CreateOrgScaleSet(params *CreateOrgScaleSetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrgScaleSetOK, error)
DeleteOrg(params *DeleteOrgParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
DeleteOrgPool(params *DeleteOrgPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
@ -74,6 +76,8 @@ type ClientService interface {
ListOrgPools(params *ListOrgPoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgPoolsOK, error)
ListOrgScaleSets(params *ListOrgScaleSetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgScaleSetsOK, error)
ListOrgs(params *ListOrgsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgsOK, error)
UninstallOrgWebhook(params *UninstallOrgWebhookParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
@ -161,6 +165,44 @@ func (a *Client) CreateOrgPool(params *CreateOrgPoolParams, authInfo runtime.Cli
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
CreateOrgScaleSet creates organization scale set with the parameters given
*/
func (a *Client) CreateOrgScaleSet(params *CreateOrgScaleSetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateOrgScaleSetOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateOrgScaleSetParams()
}
op := &runtime.ClientOperation{
ID: "CreateOrgScaleSet",
Method: "POST",
PathPattern: "/organizations/{orgID}/scalesets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &CreateOrgScaleSetReader{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.(*CreateOrgScaleSetOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*CreateOrgScaleSetDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
DeleteOrg deletes organization by ID
*/
@ -455,6 +497,44 @@ func (a *Client) ListOrgPools(params *ListOrgPoolsParams, authInfo runtime.Clien
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListOrgScaleSets lists organization scale sets
*/
func (a *Client) ListOrgScaleSets(params *ListOrgScaleSetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgScaleSetsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListOrgScaleSetsParams()
}
op := &runtime.ClientOperation{
ID: "ListOrgScaleSets",
Method: "GET",
PathPattern: "/organizations/{orgID}/scalesets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &ListOrgScaleSetsReader{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.(*ListOrgScaleSetsOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*ListOrgScaleSetsDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListOrgs lists organizations
*/

View file

@ -0,0 +1,173 @@
// Code generated by go-swagger; DO NOT EDIT.
package repositories
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
garm_params "github.com/cloudbase/garm/params"
)
// NewCreateRepoScaleSetParams creates a new CreateRepoScaleSetParams 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 NewCreateRepoScaleSetParams() *CreateRepoScaleSetParams {
return &CreateRepoScaleSetParams{
timeout: cr.DefaultTimeout,
}
}
// NewCreateRepoScaleSetParamsWithTimeout creates a new CreateRepoScaleSetParams object
// with the ability to set a timeout on a request.
func NewCreateRepoScaleSetParamsWithTimeout(timeout time.Duration) *CreateRepoScaleSetParams {
return &CreateRepoScaleSetParams{
timeout: timeout,
}
}
// NewCreateRepoScaleSetParamsWithContext creates a new CreateRepoScaleSetParams object
// with the ability to set a context for a request.
func NewCreateRepoScaleSetParamsWithContext(ctx context.Context) *CreateRepoScaleSetParams {
return &CreateRepoScaleSetParams{
Context: ctx,
}
}
// NewCreateRepoScaleSetParamsWithHTTPClient creates a new CreateRepoScaleSetParams object
// with the ability to set a custom HTTPClient for a request.
func NewCreateRepoScaleSetParamsWithHTTPClient(client *http.Client) *CreateRepoScaleSetParams {
return &CreateRepoScaleSetParams{
HTTPClient: client,
}
}
/*
CreateRepoScaleSetParams contains all the parameters to send to the API endpoint
for the create repo scale set operation.
Typically these are written to a http.Request.
*/
type CreateRepoScaleSetParams struct {
/* Body.
Parameters used when creating the repository scale set.
*/
Body garm_params.CreateScaleSetParams
/* RepoID.
Repository ID.
*/
RepoID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the create repo scale set params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *CreateRepoScaleSetParams) WithDefaults() *CreateRepoScaleSetParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the create repo scale set params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *CreateRepoScaleSetParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the create repo scale set params
func (o *CreateRepoScaleSetParams) WithTimeout(timeout time.Duration) *CreateRepoScaleSetParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the create repo scale set params
func (o *CreateRepoScaleSetParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the create repo scale set params
func (o *CreateRepoScaleSetParams) WithContext(ctx context.Context) *CreateRepoScaleSetParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the create repo scale set params
func (o *CreateRepoScaleSetParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the create repo scale set params
func (o *CreateRepoScaleSetParams) WithHTTPClient(client *http.Client) *CreateRepoScaleSetParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the create repo scale set params
func (o *CreateRepoScaleSetParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the create repo scale set params
func (o *CreateRepoScaleSetParams) WithBody(body garm_params.CreateScaleSetParams) *CreateRepoScaleSetParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the create repo scale set params
func (o *CreateRepoScaleSetParams) SetBody(body garm_params.CreateScaleSetParams) {
o.Body = body
}
// WithRepoID adds the repoID to the create repo scale set params
func (o *CreateRepoScaleSetParams) WithRepoID(repoID string) *CreateRepoScaleSetParams {
o.SetRepoID(repoID)
return o
}
// SetRepoID adds the repoId to the create repo scale set params
func (o *CreateRepoScaleSetParams) SetRepoID(repoID string) {
o.RepoID = repoID
}
// WriteToRequest writes these params to a swagger request
func (o *CreateRepoScaleSetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param repoID
if err := r.SetPathParam("repoID", o.RepoID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View file

@ -0,0 +1,184 @@
// Code generated by go-swagger; DO NOT EDIT.
package repositories
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"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"
)
// CreateRepoScaleSetReader is a Reader for the CreateRepoScaleSet structure.
type CreateRepoScaleSetReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CreateRepoScaleSetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewCreateRepoScaleSetOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewCreateRepoScaleSetDefault(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
}
}
// NewCreateRepoScaleSetOK creates a CreateRepoScaleSetOK with default headers values
func NewCreateRepoScaleSetOK() *CreateRepoScaleSetOK {
return &CreateRepoScaleSetOK{}
}
/*
CreateRepoScaleSetOK describes a response with status code 200, with default header values.
ScaleSet
*/
type CreateRepoScaleSetOK struct {
Payload garm_params.ScaleSet
}
// IsSuccess returns true when this create repo scale set o k response has a 2xx status code
func (o *CreateRepoScaleSetOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this create repo scale set o k response has a 3xx status code
func (o *CreateRepoScaleSetOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this create repo scale set o k response has a 4xx status code
func (o *CreateRepoScaleSetOK) IsClientError() bool {
return false
}
// IsServerError returns true when this create repo scale set o k response has a 5xx status code
func (o *CreateRepoScaleSetOK) IsServerError() bool {
return false
}
// IsCode returns true when this create repo scale set o k response a status code equal to that given
func (o *CreateRepoScaleSetOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the create repo scale set o k response
func (o *CreateRepoScaleSetOK) Code() int {
return 200
}
func (o *CreateRepoScaleSetOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repositories/{repoID}/scalesets][%d] createRepoScaleSetOK %s", 200, payload)
}
func (o *CreateRepoScaleSetOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repositories/{repoID}/scalesets][%d] createRepoScaleSetOK %s", 200, payload)
}
func (o *CreateRepoScaleSetOK) GetPayload() garm_params.ScaleSet {
return o.Payload
}
func (o *CreateRepoScaleSetOK) 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
}
// NewCreateRepoScaleSetDefault creates a CreateRepoScaleSetDefault with default headers values
func NewCreateRepoScaleSetDefault(code int) *CreateRepoScaleSetDefault {
return &CreateRepoScaleSetDefault{
_statusCode: code,
}
}
/*
CreateRepoScaleSetDefault describes a response with status code -1, with default header values.
APIErrorResponse
*/
type CreateRepoScaleSetDefault struct {
_statusCode int
Payload apiserver_params.APIErrorResponse
}
// IsSuccess returns true when this create repo scale set default response has a 2xx status code
func (o *CreateRepoScaleSetDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this create repo scale set default response has a 3xx status code
func (o *CreateRepoScaleSetDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this create repo scale set default response has a 4xx status code
func (o *CreateRepoScaleSetDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this create repo scale set default response has a 5xx status code
func (o *CreateRepoScaleSetDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this create repo scale set default response a status code equal to that given
func (o *CreateRepoScaleSetDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the create repo scale set default response
func (o *CreateRepoScaleSetDefault) Code() int {
return o._statusCode
}
func (o *CreateRepoScaleSetDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repositories/{repoID}/scalesets][%d] CreateRepoScaleSet default %s", o._statusCode, payload)
}
func (o *CreateRepoScaleSetDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /repositories/{repoID}/scalesets][%d] CreateRepoScaleSet default %s", o._statusCode, payload)
}
func (o *CreateRepoScaleSetDefault) GetPayload() apiserver_params.APIErrorResponse {
return o.Payload
}
func (o *CreateRepoScaleSetDefault) 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
}

View file

@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
package repositories
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewListRepoScaleSetsParams creates a new ListRepoScaleSetsParams 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 NewListRepoScaleSetsParams() *ListRepoScaleSetsParams {
return &ListRepoScaleSetsParams{
timeout: cr.DefaultTimeout,
}
}
// NewListRepoScaleSetsParamsWithTimeout creates a new ListRepoScaleSetsParams object
// with the ability to set a timeout on a request.
func NewListRepoScaleSetsParamsWithTimeout(timeout time.Duration) *ListRepoScaleSetsParams {
return &ListRepoScaleSetsParams{
timeout: timeout,
}
}
// NewListRepoScaleSetsParamsWithContext creates a new ListRepoScaleSetsParams object
// with the ability to set a context for a request.
func NewListRepoScaleSetsParamsWithContext(ctx context.Context) *ListRepoScaleSetsParams {
return &ListRepoScaleSetsParams{
Context: ctx,
}
}
// NewListRepoScaleSetsParamsWithHTTPClient creates a new ListRepoScaleSetsParams object
// with the ability to set a custom HTTPClient for a request.
func NewListRepoScaleSetsParamsWithHTTPClient(client *http.Client) *ListRepoScaleSetsParams {
return &ListRepoScaleSetsParams{
HTTPClient: client,
}
}
/*
ListRepoScaleSetsParams contains all the parameters to send to the API endpoint
for the list repo scale sets operation.
Typically these are written to a http.Request.
*/
type ListRepoScaleSetsParams struct {
/* RepoID.
Repository ID.
*/
RepoID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the list repo scale sets params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListRepoScaleSetsParams) WithDefaults() *ListRepoScaleSetsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list repo scale sets params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListRepoScaleSetsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the list repo scale sets params
func (o *ListRepoScaleSetsParams) WithTimeout(timeout time.Duration) *ListRepoScaleSetsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list repo scale sets params
func (o *ListRepoScaleSetsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list repo scale sets params
func (o *ListRepoScaleSetsParams) WithContext(ctx context.Context) *ListRepoScaleSetsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list repo scale sets params
func (o *ListRepoScaleSetsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list repo scale sets params
func (o *ListRepoScaleSetsParams) WithHTTPClient(client *http.Client) *ListRepoScaleSetsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list repo scale sets params
func (o *ListRepoScaleSetsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithRepoID adds the repoID to the list repo scale sets params
func (o *ListRepoScaleSetsParams) WithRepoID(repoID string) *ListRepoScaleSetsParams {
o.SetRepoID(repoID)
return o
}
// SetRepoID adds the repoId to the list repo scale sets params
func (o *ListRepoScaleSetsParams) SetRepoID(repoID string) {
o.RepoID = repoID
}
// WriteToRequest writes these params to a swagger request
func (o *ListRepoScaleSetsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param repoID
if err := r.SetPathParam("repoID", o.RepoID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View file

@ -0,0 +1,184 @@
// Code generated by go-swagger; DO NOT EDIT.
package repositories
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"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"
)
// ListRepoScaleSetsReader is a Reader for the ListRepoScaleSets structure.
type ListRepoScaleSetsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListRepoScaleSetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewListRepoScaleSetsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewListRepoScaleSetsDefault(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
}
}
// NewListRepoScaleSetsOK creates a ListRepoScaleSetsOK with default headers values
func NewListRepoScaleSetsOK() *ListRepoScaleSetsOK {
return &ListRepoScaleSetsOK{}
}
/*
ListRepoScaleSetsOK describes a response with status code 200, with default header values.
ScaleSets
*/
type ListRepoScaleSetsOK struct {
Payload garm_params.ScaleSets
}
// IsSuccess returns true when this list repo scale sets o k response has a 2xx status code
func (o *ListRepoScaleSetsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this list repo scale sets o k response has a 3xx status code
func (o *ListRepoScaleSetsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this list repo scale sets o k response has a 4xx status code
func (o *ListRepoScaleSetsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this list repo scale sets o k response has a 5xx status code
func (o *ListRepoScaleSetsOK) IsServerError() bool {
return false
}
// IsCode returns true when this list repo scale sets o k response a status code equal to that given
func (o *ListRepoScaleSetsOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the list repo scale sets o k response
func (o *ListRepoScaleSetsOK) Code() int {
return 200
}
func (o *ListRepoScaleSetsOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /repositories/{repoID}/scalesets][%d] listRepoScaleSetsOK %s", 200, payload)
}
func (o *ListRepoScaleSetsOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /repositories/{repoID}/scalesets][%d] listRepoScaleSetsOK %s", 200, payload)
}
func (o *ListRepoScaleSetsOK) GetPayload() garm_params.ScaleSets {
return o.Payload
}
func (o *ListRepoScaleSetsOK) 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
}
// NewListRepoScaleSetsDefault creates a ListRepoScaleSetsDefault with default headers values
func NewListRepoScaleSetsDefault(code int) *ListRepoScaleSetsDefault {
return &ListRepoScaleSetsDefault{
_statusCode: code,
}
}
/*
ListRepoScaleSetsDefault describes a response with status code -1, with default header values.
APIErrorResponse
*/
type ListRepoScaleSetsDefault struct {
_statusCode int
Payload apiserver_params.APIErrorResponse
}
// IsSuccess returns true when this list repo scale sets default response has a 2xx status code
func (o *ListRepoScaleSetsDefault) IsSuccess() bool {
return o._statusCode/100 == 2
}
// IsRedirect returns true when this list repo scale sets default response has a 3xx status code
func (o *ListRepoScaleSetsDefault) IsRedirect() bool {
return o._statusCode/100 == 3
}
// IsClientError returns true when this list repo scale sets default response has a 4xx status code
func (o *ListRepoScaleSetsDefault) IsClientError() bool {
return o._statusCode/100 == 4
}
// IsServerError returns true when this list repo scale sets default response has a 5xx status code
func (o *ListRepoScaleSetsDefault) IsServerError() bool {
return o._statusCode/100 == 5
}
// IsCode returns true when this list repo scale sets default response a status code equal to that given
func (o *ListRepoScaleSetsDefault) IsCode(code int) bool {
return o._statusCode == code
}
// Code gets the status code for the list repo scale sets default response
func (o *ListRepoScaleSetsDefault) Code() int {
return o._statusCode
}
func (o *ListRepoScaleSetsDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /repositories/{repoID}/scalesets][%d] ListRepoScaleSets default %s", o._statusCode, payload)
}
func (o *ListRepoScaleSetsDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /repositories/{repoID}/scalesets][%d] ListRepoScaleSets default %s", o._statusCode, payload)
}
func (o *ListRepoScaleSetsDefault) GetPayload() apiserver_params.APIErrorResponse {
return o.Payload
}
func (o *ListRepoScaleSetsDefault) 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
}

View file

@ -58,6 +58,8 @@ type ClientService interface {
CreateRepoPool(params *CreateRepoPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateRepoPoolOK, error)
CreateRepoScaleSet(params *CreateRepoScaleSetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateRepoScaleSetOK, error)
DeleteRepo(params *DeleteRepoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
DeleteRepoPool(params *DeleteRepoPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
@ -74,6 +76,8 @@ type ClientService interface {
ListRepoPools(params *ListRepoPoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListRepoPoolsOK, error)
ListRepoScaleSets(params *ListRepoScaleSetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListRepoScaleSetsOK, error)
ListRepos(params *ListReposParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListReposOK, error)
UninstallRepoWebhook(params *UninstallRepoWebhookParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
@ -161,6 +165,44 @@ func (a *Client) CreateRepoPool(params *CreateRepoPoolParams, authInfo runtime.C
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
CreateRepoScaleSet creates repository scale set with the parameters given
*/
func (a *Client) CreateRepoScaleSet(params *CreateRepoScaleSetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateRepoScaleSetOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateRepoScaleSetParams()
}
op := &runtime.ClientOperation{
ID: "CreateRepoScaleSet",
Method: "POST",
PathPattern: "/repositories/{repoID}/scalesets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &CreateRepoScaleSetReader{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.(*CreateRepoScaleSetOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*CreateRepoScaleSetDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
DeleteRepo deletes repository by ID
*/
@ -455,6 +497,44 @@ func (a *Client) ListRepoPools(params *ListRepoPoolsParams, authInfo runtime.Cli
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListRepoScaleSets lists repository scale sets
*/
func (a *Client) ListRepoScaleSets(params *ListRepoScaleSetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListRepoScaleSetsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListRepoScaleSetsParams()
}
op := &runtime.ClientOperation{
ID: "ListRepoScaleSets",
Method: "GET",
PathPattern: "/repositories/{repoID}/scalesets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &ListRepoScaleSetsReader{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.(*ListRepoScaleSetsOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*ListRepoScaleSetsDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListRepos lists repositories
*/

View file

@ -0,0 +1,518 @@
// Copyright 2022 Cloudbase Solutions SRL
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package cmd
import (
"fmt"
"os"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/spf13/cobra"
commonParams "github.com/cloudbase/garm-provider-common/params"
apiClientEnterprises "github.com/cloudbase/garm/client/enterprises"
apiClientOrgs "github.com/cloudbase/garm/client/organizations"
apiClientRepos "github.com/cloudbase/garm/client/repositories"
apiClientScaleSets "github.com/cloudbase/garm/client/scalesets"
"github.com/cloudbase/garm/cmd/garm-cli/common"
"github.com/cloudbase/garm/params"
)
var (
scalesetProvider string
scalesetMaxRunners uint
scalesetMinIdleRunners uint
scalesetRunnerPrefix string
scalesetName string
scalesetImage string
scalesetFlavor string
scalesetOSType string
scalesetOSArch string
scalesetEnabled bool
scalesetRunnerBootstrapTimeout uint
scalesetRepository string
scalesetOrganization string
scalesetEnterprise string
scalesetExtraSpecsFile string
scalesetExtraSpecs string
scalesetAll bool
scalesetGitHubRunnerGroup string
)
type scalesetPayloadGetter interface {
GetPayload() params.ScaleSet
}
type scalesetsPayloadGetter interface {
GetPayload() params.ScaleSets
}
// scalesetCmd represents the scale set command
var scalesetCmd = &cobra.Command{
Use: "scaleset",
SilenceUsage: true,
Short: "List scale sets",
Long: `Query information or perform operations on scale sets.`,
Run: nil,
}
var scalesetListCmd = &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Short: "List scale sets",
Long: `List scale sets of repositories, orgs or all of the above.
This command will list scale sets from one repo, one org or all scale sets
on the system. The list flags are mutually exclusive. You must however
specify one of them.
Example:
List scalesets from one repo:
garm-cli scaleset list --repo=05e7eac6-4705-486d-89c9-0170bbb576af
List scalesets from one org:
garm-cli scaleset list --org=5493e51f-3170-4ce3-9f05-3fe690fc6ec6
List scalesets from one enterprise:
garm-cli scaleset list --enterprise=a8ee4c66-e762-4cbe-a35d-175dba2c9e62
List all scalesets from all repos, orgs and enterprises:
garm-cli scaleset list --all
`,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
if needsInit {
return errNeedsInitError
}
var response scalesetsPayloadGetter
var err error
switch len(args) {
case 0:
if cmd.Flags().Changed("repo") {
listRepoScaleSetsReq := apiClientRepos.NewListRepoScaleSetsParams()
listRepoScaleSetsReq.RepoID = scalesetRepository
response, err = apiCli.Repositories.ListRepoScaleSets(listRepoScaleSetsReq, authToken)
} else if cmd.Flags().Changed("org") {
listOrgScaleSetsReq := apiClientOrgs.NewListOrgScaleSetsParams()
listOrgScaleSetsReq.OrgID = scalesetOrganization
response, err = apiCli.Organizations.ListOrgScaleSets(listOrgScaleSetsReq, authToken)
} else if cmd.Flags().Changed("enterprise") {
listEnterpriseScaleSetsReq := apiClientEnterprises.NewListEnterpriseScaleSetsParams()
listEnterpriseScaleSetsReq.EnterpriseID = scalesetEnterprise
response, err = apiCli.Enterprises.ListEnterpriseScaleSets(listEnterpriseScaleSetsReq, authToken)
} else if cmd.Flags().Changed("all") {
listScaleSetsReq := apiClientScaleSets.NewListScalesetsParams()
response, err = apiCli.Scalesets.ListScalesets(listScaleSetsReq, authToken)
} else {
cmd.Help() //nolint
os.Exit(0)
}
default:
cmd.Help() //nolint
os.Exit(0)
}
if err != nil {
return err
}
formatScaleSets(response.GetPayload())
return nil
},
}
var scaleSetShowCmd = &cobra.Command{
Use: "show",
Short: "Show details for a scale set",
Long: `Displays a detailed view of a single scale set.`,
SilenceUsage: true,
RunE: func(_ *cobra.Command, args []string) error {
if needsInit {
return errNeedsInitError
}
if len(args) == 0 {
return fmt.Errorf("requires a scale set ID")
}
if len(args) > 1 {
return fmt.Errorf("too many arguments")
}
getScaleSetReq := apiClientScaleSets.NewGetScaleSetParams()
getScaleSetReq.ScalesetID = args[0]
response, err := apiCli.Scalesets.GetScaleSet(getScaleSetReq, authToken)
if err != nil {
return err
}
formatOneScaleSet(response.Payload)
return nil
},
}
var scaleSetDeleteCmd = &cobra.Command{
Use: "delete",
Aliases: []string{"remove", "rm", "del"},
Short: "Delete scale set by ID",
Long: `Delete one scale set by referencing it's ID, regardless of repo or org.`,
SilenceUsage: true,
RunE: func(_ *cobra.Command, args []string) error {
if needsInit {
return errNeedsInitError
}
if len(args) == 0 {
return fmt.Errorf("requires a scale set ID")
}
if len(args) > 1 {
return fmt.Errorf("too many arguments")
}
deleteScaleSetReq := apiClientScaleSets.NewDeleteScaleSetParams()
deleteScaleSetReq.ScalesetID = args[0]
if err := apiCli.Scalesets.DeleteScaleSet(deleteScaleSetReq, authToken); err != nil {
return err
}
return nil
},
}
var scaleSetAddCmd = &cobra.Command{
Use: "add",
Aliases: []string{"create"},
Short: "Add scale set",
Long: `Add a new scale set.`,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, _ []string) error {
if needsInit {
return errNeedsInitError
}
newScaleSetParams := params.CreateScaleSetParams{
RunnerPrefix: params.RunnerPrefix{
Prefix: scalesetRunnerPrefix,
},
ProviderName: scalesetProvider,
Name: scalesetName,
MaxRunners: scalesetMaxRunners,
MinIdleRunners: scalesetMinIdleRunners,
Image: scalesetImage,
Flavor: scalesetFlavor,
OSType: commonParams.OSType(scalesetOSType),
OSArch: commonParams.OSArch(scalesetOSArch),
Enabled: scalesetEnabled,
RunnerBootstrapTimeout: scalesetRunnerBootstrapTimeout,
GitHubRunnerGroup: scalesetGitHubRunnerGroup,
}
if cmd.Flags().Changed("extra-specs") {
data, err := asRawMessage([]byte(scalesetExtraSpecs))
if err != nil {
return err
}
newScaleSetParams.ExtraSpecs = data
}
if scalesetExtraSpecsFile != "" {
data, err := extraSpecsFromFile(scalesetExtraSpecsFile)
if err != nil {
return err
}
newScaleSetParams.ExtraSpecs = data
}
if err := newScaleSetParams.Validate(); err != nil {
return err
}
var err error
var response scalesetPayloadGetter
if cmd.Flags().Changed("repo") {
newRepoScaleSetReq := apiClientRepos.NewCreateRepoScaleSetParams()
newRepoScaleSetReq.RepoID = scalesetRepository
newRepoScaleSetReq.Body = newScaleSetParams
response, err = apiCli.Repositories.CreateRepoScaleSet(newRepoScaleSetReq, authToken)
} else if cmd.Flags().Changed("org") {
newOrgScaleSetReq := apiClientOrgs.NewCreateOrgScaleSetParams()
newOrgScaleSetReq.OrgID = scalesetOrganization
newOrgScaleSetReq.Body = newScaleSetParams
response, err = apiCli.Organizations.CreateOrgScaleSet(newOrgScaleSetReq, authToken)
} else if cmd.Flags().Changed("enterprise") {
newEnterpriseScaleSetReq := apiClientEnterprises.NewCreateEnterpriseScaleSetParams()
newEnterpriseScaleSetReq.EnterpriseID = scalesetEnterprise
newEnterpriseScaleSetReq.Body = newScaleSetParams
response, err = apiCli.Enterprises.CreateEnterpriseScaleSet(newEnterpriseScaleSetReq, authToken)
} else {
cmd.Help() //nolint
os.Exit(0)
}
if err != nil {
return err
}
formatOneScaleSet(response.GetPayload())
return nil
},
}
var scaleSetUpdateCmd = &cobra.Command{
Use: "update",
Short: "Update one scale set",
Long: `Updates scale set characteristics.
This command updates the scale set characteristics. Runners already created prior to updating
the scale set, will not be recreated. If they no longer suit your needs, you will need to
explicitly remove them using the runner delete command.
`,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
if needsInit {
return errNeedsInitError
}
if len(args) == 0 {
return fmt.Errorf("command requires a scale set ID")
}
if len(args) > 1 {
return fmt.Errorf("too many arguments")
}
updateScaleSetReq := apiClientScaleSets.NewUpdateScaleSetParams()
scaleSetUpdateParams := params.UpdateScaleSetParams{}
if cmd.Flags().Changed("image") {
scaleSetUpdateParams.Image = scalesetImage
}
if cmd.Flags().Changed("name") {
scaleSetUpdateParams.Name = scalesetName
}
if cmd.Flags().Changed("flavor") {
scaleSetUpdateParams.Flavor = scalesetFlavor
}
if cmd.Flags().Changed("os-type") {
scaleSetUpdateParams.OSType = commonParams.OSType(scalesetOSType)
}
if cmd.Flags().Changed("os-arch") {
scaleSetUpdateParams.OSArch = commonParams.OSArch(scalesetOSArch)
}
if cmd.Flags().Changed("max-runners") {
scaleSetUpdateParams.MaxRunners = &scalesetMaxRunners
}
if cmd.Flags().Changed("min-idle-runners") {
scaleSetUpdateParams.MinIdleRunners = &scalesetMinIdleRunners
}
if cmd.Flags().Changed("runner-prefix") {
scaleSetUpdateParams.RunnerPrefix = params.RunnerPrefix{
Prefix: scalesetRunnerPrefix,
}
}
if cmd.Flags().Changed("runner-group") {
scaleSetUpdateParams.GitHubRunnerGroup = &scalesetGitHubRunnerGroup
}
if cmd.Flags().Changed("enabled") {
scaleSetUpdateParams.Enabled = &scalesetEnabled
}
if cmd.Flags().Changed("runner-bootstrap-timeout") {
scaleSetUpdateParams.RunnerBootstrapTimeout = &scalesetRunnerBootstrapTimeout
}
if cmd.Flags().Changed("extra-specs") {
data, err := asRawMessage([]byte(scalesetExtraSpecs))
if err != nil {
return err
}
scaleSetUpdateParams.ExtraSpecs = data
}
if scalesetExtraSpecsFile != "" {
data, err := extraSpecsFromFile(scalesetExtraSpecsFile)
if err != nil {
return err
}
scaleSetUpdateParams.ExtraSpecs = data
}
updateScaleSetReq.ScalesetID = args[0]
updateScaleSetReq.Body = scaleSetUpdateParams
response, err := apiCli.Scalesets.UpdateScaleSet(updateScaleSetReq, authToken)
if err != nil {
return err
}
formatOneScaleSet(response.Payload)
return nil
},
}
func init() {
scalesetListCmd.Flags().StringVarP(&scalesetRepository, "repo", "r", "", "List all scale sets within this repository.")
scalesetListCmd.Flags().StringVarP(&scalesetOrganization, "org", "o", "", "List all scale sets within this organization.")
scalesetListCmd.Flags().StringVarP(&scalesetEnterprise, "enterprise", "e", "", "List all scale sets within this enterprise.")
scalesetListCmd.Flags().BoolVarP(&scalesetAll, "all", "a", false, "List all scale sets, regardless of org or repo.")
scalesetListCmd.MarkFlagsMutuallyExclusive("repo", "org", "all", "enterprise")
scaleSetUpdateCmd.Flags().StringVar(&scalesetImage, "image", "", "The provider-specific image name to use for runners in this scale set.")
scaleSetUpdateCmd.Flags().StringVar(&scalesetFlavor, "flavor", "", "The flavor to use for the runners in this scale set.")
scaleSetUpdateCmd.Flags().StringVar(&scalesetName, "name", "", "The name of the scale set. This option is mandatory.")
scaleSetUpdateCmd.Flags().StringVar(&scalesetOSType, "os-type", "linux", "Operating system type (windows, linux, etc).")
scaleSetUpdateCmd.Flags().StringVar(&scalesetOSArch, "os-arch", "amd64", "Operating system architecture (amd64, arm, etc).")
scaleSetUpdateCmd.Flags().StringVar(&scalesetRunnerPrefix, "runner-prefix", "", "The name prefix to use for runners in this scale set.")
scaleSetUpdateCmd.Flags().UintVar(&scalesetMaxRunners, "max-runners", 5, "The maximum number of runner this scale set will create.")
scaleSetUpdateCmd.Flags().UintVar(&scalesetMinIdleRunners, "min-idle-runners", 1, "Attempt to maintain a minimum of idle self-hosted runners of this type.")
scaleSetUpdateCmd.Flags().StringVar(&scalesetGitHubRunnerGroup, "runner-group", "", "The GitHub runner group in which all runners of this scale set will be added.")
scaleSetUpdateCmd.Flags().BoolVar(&scalesetEnabled, "enabled", false, "Enable this scale set.")
scaleSetUpdateCmd.Flags().UintVar(&scalesetRunnerBootstrapTimeout, "runner-bootstrap-timeout", 20, "Duration in minutes after which a runner is considered failed if it does not join Github.")
scaleSetUpdateCmd.Flags().StringVar(&scalesetExtraSpecsFile, "extra-specs-file", "", "A file containing a valid json which will be passed to the IaaS provider managing the scale set.")
scaleSetUpdateCmd.Flags().StringVar(&scalesetExtraSpecs, "extra-specs", "", "A valid json which will be passed to the IaaS provider managing the scale set.")
scaleSetUpdateCmd.MarkFlagsMutuallyExclusive("extra-specs-file", "extra-specs")
scaleSetAddCmd.Flags().StringVar(&scalesetProvider, "provider-name", "", "The name of the provider where runners will be created.")
scaleSetAddCmd.Flags().StringVar(&scalesetImage, "image", "", "The provider-specific image name to use for runners in this scale set.")
scaleSetAddCmd.Flags().StringVar(&scalesetName, "name", "", "The name of the scale set. This option is mandatory.")
scaleSetAddCmd.Flags().StringVar(&scalesetFlavor, "flavor", "", "The flavor to use for this runner.")
scaleSetAddCmd.Flags().StringVar(&scalesetRunnerPrefix, "runner-prefix", "", "The name prefix to use for runners in this scale set.")
scaleSetAddCmd.Flags().StringVar(&scalesetOSType, "os-type", "linux", "Operating system type (windows, linux, etc).")
scaleSetAddCmd.Flags().StringVar(&scalesetOSArch, "os-arch", "amd64", "Operating system architecture (amd64, arm, etc).")
scaleSetAddCmd.Flags().StringVar(&scalesetExtraSpecsFile, "extra-specs-file", "", "A file containing a valid json which will be passed to the IaaS provider managing the scale set.")
scaleSetAddCmd.Flags().StringVar(&scalesetExtraSpecs, "extra-specs", "", "A valid json which will be passed to the IaaS provider managing the scale set.")
scaleSetAddCmd.Flags().StringVar(&scalesetGitHubRunnerGroup, "runner-group", "", "The GitHub runner group in which all runners of this scale set will be added.")
scaleSetAddCmd.Flags().UintVar(&scalesetMaxRunners, "max-runners", 5, "The maximum number of runner this scale set will create.")
scaleSetAddCmd.Flags().UintVar(&scalesetRunnerBootstrapTimeout, "runner-bootstrap-timeout", 20, "Duration in minutes after which a runner is considered failed if it does not join Github.")
scaleSetAddCmd.Flags().UintVar(&scalesetMinIdleRunners, "min-idle-runners", 1, "Attempt to maintain a minimum of idle self-hosted runners of this type.")
scaleSetAddCmd.Flags().BoolVar(&scalesetEnabled, "enabled", false, "Enable this scale set.")
scaleSetAddCmd.MarkFlagRequired("provider-name") //nolint
scaleSetAddCmd.MarkFlagRequired("name") //nolint
scaleSetAddCmd.MarkFlagRequired("image") //nolint
scaleSetAddCmd.MarkFlagRequired("flavor") //nolint
scaleSetAddCmd.Flags().StringVarP(&scalesetRepository, "repo", "r", "", "Add the new scale set within this repository.")
scaleSetAddCmd.Flags().StringVarP(&scalesetOrganization, "org", "o", "", "Add the new scale set within this organization.")
scaleSetAddCmd.Flags().StringVarP(&scalesetEnterprise, "enterprise", "e", "", "Add the new scale set within this enterprise.")
scaleSetAddCmd.MarkFlagsMutuallyExclusive("repo", "org", "enterprise")
scaleSetAddCmd.MarkFlagsMutuallyExclusive("extra-specs-file", "extra-specs")
scalesetCmd.AddCommand(
scalesetListCmd,
scaleSetShowCmd,
scaleSetDeleteCmd,
scaleSetUpdateCmd,
scaleSetAddCmd,
)
rootCmd.AddCommand(scalesetCmd)
}
func formatScaleSets(scaleSets []params.ScaleSet) {
if outputFormat == common.OutputFormatJSON {
printAsJSON(scaleSets)
return
}
t := table.NewWriter()
header := table.Row{"ID", "Scale Set Name", "Image", "Flavor", "Belongs to", "Level", "Enabled", "Runner Prefix", "Provider"}
t.AppendHeader(header)
for _, scaleSet := range scaleSets {
var belongsTo string
var level string
switch {
case scaleSet.RepoID != "" && scaleSet.RepoName != "":
belongsTo = scaleSet.RepoName
level = "repo"
case scaleSet.OrgID != "" && scaleSet.OrgName != "":
belongsTo = scaleSet.OrgName
level = "org"
case scaleSet.EnterpriseID != "" && scaleSet.EnterpriseName != "":
belongsTo = scaleSet.EnterpriseName
level = "enterprise"
}
t.AppendRow(table.Row{scaleSet.ID, scaleSet.Name, scaleSet.Image, scaleSet.Flavor, belongsTo, level, scaleSet.Enabled, scaleSet.GetRunnerPrefix(), scaleSet.ProviderName})
t.AppendSeparator()
}
fmt.Println(t.Render())
}
func formatOneScaleSet(scaleSet params.ScaleSet) {
if outputFormat == common.OutputFormatJSON {
printAsJSON(scaleSet)
return
}
t := table.NewWriter()
rowConfigAutoMerge := table.RowConfig{AutoMerge: true}
header := table.Row{"Field", "Value"}
var belongsTo string
var level string
switch {
case scaleSet.RepoID != "" && scaleSet.RepoName != "":
belongsTo = scaleSet.RepoName
level = "repo"
case scaleSet.OrgID != "" && scaleSet.OrgName != "":
belongsTo = scaleSet.OrgName
level = "org"
case scaleSet.EnterpriseID != "" && scaleSet.EnterpriseName != "":
belongsTo = scaleSet.EnterpriseName
level = "enterprise"
}
t.AppendHeader(header)
t.AppendRow(table.Row{"ID", scaleSet.ID})
t.AppendRow(table.Row{"Scale Set ID", scaleSet.ScaleSetID})
t.AppendRow(table.Row{"Scale Name", scaleSet.Name})
t.AppendRow(table.Row{"Provider Name", scaleSet.ProviderName})
t.AppendRow(table.Row{"Image", scaleSet.Image})
t.AppendRow(table.Row{"Flavor", scaleSet.Flavor})
t.AppendRow(table.Row{"OS Type", scaleSet.OSType})
t.AppendRow(table.Row{"OS Architecture", scaleSet.OSArch})
t.AppendRow(table.Row{"Max Runners", scaleSet.MaxRunners})
t.AppendRow(table.Row{"Min Idle Runners", scaleSet.MinIdleRunners})
t.AppendRow(table.Row{"Runner Bootstrap Timeout", scaleSet.RunnerBootstrapTimeout})
t.AppendRow(table.Row{"Belongs to", belongsTo})
t.AppendRow(table.Row{"Level", level})
t.AppendRow(table.Row{"Enabled", scaleSet.Enabled})
t.AppendRow(table.Row{"Runner Prefix", scaleSet.GetRunnerPrefix()})
t.AppendRow(table.Row{"Extra specs", string(scaleSet.ExtraSpecs)})
t.AppendRow(table.Row{"GitHub Runner Group", scaleSet.GitHubRunnerGroup})
if len(scaleSet.Instances) > 0 {
for _, instance := range scaleSet.Instances {
t.AppendRow(table.Row{"Instances", fmt.Sprintf("%s (%s)", instance.Name, instance.ID)}, rowConfigAutoMerge)
}
}
t.SetColumnConfigs([]table.ColumnConfig{
{Number: 1, AutoMerge: true},
{Number: 2, AutoMerge: false, WidthMax: 100},
})
fmt.Println(t.Render())
}

View file

@ -96,7 +96,7 @@ func (s *sqlDatabase) GetEnterprise(ctx context.Context, name, endpointName stri
}
func (s *sqlDatabase) GetEnterpriseByID(ctx context.Context, enterpriseID string) (params.Enterprise, error) {
enterprise, err := s.getEnterpriseByID(ctx, s.conn, enterpriseID, "Pools", "Credentials", "Endpoint")
enterprise, err := s.getEnterpriseByID(ctx, s.conn, enterpriseID, "Pools", "Credentials", "Endpoint", "Credentials.Endpoint")
if err != nil {
return params.Enterprise{}, errors.Wrap(err, "fetching enterprise")
}

View file

@ -216,7 +216,7 @@ func (s *sqlDatabase) UpdateOrganization(ctx context.Context, orgID string, para
}
func (s *sqlDatabase) GetOrganizationByID(ctx context.Context, orgID string) (params.Organization, error) {
org, err := s.getOrgByID(ctx, s.conn, orgID, "Pools", "Credentials", "Endpoint")
org, err := s.getOrgByID(ctx, s.conn, orgID, "Pools", "Credentials", "Endpoint", "Credentials.Endpoint")
if err != nil {
return params.Organization{}, errors.Wrap(err, "fetching org")
}

View file

@ -216,7 +216,7 @@ func (s *sqlDatabase) UpdateRepository(ctx context.Context, repoID string, param
}
func (s *sqlDatabase) GetRepositoryByID(ctx context.Context, repoID string) (params.Repository, error) {
repo, err := s.getRepoByID(ctx, s.conn, repoID, "Pools", "Credentials", "Endpoint")
repo, err := s.getRepoByID(ctx, s.conn, repoID, "Pools", "Credentials", "Endpoint", "Credentials.Endpoint")
if err != nil {
return params.Repository{}, errors.Wrap(err, "fetching repo")
}

View file

@ -164,11 +164,6 @@ func (r *Runner) UpdateScaleSetByID(ctx context.Context, scaleSetID uint, param
hasUpdates = true
}
if old.Enabled != new.Enabled {
updateParams.Enabled = &new.Enabled
hasUpdates = true
}
if old.GitHubRunnerGroup != new.GitHubRunnerGroup {
runnerGroup, err := scalesetCli.GetRunnerGroupByName(ctx, new.GitHubRunnerGroup)
if err != nil {

View file

@ -452,6 +452,11 @@ func Client(ctx context.Context, entity params.GithubEntity) (common.GithubClien
return nil, errors.Wrap(err, "fetching http client")
}
slog.InfoContext(
ctx, "creating client with",
"entity", entity.String(), "base_url", entity.Credentials.APIBaseURL,
"upload_url", entity.Credentials.UploadBaseURL)
ghClient, err := github.NewClient(httpClient).WithEnterpriseURLs(
entity.Credentials.APIBaseURL, entity.Credentials.UploadBaseURL)
if err != nil {