Add CLI webhook enablement
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
7ce3f007b0
commit
dbd41f518d
19 changed files with 1507 additions and 8 deletions
|
|
@ -499,7 +499,7 @@ func (a *APIController) UpdateOrgPoolHandler(w http.ResponseWriter, r *http.Requ
|
|||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: {}
|
||||
// 200:
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) InstallOrgWebhookHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@ func (a *APIController) UpdateRepoPoolHandler(w http.ResponseWriter, r *http.Req
|
|||
// required: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: {}
|
||||
// 200:
|
||||
// default: APIErrorResponse
|
||||
func (a *APIController) InstallRepoWebhookHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@ func NewAPIRouter(han *controllers.APIController, logWriter io.Writer, authMiddl
|
|||
webhookRouter := router.PathPrefix("/webhooks").Subrouter()
|
||||
webhookRouter.Handle("/", http.HandlerFunc(han.WebhookHandler))
|
||||
webhookRouter.Handle("", http.HandlerFunc(han.WebhookHandler))
|
||||
webhookRouter.Handle("/{controllerID:controllerID\\/?}", http.HandlerFunc(han.WebhookHandler))
|
||||
webhookRouter.Handle("/{controllerID}/", http.HandlerFunc(han.WebhookHandler))
|
||||
webhookRouter.Handle("/{controllerID}", http.HandlerFunc(han.WebhookHandler))
|
||||
|
||||
// Handles API calls
|
||||
apiSubRouter := router.PathPrefix("/api/v1").Subrouter()
|
||||
|
|
|
|||
|
|
@ -946,7 +946,7 @@ paths:
|
|||
type: object
|
||||
responses:
|
||||
"200":
|
||||
$ref: '#/responses/%7B%7D'
|
||||
description: ""
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
|
|
@ -1368,7 +1368,7 @@ paths:
|
|||
type: object
|
||||
responses:
|
||||
"200":
|
||||
$ref: '#/responses/%7B%7D'
|
||||
description: ""
|
||||
default:
|
||||
description: APIErrorResponse
|
||||
schema:
|
||||
|
|
|
|||
173
client/organizations/install_org_webhook_parameters.go
Normal file
173
client/organizations/install_org_webhook_parameters.go
Normal 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"
|
||||
)
|
||||
|
||||
// NewInstallOrgWebhookParams creates a new InstallOrgWebhookParams 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 NewInstallOrgWebhookParams() *InstallOrgWebhookParams {
|
||||
return &InstallOrgWebhookParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewInstallOrgWebhookParamsWithTimeout creates a new InstallOrgWebhookParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewInstallOrgWebhookParamsWithTimeout(timeout time.Duration) *InstallOrgWebhookParams {
|
||||
return &InstallOrgWebhookParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewInstallOrgWebhookParamsWithContext creates a new InstallOrgWebhookParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewInstallOrgWebhookParamsWithContext(ctx context.Context) *InstallOrgWebhookParams {
|
||||
return &InstallOrgWebhookParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewInstallOrgWebhookParamsWithHTTPClient creates a new InstallOrgWebhookParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewInstallOrgWebhookParamsWithHTTPClient(client *http.Client) *InstallOrgWebhookParams {
|
||||
return &InstallOrgWebhookParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
InstallOrgWebhookParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the install org webhook operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type InstallOrgWebhookParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when creating the organization webhook.
|
||||
*/
|
||||
Body garm_params.InstallWebhookParams
|
||||
|
||||
/* OrgID.
|
||||
|
||||
Organization ID.
|
||||
*/
|
||||
OrgID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the install org webhook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *InstallOrgWebhookParams) WithDefaults() *InstallOrgWebhookParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the install org webhook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *InstallOrgWebhookParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the install org webhook params
|
||||
func (o *InstallOrgWebhookParams) WithTimeout(timeout time.Duration) *InstallOrgWebhookParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the install org webhook params
|
||||
func (o *InstallOrgWebhookParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the install org webhook params
|
||||
func (o *InstallOrgWebhookParams) WithContext(ctx context.Context) *InstallOrgWebhookParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the install org webhook params
|
||||
func (o *InstallOrgWebhookParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the install org webhook params
|
||||
func (o *InstallOrgWebhookParams) WithHTTPClient(client *http.Client) *InstallOrgWebhookParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the install org webhook params
|
||||
func (o *InstallOrgWebhookParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the install org webhook params
|
||||
func (o *InstallOrgWebhookParams) WithBody(body garm_params.InstallWebhookParams) *InstallOrgWebhookParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the install org webhook params
|
||||
func (o *InstallOrgWebhookParams) SetBody(body garm_params.InstallWebhookParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithOrgID adds the orgID to the install org webhook params
|
||||
func (o *InstallOrgWebhookParams) WithOrgID(orgID string) *InstallOrgWebhookParams {
|
||||
o.SetOrgID(orgID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrgID adds the orgId to the install org webhook params
|
||||
func (o *InstallOrgWebhookParams) SetOrgID(orgID string) {
|
||||
o.OrgID = orgID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *InstallOrgWebhookParams) 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
|
||||
}
|
||||
168
client/organizations/install_org_webhook_responses.go
Normal file
168
client/organizations/install_org_webhook_responses.go
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
// 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 (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
)
|
||||
|
||||
// InstallOrgWebhookReader is a Reader for the InstallOrgWebhook structure.
|
||||
type InstallOrgWebhookReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *InstallOrgWebhookReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewInstallOrgWebhookOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewInstallOrgWebhookDefault(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
|
||||
}
|
||||
}
|
||||
|
||||
// NewInstallOrgWebhookOK creates a InstallOrgWebhookOK with default headers values
|
||||
func NewInstallOrgWebhookOK() *InstallOrgWebhookOK {
|
||||
return &InstallOrgWebhookOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
InstallOrgWebhookOK describes a response with status code 200, with default header values.
|
||||
|
||||
InstallOrgWebhookOK install org webhook o k
|
||||
*/
|
||||
type InstallOrgWebhookOK struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this install org webhook o k response has a 2xx status code
|
||||
func (o *InstallOrgWebhookOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this install org webhook o k response has a 3xx status code
|
||||
func (o *InstallOrgWebhookOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this install org webhook o k response has a 4xx status code
|
||||
func (o *InstallOrgWebhookOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this install org webhook o k response has a 5xx status code
|
||||
func (o *InstallOrgWebhookOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this install org webhook o k response a status code equal to that given
|
||||
func (o *InstallOrgWebhookOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the install org webhook o k response
|
||||
func (o *InstallOrgWebhookOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *InstallOrgWebhookOK) Error() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/webhook][%d] installOrgWebhookOK ", 200)
|
||||
}
|
||||
|
||||
func (o *InstallOrgWebhookOK) String() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/webhook][%d] installOrgWebhookOK ", 200)
|
||||
}
|
||||
|
||||
func (o *InstallOrgWebhookOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewInstallOrgWebhookDefault creates a InstallOrgWebhookDefault with default headers values
|
||||
func NewInstallOrgWebhookDefault(code int) *InstallOrgWebhookDefault {
|
||||
return &InstallOrgWebhookDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
InstallOrgWebhookDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type InstallOrgWebhookDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this install org webhook default response has a 2xx status code
|
||||
func (o *InstallOrgWebhookDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this install org webhook default response has a 3xx status code
|
||||
func (o *InstallOrgWebhookDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this install org webhook default response has a 4xx status code
|
||||
func (o *InstallOrgWebhookDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this install org webhook default response has a 5xx status code
|
||||
func (o *InstallOrgWebhookDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this install org webhook default response a status code equal to that given
|
||||
func (o *InstallOrgWebhookDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the install org webhook default response
|
||||
func (o *InstallOrgWebhookDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *InstallOrgWebhookDefault) Error() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/webhook][%d] InstallOrgWebhook default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *InstallOrgWebhookDefault) String() string {
|
||||
return fmt.Sprintf("[POST /organizations/{orgID}/webhook][%d] InstallOrgWebhook default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *InstallOrgWebhookDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *InstallOrgWebhookDefault) 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
|
||||
}
|
||||
|
|
@ -40,12 +40,16 @@ type ClientService interface {
|
|||
|
||||
GetOrgPool(params *GetOrgPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrgPoolOK, error)
|
||||
|
||||
InstallOrgWebhook(params *InstallOrgWebhookParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InstallOrgWebhookOK, error)
|
||||
|
||||
ListOrgInstances(params *ListOrgInstancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgInstancesOK, error)
|
||||
|
||||
ListOrgPools(params *ListOrgPoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgPoolsOK, error)
|
||||
|
||||
ListOrgs(params *ListOrgsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOrgsOK, error)
|
||||
|
||||
UninstallOrgWebhook(params *UninstallOrgWebhookParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
|
||||
|
||||
UpdateOrg(params *UpdateOrgParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateOrgOK, error)
|
||||
|
||||
UpdateOrgPool(params *UpdateOrgPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateOrgPoolOK, error)
|
||||
|
|
@ -269,6 +273,46 @@ func (a *Client) GetOrgPool(params *GetOrgPoolParams, authInfo runtime.ClientAut
|
|||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
InstallOrgWebhook Install the GARM webhook for an organization. The secret configured on the organization will
|
||||
|
||||
be used to validate the requests.
|
||||
*/
|
||||
func (a *Client) InstallOrgWebhook(params *InstallOrgWebhookParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InstallOrgWebhookOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewInstallOrgWebhookParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "InstallOrgWebhook",
|
||||
Method: "POST",
|
||||
PathPattern: "/organizations/{orgID}/webhook",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &InstallOrgWebhookReader{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.(*InstallOrgWebhookOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*InstallOrgWebhookDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ListOrgInstances lists organization instances
|
||||
*/
|
||||
|
|
@ -383,6 +427,38 @@ func (a *Client) ListOrgs(params *ListOrgsParams, authInfo runtime.ClientAuthInf
|
|||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
UninstallOrgWebhook uninstalls organization webhook
|
||||
*/
|
||||
func (a *Client) UninstallOrgWebhook(params *UninstallOrgWebhookParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewUninstallOrgWebhookParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "UninstallOrgWebhook",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/organizations/{orgID}/webhook",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &UninstallOrgWebhookReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
_, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateOrg updates organization with the parameters given
|
||||
*/
|
||||
|
|
|
|||
151
client/organizations/uninstall_org_webhook_parameters.go
Normal file
151
client/organizations/uninstall_org_webhook_parameters.go
Normal 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"
|
||||
)
|
||||
|
||||
// NewUninstallOrgWebhookParams creates a new UninstallOrgWebhookParams 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 NewUninstallOrgWebhookParams() *UninstallOrgWebhookParams {
|
||||
return &UninstallOrgWebhookParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUninstallOrgWebhookParamsWithTimeout creates a new UninstallOrgWebhookParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewUninstallOrgWebhookParamsWithTimeout(timeout time.Duration) *UninstallOrgWebhookParams {
|
||||
return &UninstallOrgWebhookParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUninstallOrgWebhookParamsWithContext creates a new UninstallOrgWebhookParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewUninstallOrgWebhookParamsWithContext(ctx context.Context) *UninstallOrgWebhookParams {
|
||||
return &UninstallOrgWebhookParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUninstallOrgWebhookParamsWithHTTPClient creates a new UninstallOrgWebhookParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewUninstallOrgWebhookParamsWithHTTPClient(client *http.Client) *UninstallOrgWebhookParams {
|
||||
return &UninstallOrgWebhookParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UninstallOrgWebhookParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the uninstall org webhook operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type UninstallOrgWebhookParams struct {
|
||||
|
||||
/* OrgID.
|
||||
|
||||
Organization ID.
|
||||
*/
|
||||
OrgID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the uninstall org webhook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UninstallOrgWebhookParams) WithDefaults() *UninstallOrgWebhookParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the uninstall org webhook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UninstallOrgWebhookParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the uninstall org webhook params
|
||||
func (o *UninstallOrgWebhookParams) WithTimeout(timeout time.Duration) *UninstallOrgWebhookParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the uninstall org webhook params
|
||||
func (o *UninstallOrgWebhookParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the uninstall org webhook params
|
||||
func (o *UninstallOrgWebhookParams) WithContext(ctx context.Context) *UninstallOrgWebhookParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the uninstall org webhook params
|
||||
func (o *UninstallOrgWebhookParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the uninstall org webhook params
|
||||
func (o *UninstallOrgWebhookParams) WithHTTPClient(client *http.Client) *UninstallOrgWebhookParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the uninstall org webhook params
|
||||
func (o *UninstallOrgWebhookParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOrgID adds the orgID to the uninstall org webhook params
|
||||
func (o *UninstallOrgWebhookParams) WithOrgID(orgID string) *UninstallOrgWebhookParams {
|
||||
o.SetOrgID(orgID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOrgID adds the orgId to the uninstall org webhook params
|
||||
func (o *UninstallOrgWebhookParams) SetOrgID(orgID string) {
|
||||
o.OrgID = orgID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *UninstallOrgWebhookParams) 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
|
||||
}
|
||||
103
client/organizations/uninstall_org_webhook_responses.go
Normal file
103
client/organizations/uninstall_org_webhook_responses.go
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
// 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 (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
)
|
||||
|
||||
// UninstallOrgWebhookReader is a Reader for the UninstallOrgWebhook structure.
|
||||
type UninstallOrgWebhookReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *UninstallOrgWebhookReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
result := NewUninstallOrgWebhookDefault(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
|
||||
}
|
||||
|
||||
// NewUninstallOrgWebhookDefault creates a UninstallOrgWebhookDefault with default headers values
|
||||
func NewUninstallOrgWebhookDefault(code int) *UninstallOrgWebhookDefault {
|
||||
return &UninstallOrgWebhookDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UninstallOrgWebhookDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type UninstallOrgWebhookDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this uninstall org webhook default response has a 2xx status code
|
||||
func (o *UninstallOrgWebhookDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this uninstall org webhook default response has a 3xx status code
|
||||
func (o *UninstallOrgWebhookDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this uninstall org webhook default response has a 4xx status code
|
||||
func (o *UninstallOrgWebhookDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this uninstall org webhook default response has a 5xx status code
|
||||
func (o *UninstallOrgWebhookDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this uninstall org webhook default response a status code equal to that given
|
||||
func (o *UninstallOrgWebhookDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the uninstall org webhook default response
|
||||
func (o *UninstallOrgWebhookDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *UninstallOrgWebhookDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}/webhook][%d] UninstallOrgWebhook default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UninstallOrgWebhookDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /organizations/{orgID}/webhook][%d] UninstallOrgWebhook default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UninstallOrgWebhookDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UninstallOrgWebhookDefault) 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
|
||||
}
|
||||
173
client/repositories/install_repo_webhook_parameters.go
Normal file
173
client/repositories/install_repo_webhook_parameters.go
Normal 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"
|
||||
)
|
||||
|
||||
// NewInstallRepoWebhookParams creates a new InstallRepoWebhookParams 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 NewInstallRepoWebhookParams() *InstallRepoWebhookParams {
|
||||
return &InstallRepoWebhookParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewInstallRepoWebhookParamsWithTimeout creates a new InstallRepoWebhookParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewInstallRepoWebhookParamsWithTimeout(timeout time.Duration) *InstallRepoWebhookParams {
|
||||
return &InstallRepoWebhookParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewInstallRepoWebhookParamsWithContext creates a new InstallRepoWebhookParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewInstallRepoWebhookParamsWithContext(ctx context.Context) *InstallRepoWebhookParams {
|
||||
return &InstallRepoWebhookParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewInstallRepoWebhookParamsWithHTTPClient creates a new InstallRepoWebhookParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewInstallRepoWebhookParamsWithHTTPClient(client *http.Client) *InstallRepoWebhookParams {
|
||||
return &InstallRepoWebhookParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
InstallRepoWebhookParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the install repo webhook operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type InstallRepoWebhookParams struct {
|
||||
|
||||
/* Body.
|
||||
|
||||
Parameters used when creating the repository webhook.
|
||||
*/
|
||||
Body garm_params.InstallWebhookParams
|
||||
|
||||
/* RepoID.
|
||||
|
||||
Repository ID.
|
||||
*/
|
||||
RepoID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the install repo webhook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *InstallRepoWebhookParams) WithDefaults() *InstallRepoWebhookParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the install repo webhook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *InstallRepoWebhookParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the install repo webhook params
|
||||
func (o *InstallRepoWebhookParams) WithTimeout(timeout time.Duration) *InstallRepoWebhookParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the install repo webhook params
|
||||
func (o *InstallRepoWebhookParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the install repo webhook params
|
||||
func (o *InstallRepoWebhookParams) WithContext(ctx context.Context) *InstallRepoWebhookParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the install repo webhook params
|
||||
func (o *InstallRepoWebhookParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the install repo webhook params
|
||||
func (o *InstallRepoWebhookParams) WithHTTPClient(client *http.Client) *InstallRepoWebhookParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the install repo webhook params
|
||||
func (o *InstallRepoWebhookParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the install repo webhook params
|
||||
func (o *InstallRepoWebhookParams) WithBody(body garm_params.InstallWebhookParams) *InstallRepoWebhookParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the install repo webhook params
|
||||
func (o *InstallRepoWebhookParams) SetBody(body garm_params.InstallWebhookParams) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WithRepoID adds the repoID to the install repo webhook params
|
||||
func (o *InstallRepoWebhookParams) WithRepoID(repoID string) *InstallRepoWebhookParams {
|
||||
o.SetRepoID(repoID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetRepoID adds the repoId to the install repo webhook params
|
||||
func (o *InstallRepoWebhookParams) SetRepoID(repoID string) {
|
||||
o.RepoID = repoID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *InstallRepoWebhookParams) 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
|
||||
}
|
||||
168
client/repositories/install_repo_webhook_responses.go
Normal file
168
client/repositories/install_repo_webhook_responses.go
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package repositories
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
)
|
||||
|
||||
// InstallRepoWebhookReader is a Reader for the InstallRepoWebhook structure.
|
||||
type InstallRepoWebhookReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *InstallRepoWebhookReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewInstallRepoWebhookOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewInstallRepoWebhookDefault(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
|
||||
}
|
||||
}
|
||||
|
||||
// NewInstallRepoWebhookOK creates a InstallRepoWebhookOK with default headers values
|
||||
func NewInstallRepoWebhookOK() *InstallRepoWebhookOK {
|
||||
return &InstallRepoWebhookOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
InstallRepoWebhookOK describes a response with status code 200, with default header values.
|
||||
|
||||
InstallRepoWebhookOK install repo webhook o k
|
||||
*/
|
||||
type InstallRepoWebhookOK struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this install repo webhook o k response has a 2xx status code
|
||||
func (o *InstallRepoWebhookOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this install repo webhook o k response has a 3xx status code
|
||||
func (o *InstallRepoWebhookOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this install repo webhook o k response has a 4xx status code
|
||||
func (o *InstallRepoWebhookOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this install repo webhook o k response has a 5xx status code
|
||||
func (o *InstallRepoWebhookOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this install repo webhook o k response a status code equal to that given
|
||||
func (o *InstallRepoWebhookOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the install repo webhook o k response
|
||||
func (o *InstallRepoWebhookOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *InstallRepoWebhookOK) Error() string {
|
||||
return fmt.Sprintf("[POST /repositories/{repoID}/webhook][%d] installRepoWebhookOK ", 200)
|
||||
}
|
||||
|
||||
func (o *InstallRepoWebhookOK) String() string {
|
||||
return fmt.Sprintf("[POST /repositories/{repoID}/webhook][%d] installRepoWebhookOK ", 200)
|
||||
}
|
||||
|
||||
func (o *InstallRepoWebhookOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewInstallRepoWebhookDefault creates a InstallRepoWebhookDefault with default headers values
|
||||
func NewInstallRepoWebhookDefault(code int) *InstallRepoWebhookDefault {
|
||||
return &InstallRepoWebhookDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
InstallRepoWebhookDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type InstallRepoWebhookDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this install repo webhook default response has a 2xx status code
|
||||
func (o *InstallRepoWebhookDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this install repo webhook default response has a 3xx status code
|
||||
func (o *InstallRepoWebhookDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this install repo webhook default response has a 4xx status code
|
||||
func (o *InstallRepoWebhookDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this install repo webhook default response has a 5xx status code
|
||||
func (o *InstallRepoWebhookDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this install repo webhook default response a status code equal to that given
|
||||
func (o *InstallRepoWebhookDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the install repo webhook default response
|
||||
func (o *InstallRepoWebhookDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *InstallRepoWebhookDefault) Error() string {
|
||||
return fmt.Sprintf("[POST /repositories/{repoID}/webhook][%d] InstallRepoWebhook default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *InstallRepoWebhookDefault) String() string {
|
||||
return fmt.Sprintf("[POST /repositories/{repoID}/webhook][%d] InstallRepoWebhook default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *InstallRepoWebhookDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *InstallRepoWebhookDefault) 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
|
||||
}
|
||||
|
|
@ -40,12 +40,16 @@ type ClientService interface {
|
|||
|
||||
GetRepoPool(params *GetRepoPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetRepoPoolOK, error)
|
||||
|
||||
InstallRepoWebhook(params *InstallRepoWebhookParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InstallRepoWebhookOK, error)
|
||||
|
||||
ListRepoInstances(params *ListRepoInstancesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListRepoInstancesOK, error)
|
||||
|
||||
ListRepoPools(params *ListRepoPoolsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListRepoPoolsOK, error)
|
||||
|
||||
ListRepos(params *ListReposParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListReposOK, error)
|
||||
|
||||
UninstallRepoWebhook(params *UninstallRepoWebhookParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
|
||||
|
||||
UpdateRepo(params *UpdateRepoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateRepoOK, error)
|
||||
|
||||
UpdateRepoPool(params *UpdateRepoPoolParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateRepoPoolOK, error)
|
||||
|
|
@ -269,6 +273,46 @@ func (a *Client) GetRepoPool(params *GetRepoPoolParams, authInfo runtime.ClientA
|
|||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
InstallRepoWebhook Install the GARM webhook for an organization. The secret configured on the organization will
|
||||
|
||||
be used to validate the requests.
|
||||
*/
|
||||
func (a *Client) InstallRepoWebhook(params *InstallRepoWebhookParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InstallRepoWebhookOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewInstallRepoWebhookParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "InstallRepoWebhook",
|
||||
Method: "POST",
|
||||
PathPattern: "/repositories/{repoID}/webhook",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &InstallRepoWebhookReader{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.(*InstallRepoWebhookOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*InstallRepoWebhookDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ListRepoInstances lists repository instances
|
||||
*/
|
||||
|
|
@ -383,6 +427,38 @@ func (a *Client) ListRepos(params *ListReposParams, authInfo runtime.ClientAuthI
|
|||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
UninstallRepoWebhook uninstalls organization webhook
|
||||
*/
|
||||
func (a *Client) UninstallRepoWebhook(params *UninstallRepoWebhookParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewUninstallRepoWebhookParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "UninstallRepoWebhook",
|
||||
Method: "DELETE",
|
||||
PathPattern: "/repositories/{repoID}/webhook",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &UninstallRepoWebhookReader{formats: a.formats},
|
||||
AuthInfo: authInfo,
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
_, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateRepo updates repository with the parameters given
|
||||
*/
|
||||
|
|
|
|||
151
client/repositories/uninstall_repo_webhook_parameters.go
Normal file
151
client/repositories/uninstall_repo_webhook_parameters.go
Normal 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"
|
||||
)
|
||||
|
||||
// NewUninstallRepoWebhookParams creates a new UninstallRepoWebhookParams 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 NewUninstallRepoWebhookParams() *UninstallRepoWebhookParams {
|
||||
return &UninstallRepoWebhookParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUninstallRepoWebhookParamsWithTimeout creates a new UninstallRepoWebhookParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewUninstallRepoWebhookParamsWithTimeout(timeout time.Duration) *UninstallRepoWebhookParams {
|
||||
return &UninstallRepoWebhookParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUninstallRepoWebhookParamsWithContext creates a new UninstallRepoWebhookParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewUninstallRepoWebhookParamsWithContext(ctx context.Context) *UninstallRepoWebhookParams {
|
||||
return &UninstallRepoWebhookParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUninstallRepoWebhookParamsWithHTTPClient creates a new UninstallRepoWebhookParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewUninstallRepoWebhookParamsWithHTTPClient(client *http.Client) *UninstallRepoWebhookParams {
|
||||
return &UninstallRepoWebhookParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UninstallRepoWebhookParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the uninstall repo webhook operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type UninstallRepoWebhookParams struct {
|
||||
|
||||
/* RepoID.
|
||||
|
||||
Repository ID.
|
||||
*/
|
||||
RepoID string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the uninstall repo webhook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UninstallRepoWebhookParams) WithDefaults() *UninstallRepoWebhookParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the uninstall repo webhook params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *UninstallRepoWebhookParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the uninstall repo webhook params
|
||||
func (o *UninstallRepoWebhookParams) WithTimeout(timeout time.Duration) *UninstallRepoWebhookParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the uninstall repo webhook params
|
||||
func (o *UninstallRepoWebhookParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the uninstall repo webhook params
|
||||
func (o *UninstallRepoWebhookParams) WithContext(ctx context.Context) *UninstallRepoWebhookParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the uninstall repo webhook params
|
||||
func (o *UninstallRepoWebhookParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the uninstall repo webhook params
|
||||
func (o *UninstallRepoWebhookParams) WithHTTPClient(client *http.Client) *UninstallRepoWebhookParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the uninstall repo webhook params
|
||||
func (o *UninstallRepoWebhookParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithRepoID adds the repoID to the uninstall repo webhook params
|
||||
func (o *UninstallRepoWebhookParams) WithRepoID(repoID string) *UninstallRepoWebhookParams {
|
||||
o.SetRepoID(repoID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetRepoID adds the repoId to the uninstall repo webhook params
|
||||
func (o *UninstallRepoWebhookParams) SetRepoID(repoID string) {
|
||||
o.RepoID = repoID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *UninstallRepoWebhookParams) 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
|
||||
}
|
||||
103
client/repositories/uninstall_repo_webhook_responses.go
Normal file
103
client/repositories/uninstall_repo_webhook_responses.go
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package repositories
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
apiserver_params "github.com/cloudbase/garm/apiserver/params"
|
||||
)
|
||||
|
||||
// UninstallRepoWebhookReader is a Reader for the UninstallRepoWebhook structure.
|
||||
type UninstallRepoWebhookReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *UninstallRepoWebhookReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
result := NewUninstallRepoWebhookDefault(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
|
||||
}
|
||||
|
||||
// NewUninstallRepoWebhookDefault creates a UninstallRepoWebhookDefault with default headers values
|
||||
func NewUninstallRepoWebhookDefault(code int) *UninstallRepoWebhookDefault {
|
||||
return &UninstallRepoWebhookDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
UninstallRepoWebhookDefault describes a response with status code -1, with default header values.
|
||||
|
||||
APIErrorResponse
|
||||
*/
|
||||
type UninstallRepoWebhookDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload apiserver_params.APIErrorResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this uninstall repo webhook default response has a 2xx status code
|
||||
func (o *UninstallRepoWebhookDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this uninstall repo webhook default response has a 3xx status code
|
||||
func (o *UninstallRepoWebhookDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this uninstall repo webhook default response has a 4xx status code
|
||||
func (o *UninstallRepoWebhookDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this uninstall repo webhook default response has a 5xx status code
|
||||
func (o *UninstallRepoWebhookDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this uninstall repo webhook default response a status code equal to that given
|
||||
func (o *UninstallRepoWebhookDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the uninstall repo webhook default response
|
||||
func (o *UninstallRepoWebhookDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *UninstallRepoWebhookDefault) Error() string {
|
||||
return fmt.Sprintf("[DELETE /repositories/{repoID}/webhook][%d] UninstallRepoWebhook default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UninstallRepoWebhookDefault) String() string {
|
||||
return fmt.Sprintf("[DELETE /repositories/{repoID}/webhook][%d] UninstallRepoWebhook default %+v", o._statusCode, o.Payload)
|
||||
}
|
||||
|
||||
func (o *UninstallRepoWebhookDefault) GetPayload() apiserver_params.APIErrorResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *UninstallRepoWebhookDefault) 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
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@ var (
|
|||
orgWebhookSecret string
|
||||
orgCreds string
|
||||
orgRandomWebhookSecret bool
|
||||
insecureOrgWebhook bool
|
||||
)
|
||||
|
||||
// organizationCmd represents the organization command
|
||||
|
|
@ -46,6 +47,70 @@ organization for which garm maintains pools of self hosted runners.`,
|
|||
Run: nil,
|
||||
}
|
||||
|
||||
var orgWebhookCmd = &cobra.Command{
|
||||
Use: "webhook",
|
||||
Short: "Manage organization webhooks",
|
||||
Long: `Manage organization webhooks.`,
|
||||
SilenceUsage: true,
|
||||
Run: nil,
|
||||
}
|
||||
|
||||
var orgWebhookInstallCmd = &cobra.Command{
|
||||
Use: "install",
|
||||
Short: "Install webhook",
|
||||
Long: `Install webhook for an organization.`,
|
||||
SilenceUsage: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if needsInit {
|
||||
return errNeedsInitError
|
||||
}
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("requires an organization ID")
|
||||
}
|
||||
if len(args) > 1 {
|
||||
return fmt.Errorf("too many arguments")
|
||||
}
|
||||
|
||||
installWebhookReq := apiClientOrgs.NewInstallOrgWebhookParams()
|
||||
installWebhookReq.OrgID = args[0]
|
||||
installWebhookReq.Body.InsecureSSL = insecureOrgWebhook
|
||||
installWebhookReq.Body.WebhookEndpointType = params.WebhookEndpointDirect
|
||||
|
||||
_, err := apiCli.Organizations.InstallOrgWebhook(installWebhookReq, authToken)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var orgWebhookUninstallCmd = &cobra.Command{
|
||||
Use: "uninstall",
|
||||
Short: "Uninstall webhook",
|
||||
Long: `Uninstall webhook for an organization.`,
|
||||
SilenceUsage: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if needsInit {
|
||||
return errNeedsInitError
|
||||
}
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("requires an organization ID")
|
||||
}
|
||||
if len(args) > 1 {
|
||||
return fmt.Errorf("too many arguments")
|
||||
}
|
||||
|
||||
uninstallWebhookReq := apiClientOrgs.NewUninstallOrgWebhookParams()
|
||||
uninstallWebhookReq.OrgID = args[0]
|
||||
|
||||
err := apiCli.Organizations.UninstallOrgWebhook(uninstallWebhookReq, authToken)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var orgAddCmd = &cobra.Command{
|
||||
Use: "add",
|
||||
Aliases: []string{"create"},
|
||||
|
|
@ -99,7 +164,7 @@ var orgUpdateCmd = &cobra.Command{
|
|||
}
|
||||
updateOrgReq := apiClientOrgs.NewUpdateOrgParams()
|
||||
updateOrgReq.Body = params.UpdateEntityParams{
|
||||
WebhookSecret: repoWebhookSecret,
|
||||
WebhookSecret: orgWebhookSecret,
|
||||
CredentialsName: orgCreds,
|
||||
}
|
||||
updateOrgReq.OrgID = args[0]
|
||||
|
|
@ -197,12 +262,19 @@ func init() {
|
|||
orgUpdateCmd.Flags().StringVar(&orgWebhookSecret, "webhook-secret", "", "The webhook secret for this organization")
|
||||
orgUpdateCmd.Flags().StringVar(&orgCreds, "credentials", "", "Credentials name. See credentials list.")
|
||||
|
||||
orgWebhookInstallCmd.Flags().BoolVar(&insecureOrgWebhook, "insecure", false, "Ignore self signed certificate errors.")
|
||||
orgWebhookCmd.AddCommand(
|
||||
orgWebhookInstallCmd,
|
||||
orgWebhookUninstallCmd,
|
||||
)
|
||||
|
||||
organizationCmd.AddCommand(
|
||||
orgListCmd,
|
||||
orgAddCmd,
|
||||
orgShowCmd,
|
||||
orgDeleteCmd,
|
||||
orgUpdateCmd,
|
||||
orgWebhookCmd,
|
||||
)
|
||||
|
||||
rootCmd.AddCommand(organizationCmd)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ var (
|
|||
repoWebhookSecret string
|
||||
repoCreds string
|
||||
randomWebhookSecret bool
|
||||
insecureRepoWebhook bool
|
||||
)
|
||||
|
||||
// repositoryCmd represents the repository command
|
||||
|
|
@ -47,6 +48,70 @@ repository for which the garm maintains pools of self hosted runners.`,
|
|||
Run: nil,
|
||||
}
|
||||
|
||||
var repoWebhookCmd = &cobra.Command{
|
||||
Use: "webhook",
|
||||
Short: "Manage repository webhooks",
|
||||
Long: `Manage repository webhooks.`,
|
||||
SilenceUsage: true,
|
||||
Run: nil,
|
||||
}
|
||||
|
||||
var repoWebhookInstallCmd = &cobra.Command{
|
||||
Use: "install",
|
||||
Short: "Install webhook",
|
||||
Long: `Install webhook for a repository.`,
|
||||
SilenceUsage: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if needsInit {
|
||||
return errNeedsInitError
|
||||
}
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("requires a repository ID")
|
||||
}
|
||||
if len(args) > 1 {
|
||||
return fmt.Errorf("too many arguments")
|
||||
}
|
||||
|
||||
installWebhookReq := apiClientRepos.NewInstallRepoWebhookParams()
|
||||
installWebhookReq.RepoID = args[0]
|
||||
installWebhookReq.Body.InsecureSSL = insecureRepoWebhook
|
||||
installWebhookReq.Body.WebhookEndpointType = params.WebhookEndpointDirect
|
||||
|
||||
_, err := apiCli.Repositories.InstallRepoWebhook(installWebhookReq, authToken)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var repoWebhookUninstallCmd = &cobra.Command{
|
||||
Use: "uninstall",
|
||||
Short: "Uninstall webhook",
|
||||
Long: `Uninstall webhook for a repository.`,
|
||||
SilenceUsage: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if needsInit {
|
||||
return errNeedsInitError
|
||||
}
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("requires a repository ID")
|
||||
}
|
||||
if len(args) > 1 {
|
||||
return fmt.Errorf("too many arguments")
|
||||
}
|
||||
|
||||
uninstallWebhookReq := apiClientRepos.NewUninstallRepoWebhookParams()
|
||||
uninstallWebhookReq.RepoID = args[0]
|
||||
|
||||
err := apiCli.Repositories.UninstallRepoWebhook(uninstallWebhookReq, authToken)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var repoAddCmd = &cobra.Command{
|
||||
Use: "add",
|
||||
Aliases: []string{"create"},
|
||||
|
|
@ -202,12 +267,19 @@ func init() {
|
|||
repoUpdateCmd.Flags().StringVar(&repoWebhookSecret, "webhook-secret", "", "The webhook secret for this repository. If you update this secret, you will have to manually update the secret in GitHub as well.")
|
||||
repoUpdateCmd.Flags().StringVar(&repoCreds, "credentials", "", "Credentials name. See credentials list.")
|
||||
|
||||
repoWebhookInstallCmd.Flags().BoolVar(&insecureRepoWebhook, "insecure", false, "Ignore self signed certificate errors.")
|
||||
repoWebhookCmd.AddCommand(
|
||||
repoWebhookInstallCmd,
|
||||
repoWebhookUninstallCmd,
|
||||
)
|
||||
|
||||
repositoryCmd.AddCommand(
|
||||
repoListCmd,
|
||||
repoAddCmd,
|
||||
repoShowCmd,
|
||||
repoDeleteCmd,
|
||||
repoUpdateCmd,
|
||||
repoWebhookCmd,
|
||||
)
|
||||
|
||||
rootCmd.AddCommand(repositoryCmd)
|
||||
|
|
|
|||
|
|
@ -251,6 +251,9 @@ func (r *organization) listHooks(ctx context.Context) ([]*github.Hook, error) {
|
|||
for {
|
||||
hooks, ghResp, err := r.ghcli.ListOrgHooks(ctx, r.cfg.Name, &opts)
|
||||
if err != nil {
|
||||
if ghResp != nil && ghResp.StatusCode == http.StatusNotFound {
|
||||
return nil, errors.Wrap(runnerErrors.ErrNotFound, "fetching hooks")
|
||||
}
|
||||
return nil, errors.Wrap(err, "fetching hooks")
|
||||
}
|
||||
allHooks = append(allHooks, hooks...)
|
||||
|
|
|
|||
|
|
@ -1609,7 +1609,7 @@ func (r *basePoolManager) consumeQueuedJobs() error {
|
|||
|
||||
func (r *basePoolManager) InstallWebhook(ctx context.Context, param params.InstallWebhookParams) error {
|
||||
if r.urls.controllerWebhookURL == "" {
|
||||
return errors.Wrap(runnerErrors.ErrUnprocessable, "controller webhook url is empty")
|
||||
return errors.Wrap(runnerErrors.ErrBadRequest, "controller webhook url is empty")
|
||||
}
|
||||
|
||||
insecureSSL := "0"
|
||||
|
|
@ -1634,7 +1634,7 @@ func (r *basePoolManager) InstallWebhook(ctx context.Context, param params.Insta
|
|||
|
||||
func (r *basePoolManager) UninstallWebhook(ctx context.Context) error {
|
||||
if r.urls.controllerWebhookURL == "" {
|
||||
return errors.Wrap(runnerErrors.ErrUnprocessable, "controller webhook url is empty")
|
||||
return errors.Wrap(runnerErrors.ErrBadRequest, "controller webhook url is empty")
|
||||
}
|
||||
|
||||
return r.helper.UninstallHook(ctx, r.urls.controllerWebhookURL)
|
||||
|
|
|
|||
|
|
@ -57,6 +57,12 @@ func NewRepositoryPoolManager(ctx context.Context, cfg params.Repository, cfgInt
|
|||
store: store,
|
||||
providers: providers,
|
||||
controllerID: cfgInternal.ControllerID,
|
||||
urls: urls{
|
||||
webhookURL: cfgInternal.BaseWebhookURL,
|
||||
callbackURL: cfgInternal.InstanceCallbackURL,
|
||||
metadataURL: cfgInternal.InstanceMetadataURL,
|
||||
controllerWebhookURL: cfgInternal.ControllerWebhookURL,
|
||||
},
|
||||
quit: make(chan struct{}),
|
||||
helper: helper,
|
||||
credsDetails: cfgInternal.GithubCredentialsDetails,
|
||||
|
|
@ -246,6 +252,9 @@ func (r *repository) listHooks(ctx context.Context) ([]*github.Hook, error) {
|
|||
for {
|
||||
hooks, ghResp, err := r.ghcli.ListRepoHooks(ctx, r.cfg.Owner, r.cfg.Name, &opts)
|
||||
if err != nil {
|
||||
if ghResp != nil && ghResp.StatusCode == http.StatusNotFound {
|
||||
return nil, errors.Wrap(runnerErrors.ErrNotFound, "fetching hooks")
|
||||
}
|
||||
return nil, errors.Wrap(err, "fetching hooks")
|
||||
}
|
||||
allHooks = append(allHooks, hooks...)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue