diff --git a/CHANGELOG.md b/CHANGELOG.md index e2ad39d1e..8a45aa06a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,56 @@ +# Release 0.31.3 + +## What's New + +* Services Max Idle Time +* Add/Remove Peer and Transfer Leadership via REST + +## Service Max Idle Time + +A max idle time can now be configured on services. The default value of 0 indicates that no maximum will +be enforced. A circuit is considered idle when no traffic is flowing across through the initiating or +terminating router. + +``` +ziti edge create service test-service --max-idle-time 5m +``` + +Note that the idle time calculation is done on the router, so if max idle time on a service is less +than the configured scan interval on the router, it make take longer than expected for idle circuits +to be removed. + +## Raft Cluster Management via REST + +The controller now allows some Raft cluster management operations to be performed via REST. + +NOTE: If your cluster is not bootstrapped yet, the REST API won't be available. These will only work on a bootstrapped cluster! + +The following operations are now supported: + +* Add member +* Remove member +* Transfer leadership + +``` +ziti fabric raft add-member tls:localhost:6363 +ziti fabric raft add-member tls:localhost:6464 +ziti fabric raft transfer-leadership +ziti fabric raft transfer-leadership ctrl3 +ziti fabric raft remove-member ctrl2 +ziti fabric raft remove-member ctrl3 +``` + +## Component Updates and Bug Fixes + +* github.com/openziti/edge-api: [v0.26.1 -> v0.26.5](https://github.com/openziti/edge-api/compare/v0.26.1...v0.26.5) +* github.com/openziti/ziti: [v0.31.2 -> v0.31.3](https://github.com/openziti/ziti/compare/v0.31.2...v0.31.3) + * [Issue #1544](https://github.com/openziti/ziti/issues/1544) - Support transfer raft leadership via REST + * [Issue #1543](https://github.com/openziti/ziti/issues/1543) - Support add/remove raft peer via REST + * [Issue #1496](https://github.com/openziti/ziti/issues/1496) - Configurable Timer needed to close idle circuits + * [Issue #1402](https://github.com/openziti/ziti/issues/1402) - Allow router to decomission itself + + + # Release 0.31.2 ## What's New diff --git a/controller/api_impl/raft_router.go b/controller/api_impl/raft_router.go index 5d245ff6d..a12319eea 100644 --- a/controller/api_impl/raft_router.go +++ b/controller/api_impl/raft_router.go @@ -1,7 +1,28 @@ +/* + Copyright NetFoundry Inc. + + 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 + + https://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 api_impl import ( + "fmt" + "github.com/openziti/foundation/v2/errorz" + "github.com/openziti/ziti/common/pb/cmd_pb" + "github.com/openziti/ziti/controller/apierror" "net/http" + "time" "github.com/go-openapi/runtime/middleware" "github.com/openziti/ziti/controller/api" @@ -26,16 +47,45 @@ func NewRaftRouter() *RaftRouter { func (r *RaftRouter) Register(fabricApi *operations.ZitiFabricAPI, wrapper RequestWrapper) { fabricApi.RaftRaftListMembersHandler = raft.RaftListMembersHandlerFunc(func(params raft.RaftListMembersParams) middleware.Responder { - return wrapper.WrapRequest(r.ListMembers, params.HTTPRequest, "", "") + return wrapper.WrapRequest(r.listMembers, params.HTTPRequest, "", "") + }) + + fabricApi.RaftRaftMemberAddHandler = raft.RaftMemberAddHandlerFunc(func(params raft.RaftMemberAddParams) middleware.Responder { + return wrapper.WrapRequest(func(network *network.Network, rc api.RequestContext) { + r.addMember(network, rc, params) + }, params.HTTPRequest, "", "") + }) + + fabricApi.RaftRaftMemberRemoveHandler = raft.RaftMemberRemoveHandlerFunc(func(params raft.RaftMemberRemoveParams) middleware.Responder { + return wrapper.WrapRequest(func(network *network.Network, rc api.RequestContext) { + r.removeMember(network, rc, params) + }, params.HTTPRequest, "", "") + }) + + fabricApi.RaftRaftTranferLeadershipHandler = raft.RaftTranferLeadershipHandlerFunc(func(params raft.RaftTranferLeadershipParams) middleware.Responder { + return wrapper.WrapRequest(func(network *network.Network, rc api.RequestContext) { + r.transferLeadership(network, rc, params) + }, params.HTTPRequest, "", "") }) } -func (r *RaftRouter) ListMembers(n *network.Network, rc api.RequestContext) { - vals := make([]*rest_model.RaftMemberListValue, 0) +func (r *RaftRouter) getRaftController(n *network.Network) *nfraft.Controller { + if n.Dispatcher == nil { + return nil + } - if n.Dispatcher != nil { - rctrl := n.Dispatcher.(*nfraft.Controller) - members, err := rctrl.ListMembers() + if raftController, ok := n.Dispatcher.(*nfraft.Controller); ok { + return raftController + } + + return nil +} + +func (r *RaftRouter) listMembers(n *network.Network, rc api.RequestContext) { + raftController := r.getRaftController(n) + if raftController != nil { + vals := make([]*rest_model.RaftMemberListValue, 0) + members, err := raftController.ListMembers() if err != nil { rc.Respond(rest_model.RaftMemberListResponse{}, http.StatusInternalServerError) } @@ -49,9 +99,90 @@ func (r *RaftRouter) ListMembers(n *network.Network, rc api.RequestContext) { Voter: &member.Voter, }) } - } - rc.Respond(rest_model.RaftMemberListResponse{ - Values: vals, - }, http.StatusOK) + rc.Respond(rest_model.RaftMemberListResponse{ + Values: vals, + }, http.StatusOK) + + } else { + rc.RespondWithApiError(apierror.NewNotRunningInHAModeError()) + } +} + +func (r *RaftRouter) addMember(n *network.Network, rc api.RequestContext, params raft.RaftMemberAddParams) { + raftController := r.getRaftController(n) + if raftController != nil { + addr := *params.Member.Address + peerId, peerAddr, err := raftController.Mesh.GetPeerInfo(addr, 15*time.Second) + if err != nil { + msg := fmt.Sprintf("unable to retrieve cluster member id [%s] for supplied address", err.Error()) + rc.RespondWithApiError(apierror.NewBadRequestFieldError(*errorz.NewFieldError(msg, "address", addr))) + return + } + + id := string(peerId) + addr = string(peerAddr) + + req := &cmd_pb.AddPeerRequest{ + Addr: addr, + Id: id, + IsVoter: *params.Member.IsVoter, + } + + if err = raftController.Join(req); err != nil { + msg := fmt.Sprintf("unable to add cluster member for supplied address: [%s]", err.Error()) + rc.RespondWithApiError(apierror.NewBadRequestFieldError(*errorz.NewFieldError(msg, "address", addr))) + return + } + + rc.RespondWithEmptyOk() + + } else { + rc.RespondWithApiError(apierror.NewNotRunningInHAModeError()) + } +} + +func (r *RaftRouter) removeMember(n *network.Network, rc api.RequestContext, params raft.RaftMemberRemoveParams) { + raftController := r.getRaftController(n) + if raftController != nil { + req := &cmd_pb.RemovePeerRequest{ + Id: *params.Member.ID, + } + + if err := raftController.HandleRemovePeer(req); err != nil { + msg := fmt.Sprintf("unable to remove cluster member node for supplied node id: [%s]", err.Error()) + rc.RespondWithApiError(apierror.NewBadRequestFieldError(*errorz.NewFieldError(msg, "id", *params.Member.ID))) + return + } + + rc.RespondWithEmptyOk() + + } else { + rc.RespondWithApiError(apierror.NewNotRunningInHAModeError()) + } +} + +func (r *RaftRouter) transferLeadership(n *network.Network, rc api.RequestContext, params raft.RaftTranferLeadershipParams) { + raftController := r.getRaftController(n) + if raftController != nil { + req := &cmd_pb.TransferLeadershipRequest{ + Id: params.Member.NewLeaderID, + } + + if err := raftController.HandleTransferLeadership(req); err != nil { + rc.RespondWithApiError(&errorz.ApiError{ + Code: apierror.TransferLeadershipErrorCode, + Message: apierror.TransferLeadershipErrorMessage, + Status: apierror.TransferLeadershipErrorStatus, + Cause: err, + AppendCause: true, + }) + return + } + + rc.RespondWithEmptyOk() + + } else { + rc.RespondWithApiError(apierror.NewNotRunningInHAModeError()) + } } diff --git a/controller/apierror/helpers.go b/controller/apierror/helpers.go index 8a325b528..475733ca6 100644 --- a/controller/apierror/helpers.go +++ b/controller/apierror/helpers.go @@ -383,3 +383,11 @@ func NewTooManyUpdatesError() *errorz.ApiError { Status: ServerTooManyRequestsStatus, } } + +func NewNotRunningInHAModeError() *errorz.ApiError { + return &errorz.ApiError{ + Code: ServerNotRunningInHAModeCode, + Message: ServerNotRunningInHAModeMessage, + Status: ServerNotRunningInHAModeStatus, + } +} diff --git a/controller/apierror/messages.go b/controller/apierror/messages.go index fdf0b21db..b4b69b695 100644 --- a/controller/apierror/messages.go +++ b/controller/apierror/messages.go @@ -198,4 +198,12 @@ const ( ServerTooManyRequestsCode string = "SERVER_TOO_MANY_REQUESTS" ServerTooManyRequestsMessage string = "Too many requests to alter state have been issued. Please slow your request rate or try again later." ServerTooManyRequestsStatus int = http.StatusTooManyRequests + + ServerNotRunningInHAModeCode string = "SERVER_NOT_RUNNING_IN_HA_MODE" + ServerNotRunningInHAModeMessage string = "The server is not running in HA mode. HA operations are not permitted" + ServerNotRunningInHAModeStatus = http.StatusBadRequest + + TransferLeadershipErrorCode string = "TRANSFER_LEADERSHIP_ERROR" + TransferLeadershipErrorMessage string = "Error while attempting to transfer leadership" + TransferLeadershipErrorStatus = http.StatusInternalServerError ) diff --git a/controller/rest_client/raft/raft_client.go b/controller/rest_client/raft/raft_client.go index 00cf44bb6..1e862b767 100644 --- a/controller/rest_client/raft/raft_client.go +++ b/controller/rest_client/raft/raft_client.go @@ -56,6 +56,12 @@ type ClientOption func(*runtime.ClientOperation) type ClientService interface { RaftListMembers(params *RaftListMembersParams, opts ...ClientOption) (*RaftListMembersOK, error) + RaftMemberAdd(params *RaftMemberAddParams, opts ...ClientOption) (*RaftMemberAddOK, error) + + RaftMemberRemove(params *RaftMemberRemoveParams, opts ...ClientOption) (*RaftMemberRemoveOK, error) + + RaftTranferLeadership(params *RaftTranferLeadershipParams, opts ...ClientOption) (*RaftTranferLeadershipOK, error) + SetTransport(transport runtime.ClientTransport) } @@ -99,6 +105,126 @@ func (a *Client) RaftListMembers(params *RaftListMembersParams, opts ...ClientOp panic(msg) } +/* + RaftMemberAdd adds a member to the raft cluster + + Add a member to the raft cluster. Requires admin access. +*/ +func (a *Client) RaftMemberAdd(params *RaftMemberAddParams, opts ...ClientOption) (*RaftMemberAddOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRaftMemberAddParams() + } + op := &runtime.ClientOperation{ + ID: "raftMemberAdd", + Method: "POST", + PathPattern: "/raft/add-member", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &RaftMemberAddReader{formats: a.formats}, + 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.(*RaftMemberAddOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for raftMemberAdd: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + RaftMemberRemove removes a member from the raft cluster + + Remove a member from the raft cluster. Requires admin access. +*/ +func (a *Client) RaftMemberRemove(params *RaftMemberRemoveParams, opts ...ClientOption) (*RaftMemberRemoveOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRaftMemberRemoveParams() + } + op := &runtime.ClientOperation{ + ID: "raftMemberRemove", + Method: "POST", + PathPattern: "/raft/remove-member", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &RaftMemberRemoveReader{formats: a.formats}, + 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.(*RaftMemberRemoveOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for raftMemberRemove: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + RaftTranferLeadership attempts to transfer leadership to a different member of the cluster + + Attempts to transfer leadership to a different member of the cluster. Requires admin access. +*/ +func (a *Client) RaftTranferLeadership(params *RaftTranferLeadershipParams, opts ...ClientOption) (*RaftTranferLeadershipOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRaftTranferLeadershipParams() + } + op := &runtime.ClientOperation{ + ID: "raftTranferLeadership", + Method: "POST", + PathPattern: "/raft/transfer-leadership", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &RaftTranferLeadershipReader{formats: a.formats}, + 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.(*RaftTranferLeadershipOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for raftTranferLeadership: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + // SetTransport changes the transport on the client func (a *Client) SetTransport(transport runtime.ClientTransport) { a.transport = transport diff --git a/controller/rest_client/raft/raft_list_members_responses.go b/controller/rest_client/raft/raft_list_members_responses.go index 6c8d87092..7f848e0dc 100644 --- a/controller/rest_client/raft/raft_list_members_responses.go +++ b/controller/rest_client/raft/raft_list_members_responses.go @@ -53,6 +53,12 @@ func (o *RaftListMembersReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return result, nil + case 400: + result := NewRaftListMembersBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result case 401: result := NewRaftListMembersUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { @@ -102,6 +108,38 @@ func (o *RaftListMembersOK) readResponse(response runtime.ClientResponse, consum return nil } +// NewRaftListMembersBadRequest creates a RaftListMembersBadRequest with default headers values +func NewRaftListMembersBadRequest() *RaftListMembersBadRequest { + return &RaftListMembersBadRequest{} +} + +/* RaftListMembersBadRequest describes a response with status code 400, with default header values. + +The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information +*/ +type RaftListMembersBadRequest struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *RaftListMembersBadRequest) Error() string { + return fmt.Sprintf("[GET /raft/list-members][%d] raftListMembersBadRequest %+v", 400, o.Payload) +} +func (o *RaftListMembersBadRequest) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *RaftListMembersBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + // NewRaftListMembersUnauthorized creates a RaftListMembersUnauthorized with default headers values func NewRaftListMembersUnauthorized() *RaftListMembersUnauthorized { return &RaftListMembersUnauthorized{} diff --git a/controller/rest_client/raft/raft_member_add_parameters.go b/controller/rest_client/raft/raft_member_add_parameters.go new file mode 100644 index 000000000..cacf84aa6 --- /dev/null +++ b/controller/rest_client/raft/raft_member_add_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// 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" + + "github.com/openziti/ziti/controller/rest_model" +) + +// NewRaftMemberAddParams creates a new RaftMemberAddParams 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 NewRaftMemberAddParams() *RaftMemberAddParams { + return &RaftMemberAddParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRaftMemberAddParamsWithTimeout creates a new RaftMemberAddParams object +// with the ability to set a timeout on a request. +func NewRaftMemberAddParamsWithTimeout(timeout time.Duration) *RaftMemberAddParams { + return &RaftMemberAddParams{ + timeout: timeout, + } +} + +// NewRaftMemberAddParamsWithContext creates a new RaftMemberAddParams object +// with the ability to set a context for a request. +func NewRaftMemberAddParamsWithContext(ctx context.Context) *RaftMemberAddParams { + return &RaftMemberAddParams{ + Context: ctx, + } +} + +// NewRaftMemberAddParamsWithHTTPClient creates a new RaftMemberAddParams object +// with the ability to set a custom HTTPClient for a request. +func NewRaftMemberAddParamsWithHTTPClient(client *http.Client) *RaftMemberAddParams { + return &RaftMemberAddParams{ + HTTPClient: client, + } +} + +/* RaftMemberAddParams contains all the parameters to send to the API endpoint + for the raft member add operation. + + Typically these are written to a http.Request. +*/ +type RaftMemberAddParams struct { + + /* Member. + + member parameters + */ + Member *rest_model.RaftMemberAdd + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the raft member add params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RaftMemberAddParams) WithDefaults() *RaftMemberAddParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the raft member add params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RaftMemberAddParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the raft member add params +func (o *RaftMemberAddParams) WithTimeout(timeout time.Duration) *RaftMemberAddParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the raft member add params +func (o *RaftMemberAddParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the raft member add params +func (o *RaftMemberAddParams) WithContext(ctx context.Context) *RaftMemberAddParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the raft member add params +func (o *RaftMemberAddParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the raft member add params +func (o *RaftMemberAddParams) WithHTTPClient(client *http.Client) *RaftMemberAddParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the raft member add params +func (o *RaftMemberAddParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithMember adds the member to the raft member add params +func (o *RaftMemberAddParams) WithMember(member *rest_model.RaftMemberAdd) *RaftMemberAddParams { + o.SetMember(member) + return o +} + +// SetMember adds the member to the raft member add params +func (o *RaftMemberAddParams) SetMember(member *rest_model.RaftMemberAdd) { + o.Member = member +} + +// WriteToRequest writes these params to a swagger request +func (o *RaftMemberAddParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Member != nil { + if err := r.SetBodyParam(o.Member); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/controller/rest_client/raft/raft_member_add_responses.go b/controller/rest_client/raft/raft_member_add_responses.go new file mode 100644 index 000000000..2e8623970 --- /dev/null +++ b/controller/rest_client/raft/raft_member_add_responses.go @@ -0,0 +1,205 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// 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" + + "github.com/openziti/ziti/controller/rest_model" +) + +// RaftMemberAddReader is a Reader for the RaftMemberAdd structure. +type RaftMemberAddReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RaftMemberAddReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRaftMemberAddOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRaftMemberAddBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewRaftMemberAddUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 429: + result := NewRaftMemberAddTooManyRequests() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewRaftMemberAddOK creates a RaftMemberAddOK with default headers values +func NewRaftMemberAddOK() *RaftMemberAddOK { + return &RaftMemberAddOK{} +} + +/* RaftMemberAddOK describes a response with status code 200, with default header values. + +Base empty response +*/ +type RaftMemberAddOK struct { + Payload *rest_model.Empty +} + +func (o *RaftMemberAddOK) Error() string { + return fmt.Sprintf("[POST /raft/add-member][%d] raftMemberAddOK %+v", 200, o.Payload) +} +func (o *RaftMemberAddOK) GetPayload() *rest_model.Empty { + return o.Payload +} + +func (o *RaftMemberAddOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.Empty) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRaftMemberAddBadRequest creates a RaftMemberAddBadRequest with default headers values +func NewRaftMemberAddBadRequest() *RaftMemberAddBadRequest { + return &RaftMemberAddBadRequest{} +} + +/* RaftMemberAddBadRequest describes a response with status code 400, with default header values. + +The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information +*/ +type RaftMemberAddBadRequest struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *RaftMemberAddBadRequest) Error() string { + return fmt.Sprintf("[POST /raft/add-member][%d] raftMemberAddBadRequest %+v", 400, o.Payload) +} +func (o *RaftMemberAddBadRequest) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *RaftMemberAddBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRaftMemberAddUnauthorized creates a RaftMemberAddUnauthorized with default headers values +func NewRaftMemberAddUnauthorized() *RaftMemberAddUnauthorized { + return &RaftMemberAddUnauthorized{} +} + +/* RaftMemberAddUnauthorized describes a response with status code 401, with default header values. + +The currently supplied session does not have the correct access rights to request this resource +*/ +type RaftMemberAddUnauthorized struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *RaftMemberAddUnauthorized) Error() string { + return fmt.Sprintf("[POST /raft/add-member][%d] raftMemberAddUnauthorized %+v", 401, o.Payload) +} +func (o *RaftMemberAddUnauthorized) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *RaftMemberAddUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRaftMemberAddTooManyRequests creates a RaftMemberAddTooManyRequests with default headers values +func NewRaftMemberAddTooManyRequests() *RaftMemberAddTooManyRequests { + return &RaftMemberAddTooManyRequests{} +} + +/* RaftMemberAddTooManyRequests describes a response with status code 429, with default header values. + +The resource requested is rate limited and the rate limit has been exceeded +*/ +type RaftMemberAddTooManyRequests struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *RaftMemberAddTooManyRequests) Error() string { + return fmt.Sprintf("[POST /raft/add-member][%d] raftMemberAddTooManyRequests %+v", 429, o.Payload) +} +func (o *RaftMemberAddTooManyRequests) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *RaftMemberAddTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/controller/rest_client/raft/raft_member_remove_parameters.go b/controller/rest_client/raft/raft_member_remove_parameters.go new file mode 100644 index 000000000..8d8b3f92d --- /dev/null +++ b/controller/rest_client/raft/raft_member_remove_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// 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" + + "github.com/openziti/ziti/controller/rest_model" +) + +// NewRaftMemberRemoveParams creates a new RaftMemberRemoveParams 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 NewRaftMemberRemoveParams() *RaftMemberRemoveParams { + return &RaftMemberRemoveParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRaftMemberRemoveParamsWithTimeout creates a new RaftMemberRemoveParams object +// with the ability to set a timeout on a request. +func NewRaftMemberRemoveParamsWithTimeout(timeout time.Duration) *RaftMemberRemoveParams { + return &RaftMemberRemoveParams{ + timeout: timeout, + } +} + +// NewRaftMemberRemoveParamsWithContext creates a new RaftMemberRemoveParams object +// with the ability to set a context for a request. +func NewRaftMemberRemoveParamsWithContext(ctx context.Context) *RaftMemberRemoveParams { + return &RaftMemberRemoveParams{ + Context: ctx, + } +} + +// NewRaftMemberRemoveParamsWithHTTPClient creates a new RaftMemberRemoveParams object +// with the ability to set a custom HTTPClient for a request. +func NewRaftMemberRemoveParamsWithHTTPClient(client *http.Client) *RaftMemberRemoveParams { + return &RaftMemberRemoveParams{ + HTTPClient: client, + } +} + +/* RaftMemberRemoveParams contains all the parameters to send to the API endpoint + for the raft member remove operation. + + Typically these are written to a http.Request. +*/ +type RaftMemberRemoveParams struct { + + /* Member. + + member parameters + */ + Member *rest_model.RaftMemberRemove + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the raft member remove params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RaftMemberRemoveParams) WithDefaults() *RaftMemberRemoveParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the raft member remove params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RaftMemberRemoveParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the raft member remove params +func (o *RaftMemberRemoveParams) WithTimeout(timeout time.Duration) *RaftMemberRemoveParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the raft member remove params +func (o *RaftMemberRemoveParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the raft member remove params +func (o *RaftMemberRemoveParams) WithContext(ctx context.Context) *RaftMemberRemoveParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the raft member remove params +func (o *RaftMemberRemoveParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the raft member remove params +func (o *RaftMemberRemoveParams) WithHTTPClient(client *http.Client) *RaftMemberRemoveParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the raft member remove params +func (o *RaftMemberRemoveParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithMember adds the member to the raft member remove params +func (o *RaftMemberRemoveParams) WithMember(member *rest_model.RaftMemberRemove) *RaftMemberRemoveParams { + o.SetMember(member) + return o +} + +// SetMember adds the member to the raft member remove params +func (o *RaftMemberRemoveParams) SetMember(member *rest_model.RaftMemberRemove) { + o.Member = member +} + +// WriteToRequest writes these params to a swagger request +func (o *RaftMemberRemoveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Member != nil { + if err := r.SetBodyParam(o.Member); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/controller/rest_client/raft/raft_member_remove_responses.go b/controller/rest_client/raft/raft_member_remove_responses.go new file mode 100644 index 000000000..c0a578dac --- /dev/null +++ b/controller/rest_client/raft/raft_member_remove_responses.go @@ -0,0 +1,243 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// 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" + + "github.com/openziti/ziti/controller/rest_model" +) + +// RaftMemberRemoveReader is a Reader for the RaftMemberRemove structure. +type RaftMemberRemoveReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RaftMemberRemoveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRaftMemberRemoveOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRaftMemberRemoveBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewRaftMemberRemoveUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRaftMemberRemoveNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 429: + result := NewRaftMemberRemoveTooManyRequests() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewRaftMemberRemoveOK creates a RaftMemberRemoveOK with default headers values +func NewRaftMemberRemoveOK() *RaftMemberRemoveOK { + return &RaftMemberRemoveOK{} +} + +/* RaftMemberRemoveOK describes a response with status code 200, with default header values. + +Base empty response +*/ +type RaftMemberRemoveOK struct { + Payload *rest_model.Empty +} + +func (o *RaftMemberRemoveOK) Error() string { + return fmt.Sprintf("[POST /raft/remove-member][%d] raftMemberRemoveOK %+v", 200, o.Payload) +} +func (o *RaftMemberRemoveOK) GetPayload() *rest_model.Empty { + return o.Payload +} + +func (o *RaftMemberRemoveOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.Empty) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRaftMemberRemoveBadRequest creates a RaftMemberRemoveBadRequest with default headers values +func NewRaftMemberRemoveBadRequest() *RaftMemberRemoveBadRequest { + return &RaftMemberRemoveBadRequest{} +} + +/* RaftMemberRemoveBadRequest describes a response with status code 400, with default header values. + +The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information +*/ +type RaftMemberRemoveBadRequest struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *RaftMemberRemoveBadRequest) Error() string { + return fmt.Sprintf("[POST /raft/remove-member][%d] raftMemberRemoveBadRequest %+v", 400, o.Payload) +} +func (o *RaftMemberRemoveBadRequest) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *RaftMemberRemoveBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRaftMemberRemoveUnauthorized creates a RaftMemberRemoveUnauthorized with default headers values +func NewRaftMemberRemoveUnauthorized() *RaftMemberRemoveUnauthorized { + return &RaftMemberRemoveUnauthorized{} +} + +/* RaftMemberRemoveUnauthorized describes a response with status code 401, with default header values. + +The currently supplied session does not have the correct access rights to request this resource +*/ +type RaftMemberRemoveUnauthorized struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *RaftMemberRemoveUnauthorized) Error() string { + return fmt.Sprintf("[POST /raft/remove-member][%d] raftMemberRemoveUnauthorized %+v", 401, o.Payload) +} +func (o *RaftMemberRemoveUnauthorized) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *RaftMemberRemoveUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRaftMemberRemoveNotFound creates a RaftMemberRemoveNotFound with default headers values +func NewRaftMemberRemoveNotFound() *RaftMemberRemoveNotFound { + return &RaftMemberRemoveNotFound{} +} + +/* RaftMemberRemoveNotFound describes a response with status code 404, with default header values. + +The requested resource does not exist +*/ +type RaftMemberRemoveNotFound struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *RaftMemberRemoveNotFound) Error() string { + return fmt.Sprintf("[POST /raft/remove-member][%d] raftMemberRemoveNotFound %+v", 404, o.Payload) +} +func (o *RaftMemberRemoveNotFound) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *RaftMemberRemoveNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRaftMemberRemoveTooManyRequests creates a RaftMemberRemoveTooManyRequests with default headers values +func NewRaftMemberRemoveTooManyRequests() *RaftMemberRemoveTooManyRequests { + return &RaftMemberRemoveTooManyRequests{} +} + +/* RaftMemberRemoveTooManyRequests describes a response with status code 429, with default header values. + +The resource requested is rate limited and the rate limit has been exceeded +*/ +type RaftMemberRemoveTooManyRequests struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *RaftMemberRemoveTooManyRequests) Error() string { + return fmt.Sprintf("[POST /raft/remove-member][%d] raftMemberRemoveTooManyRequests %+v", 429, o.Payload) +} +func (o *RaftMemberRemoveTooManyRequests) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *RaftMemberRemoveTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/controller/rest_client/raft/raft_tranfer_leadership_parameters.go b/controller/rest_client/raft/raft_tranfer_leadership_parameters.go new file mode 100644 index 000000000..f54fee563 --- /dev/null +++ b/controller/rest_client/raft/raft_tranfer_leadership_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// 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" + + "github.com/openziti/ziti/controller/rest_model" +) + +// NewRaftTranferLeadershipParams creates a new RaftTranferLeadershipParams 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 NewRaftTranferLeadershipParams() *RaftTranferLeadershipParams { + return &RaftTranferLeadershipParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRaftTranferLeadershipParamsWithTimeout creates a new RaftTranferLeadershipParams object +// with the ability to set a timeout on a request. +func NewRaftTranferLeadershipParamsWithTimeout(timeout time.Duration) *RaftTranferLeadershipParams { + return &RaftTranferLeadershipParams{ + timeout: timeout, + } +} + +// NewRaftTranferLeadershipParamsWithContext creates a new RaftTranferLeadershipParams object +// with the ability to set a context for a request. +func NewRaftTranferLeadershipParamsWithContext(ctx context.Context) *RaftTranferLeadershipParams { + return &RaftTranferLeadershipParams{ + Context: ctx, + } +} + +// NewRaftTranferLeadershipParamsWithHTTPClient creates a new RaftTranferLeadershipParams object +// with the ability to set a custom HTTPClient for a request. +func NewRaftTranferLeadershipParamsWithHTTPClient(client *http.Client) *RaftTranferLeadershipParams { + return &RaftTranferLeadershipParams{ + HTTPClient: client, + } +} + +/* RaftTranferLeadershipParams contains all the parameters to send to the API endpoint + for the raft tranfer leadership operation. + + Typically these are written to a http.Request. +*/ +type RaftTranferLeadershipParams struct { + + /* Member. + + transfer operation parameters + */ + Member *rest_model.RaftTransferLeadership + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the raft tranfer leadership params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RaftTranferLeadershipParams) WithDefaults() *RaftTranferLeadershipParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the raft tranfer leadership params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RaftTranferLeadershipParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the raft tranfer leadership params +func (o *RaftTranferLeadershipParams) WithTimeout(timeout time.Duration) *RaftTranferLeadershipParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the raft tranfer leadership params +func (o *RaftTranferLeadershipParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the raft tranfer leadership params +func (o *RaftTranferLeadershipParams) WithContext(ctx context.Context) *RaftTranferLeadershipParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the raft tranfer leadership params +func (o *RaftTranferLeadershipParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the raft tranfer leadership params +func (o *RaftTranferLeadershipParams) WithHTTPClient(client *http.Client) *RaftTranferLeadershipParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the raft tranfer leadership params +func (o *RaftTranferLeadershipParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithMember adds the member to the raft tranfer leadership params +func (o *RaftTranferLeadershipParams) WithMember(member *rest_model.RaftTransferLeadership) *RaftTranferLeadershipParams { + o.SetMember(member) + return o +} + +// SetMember adds the member to the raft tranfer leadership params +func (o *RaftTranferLeadershipParams) SetMember(member *rest_model.RaftTransferLeadership) { + o.Member = member +} + +// WriteToRequest writes these params to a swagger request +func (o *RaftTranferLeadershipParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Member != nil { + if err := r.SetBodyParam(o.Member); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/controller/rest_client/raft/raft_tranfer_leadership_responses.go b/controller/rest_client/raft/raft_tranfer_leadership_responses.go new file mode 100644 index 000000000..f1a19b079 --- /dev/null +++ b/controller/rest_client/raft/raft_tranfer_leadership_responses.go @@ -0,0 +1,243 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// 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" + + "github.com/openziti/ziti/controller/rest_model" +) + +// RaftTranferLeadershipReader is a Reader for the RaftTranferLeadership structure. +type RaftTranferLeadershipReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RaftTranferLeadershipReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRaftTranferLeadershipOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewRaftTranferLeadershipUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRaftTranferLeadershipNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 429: + result := NewRaftTranferLeadershipTooManyRequests() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewRaftTranferLeadershipInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewRaftTranferLeadershipOK creates a RaftTranferLeadershipOK with default headers values +func NewRaftTranferLeadershipOK() *RaftTranferLeadershipOK { + return &RaftTranferLeadershipOK{} +} + +/* RaftTranferLeadershipOK describes a response with status code 200, with default header values. + +Base empty response +*/ +type RaftTranferLeadershipOK struct { + Payload *rest_model.Empty +} + +func (o *RaftTranferLeadershipOK) Error() string { + return fmt.Sprintf("[POST /raft/transfer-leadership][%d] raftTranferLeadershipOK %+v", 200, o.Payload) +} +func (o *RaftTranferLeadershipOK) GetPayload() *rest_model.Empty { + return o.Payload +} + +func (o *RaftTranferLeadershipOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.Empty) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRaftTranferLeadershipUnauthorized creates a RaftTranferLeadershipUnauthorized with default headers values +func NewRaftTranferLeadershipUnauthorized() *RaftTranferLeadershipUnauthorized { + return &RaftTranferLeadershipUnauthorized{} +} + +/* RaftTranferLeadershipUnauthorized describes a response with status code 401, with default header values. + +The currently supplied session does not have the correct access rights to request this resource +*/ +type RaftTranferLeadershipUnauthorized struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *RaftTranferLeadershipUnauthorized) Error() string { + return fmt.Sprintf("[POST /raft/transfer-leadership][%d] raftTranferLeadershipUnauthorized %+v", 401, o.Payload) +} +func (o *RaftTranferLeadershipUnauthorized) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *RaftTranferLeadershipUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRaftTranferLeadershipNotFound creates a RaftTranferLeadershipNotFound with default headers values +func NewRaftTranferLeadershipNotFound() *RaftTranferLeadershipNotFound { + return &RaftTranferLeadershipNotFound{} +} + +/* RaftTranferLeadershipNotFound describes a response with status code 404, with default header values. + +The requested resource does not exist +*/ +type RaftTranferLeadershipNotFound struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *RaftTranferLeadershipNotFound) Error() string { + return fmt.Sprintf("[POST /raft/transfer-leadership][%d] raftTranferLeadershipNotFound %+v", 404, o.Payload) +} +func (o *RaftTranferLeadershipNotFound) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *RaftTranferLeadershipNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRaftTranferLeadershipTooManyRequests creates a RaftTranferLeadershipTooManyRequests with default headers values +func NewRaftTranferLeadershipTooManyRequests() *RaftTranferLeadershipTooManyRequests { + return &RaftTranferLeadershipTooManyRequests{} +} + +/* RaftTranferLeadershipTooManyRequests describes a response with status code 429, with default header values. + +The resource requested is rate limited and the rate limit has been exceeded +*/ +type RaftTranferLeadershipTooManyRequests struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *RaftTranferLeadershipTooManyRequests) Error() string { + return fmt.Sprintf("[POST /raft/transfer-leadership][%d] raftTranferLeadershipTooManyRequests %+v", 429, o.Payload) +} +func (o *RaftTranferLeadershipTooManyRequests) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *RaftTranferLeadershipTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRaftTranferLeadershipInternalServerError creates a RaftTranferLeadershipInternalServerError with default headers values +func NewRaftTranferLeadershipInternalServerError() *RaftTranferLeadershipInternalServerError { + return &RaftTranferLeadershipInternalServerError{} +} + +/* RaftTranferLeadershipInternalServerError describes a response with status code 500, with default header values. + +The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information +*/ +type RaftTranferLeadershipInternalServerError struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *RaftTranferLeadershipInternalServerError) Error() string { + return fmt.Sprintf("[POST /raft/transfer-leadership][%d] raftTranferLeadershipInternalServerError %+v", 500, o.Payload) +} +func (o *RaftTranferLeadershipInternalServerError) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *RaftTranferLeadershipInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/controller/rest_model/raft_member_add.go b/controller/rest_model/raft_member_add.go new file mode 100644 index 000000000..70244ac7f --- /dev/null +++ b/controller/rest_model/raft_member_add.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package rest_model + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// RaftMemberAdd raft member add +// +// swagger:model raftMemberAdd +type RaftMemberAdd struct { + + // address + // Required: true + Address *string `json:"address"` + + // is voter + // Required: true + IsVoter *bool `json:"isVoter"` +} + +// Validate validates this raft member add +func (m *RaftMemberAdd) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIsVoter(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RaftMemberAdd) validateAddress(formats strfmt.Registry) error { + + if err := validate.Required("address", "body", m.Address); err != nil { + return err + } + + return nil +} + +func (m *RaftMemberAdd) validateIsVoter(formats strfmt.Registry) error { + + if err := validate.Required("isVoter", "body", m.IsVoter); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this raft member add based on context it is used +func (m *RaftMemberAdd) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *RaftMemberAdd) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RaftMemberAdd) UnmarshalBinary(b []byte) error { + var res RaftMemberAdd + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/controller/rest_model/raft_member_remove.go b/controller/rest_model/raft_member_remove.go new file mode 100644 index 000000000..cabf83ab3 --- /dev/null +++ b/controller/rest_model/raft_member_remove.go @@ -0,0 +1,95 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package rest_model + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// RaftMemberRemove raft member remove +// +// swagger:model raftMemberRemove +type RaftMemberRemove struct { + + // id + // Required: true + ID *string `json:"id"` +} + +// Validate validates this raft member remove +func (m *RaftMemberRemove) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RaftMemberRemove) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this raft member remove based on context it is used +func (m *RaftMemberRemove) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *RaftMemberRemove) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RaftMemberRemove) UnmarshalBinary(b []byte) error { + var res RaftMemberRemove + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/controller/rest_model/raft_transfer_leadership.go b/controller/rest_model/raft_transfer_leadership.go new file mode 100644 index 000000000..eb65737ad --- /dev/null +++ b/controller/rest_model/raft_transfer_leadership.go @@ -0,0 +1,74 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package rest_model + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// RaftTransferLeadership raft transfer leadership +// +// swagger:model raftTransferLeadership +type RaftTransferLeadership struct { + + // new leader Id + NewLeaderID string `json:"newLeaderId,omitempty"` +} + +// Validate validates this raft transfer leadership +func (m *RaftTransferLeadership) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this raft transfer leadership based on context it is used +func (m *RaftTransferLeadership) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *RaftTransferLeadership) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RaftTransferLeadership) UnmarshalBinary(b []byte) error { + var res RaftTransferLeadership + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/controller/rest_server/configure_ziti_fabric.go b/controller/rest_server/configure_ziti_fabric.go index 826ae8d2d..134c883ec 100644 --- a/controller/rest_server/configure_ziti_fabric.go +++ b/controller/rest_server/configure_ziti_fabric.go @@ -224,6 +224,21 @@ func configureAPI(api *operations.ZitiFabricAPI) http.Handler { return middleware.NotImplemented("operation raft.RaftListMembers has not yet been implemented") }) } + if api.RaftRaftMemberAddHandler == nil { + api.RaftRaftMemberAddHandler = raft.RaftMemberAddHandlerFunc(func(params raft.RaftMemberAddParams) middleware.Responder { + return middleware.NotImplemented("operation raft.RaftMemberAdd has not yet been implemented") + }) + } + if api.RaftRaftMemberRemoveHandler == nil { + api.RaftRaftMemberRemoveHandler = raft.RaftMemberRemoveHandlerFunc(func(params raft.RaftMemberRemoveParams) middleware.Responder { + return middleware.NotImplemented("operation raft.RaftMemberRemove has not yet been implemented") + }) + } + if api.RaftRaftTranferLeadershipHandler == nil { + api.RaftRaftTranferLeadershipHandler = raft.RaftTranferLeadershipHandlerFunc(func(params raft.RaftTranferLeadershipParams) middleware.Responder { + return middleware.NotImplemented("operation raft.RaftTranferLeadership has not yet been implemented") + }) + } if api.RouterUpdateRouterHandler == nil { api.RouterUpdateRouterHandler = router.UpdateRouterHandlerFunc(func(params router.UpdateRouterParams) middleware.Responder { return middleware.NotImplemented("operation router.UpdateRouter has not yet been implemented") diff --git a/controller/rest_server/embedded_spec.go b/controller/rest_server/embedded_spec.go index 722c503ba..23bddce72 100644 --- a/controller/rest_server/embedded_spec.go +++ b/controller/rest_server/embedded_spec.go @@ -452,6 +452,41 @@ func init() { } ] }, + "/raft/add-member": { + "post": { + "description": "Add a member to the raft cluster. Requires admin access.", + "tags": [ + "Raft" + ], + "summary": "Add a member to the raft cluster", + "operationId": "raftMemberAdd", + "parameters": [ + { + "description": "member parameters", + "name": "member", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/raftMemberAdd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/emptyResponse" + }, + "400": { + "$ref": "#/responses/badRequestResponse" + }, + "401": { + "$ref": "#/responses/unauthorizedResponse" + }, + "429": { + "$ref": "#/responses/rateLimitedResponse" + } + } + } + }, "/raft/list-members": { "get": { "description": "Returns all members of a cluster and their current status", @@ -464,6 +499,9 @@ func init() { "200": { "$ref": "#/responses/raftListMembersResponse" }, + "400": { + "$ref": "#/responses/badRequestResponse" + }, "401": { "$ref": "#/responses/unauthorizedResponse" }, @@ -473,6 +511,82 @@ func init() { } } }, + "/raft/remove-member": { + "post": { + "description": "Remove a member from the raft cluster. Requires admin access.", + "tags": [ + "Raft" + ], + "summary": "Remove a member from the raft cluster", + "operationId": "raftMemberRemove", + "parameters": [ + { + "description": "member parameters", + "name": "member", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/raftMemberRemove" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/emptyResponse" + }, + "400": { + "$ref": "#/responses/badRequestResponse" + }, + "401": { + "$ref": "#/responses/unauthorizedResponse" + }, + "404": { + "$ref": "#/responses/notFoundResponse" + }, + "429": { + "$ref": "#/responses/rateLimitedResponse" + } + } + } + }, + "/raft/transfer-leadership": { + "post": { + "description": "Attempts to transfer leadership to a different member of the cluster. Requires admin access.", + "tags": [ + "Raft" + ], + "summary": "Attempts to transfer leadership to a different member of the cluster", + "operationId": "raftTranferLeadership", + "parameters": [ + { + "description": "transfer operation parameters", + "name": "member", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/raftTransferLeadership" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/emptyResponse" + }, + "401": { + "$ref": "#/responses/unauthorizedResponse" + }, + "404": { + "$ref": "#/responses/notFoundResponse" + }, + "429": { + "$ref": "#/responses/rateLimitedResponse" + }, + "500": { + "$ref": "#/responses/badRequestResponse" + } + } + } + }, "/routers": { "get": { "description": "Retrieves a list of router resources; supports filtering, sorting, and pagination. Requires admin access.\n", @@ -1810,6 +1924,21 @@ func init() { } } }, + "raftMemberAdd": { + "type": "object", + "required": [ + "address", + "isVoter" + ], + "properties": { + "address": { + "type": "string" + }, + "isVoter": { + "type": "boolean" + } + } + }, "raftMemberListRequest": { "type": "object" }, @@ -1855,6 +1984,25 @@ func init() { } } }, + "raftMemberRemove": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + } + } + }, + "raftTransferLeadership": { + "type": "object", + "properties": { + "newLeaderId": { + "type": "string" + } + } + }, "routerCreate": { "type": "object", "required": [ @@ -3824,19 +3972,67 @@ func init() { } ] }, - "/raft/list-members": { - "get": { - "description": "Returns all members of a cluster and their current status", + "/raft/add-member": { + "post": { + "description": "Add a member to the raft cluster. Requires admin access.", "tags": [ "Raft" ], - "summary": "Returns all members of a cluster and their current status", - "operationId": "raftListMembers", + "summary": "Add a member to the raft cluster", + "operationId": "raftMemberAdd", + "parameters": [ + { + "description": "member parameters", + "name": "member", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/raftMemberAdd" + } + } + ], "responses": { "200": { - "description": "A response to a raft list-members request", + "description": "Base empty response", "schema": { - "$ref": "#/definitions/raftMemberListResponse" + "$ref": "#/definitions/empty" + } + }, + "400": { + "description": "The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": { + "details": { + "context": "(root)", + "field": "(root)", + "property": "fooField3" + }, + "field": "(root)", + "message": "(root): fooField3 is required", + "type": "required", + "value": { + "fooField": "abc", + "fooField2": "def" + } + }, + "causeMessage": "schema validation failed", + "code": "COULD_NOT_VALIDATE", + "message": "The supplied request contains an invalid document", + "requestId": "ac6766d6-3a09-44b3-8d8a-1b541d97fdd9" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } } }, "401": { @@ -3889,6 +4085,386 @@ func init() { } } }, + "/raft/list-members": { + "get": { + "description": "Returns all members of a cluster and their current status", + "tags": [ + "Raft" + ], + "summary": "Returns all members of a cluster and their current status", + "operationId": "raftListMembers", + "responses": { + "200": { + "description": "A response to a raft list-members request", + "schema": { + "$ref": "#/definitions/raftMemberListResponse" + } + }, + "400": { + "description": "The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": { + "details": { + "context": "(root)", + "field": "(root)", + "property": "fooField3" + }, + "field": "(root)", + "message": "(root): fooField3 is required", + "type": "required", + "value": { + "fooField": "abc", + "fooField2": "def" + } + }, + "causeMessage": "schema validation failed", + "code": "COULD_NOT_VALIDATE", + "message": "The supplied request contains an invalid document", + "requestId": "ac6766d6-3a09-44b3-8d8a-1b541d97fdd9" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "401": { + "description": "The currently supplied session does not have the correct access rights to request this resource", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": "", + "causeMessage": "", + "code": "UNAUTHORIZED", + "message": "The request could not be completed. The session is not authorized or the credentials are invalid", + "requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "429": { + "description": "The resource requested is rate limited and the rate limit has been exceeded", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "causeMessage": "you have hit a rate limit in the requested operation", + "code": "RATE_LIMITED", + "message": "The resource is rate limited and the rate limit has been exceeded. Please try again later", + "requestId": "270908d6-f2ef-4577-b973-67bec18ae376" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + } + } + } + }, + "/raft/remove-member": { + "post": { + "description": "Remove a member from the raft cluster. Requires admin access.", + "tags": [ + "Raft" + ], + "summary": "Remove a member from the raft cluster", + "operationId": "raftMemberRemove", + "parameters": [ + { + "description": "member parameters", + "name": "member", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/raftMemberRemove" + } + } + ], + "responses": { + "200": { + "description": "Base empty response", + "schema": { + "$ref": "#/definitions/empty" + } + }, + "400": { + "description": "The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": { + "details": { + "context": "(root)", + "field": "(root)", + "property": "fooField3" + }, + "field": "(root)", + "message": "(root): fooField3 is required", + "type": "required", + "value": { + "fooField": "abc", + "fooField2": "def" + } + }, + "causeMessage": "schema validation failed", + "code": "COULD_NOT_VALIDATE", + "message": "The supplied request contains an invalid document", + "requestId": "ac6766d6-3a09-44b3-8d8a-1b541d97fdd9" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "401": { + "description": "The currently supplied session does not have the correct access rights to request this resource", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": "", + "causeMessage": "", + "code": "UNAUTHORIZED", + "message": "The request could not be completed. The session is not authorized or the credentials are invalid", + "requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "404": { + "description": "The requested resource does not exist", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": { + "id": "71a3000f-7dda-491a-9b90-a19f4ee6c406" + } + }, + "cause": null, + "causeMessage": "", + "code": "NOT_FOUND", + "message": "The resource requested was not found or is no longer available", + "requestId": "270908d6-f2ef-4577-b973-67bec18ae376" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "429": { + "description": "The resource requested is rate limited and the rate limit has been exceeded", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "causeMessage": "you have hit a rate limit in the requested operation", + "code": "RATE_LIMITED", + "message": "The resource is rate limited and the rate limit has been exceeded. Please try again later", + "requestId": "270908d6-f2ef-4577-b973-67bec18ae376" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + } + } + } + }, + "/raft/transfer-leadership": { + "post": { + "description": "Attempts to transfer leadership to a different member of the cluster. Requires admin access.", + "tags": [ + "Raft" + ], + "summary": "Attempts to transfer leadership to a different member of the cluster", + "operationId": "raftTranferLeadership", + "parameters": [ + { + "description": "transfer operation parameters", + "name": "member", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/raftTransferLeadership" + } + } + ], + "responses": { + "200": { + "description": "Base empty response", + "schema": { + "$ref": "#/definitions/empty" + } + }, + "401": { + "description": "The currently supplied session does not have the correct access rights to request this resource", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": "", + "causeMessage": "", + "code": "UNAUTHORIZED", + "message": "The request could not be completed. The session is not authorized or the credentials are invalid", + "requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "404": { + "description": "The requested resource does not exist", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": { + "id": "71a3000f-7dda-491a-9b90-a19f4ee6c406" + } + }, + "cause": null, + "causeMessage": "", + "code": "NOT_FOUND", + "message": "The resource requested was not found or is no longer available", + "requestId": "270908d6-f2ef-4577-b973-67bec18ae376" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "429": { + "description": "The resource requested is rate limited and the rate limit has been exceeded", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "causeMessage": "you have hit a rate limit in the requested operation", + "code": "RATE_LIMITED", + "message": "The resource is rate limited and the rate limit has been exceeded. Please try again later", + "requestId": "270908d6-f2ef-4577-b973-67bec18ae376" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "500": { + "description": "The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": { + "details": { + "context": "(root)", + "field": "(root)", + "property": "fooField3" + }, + "field": "(root)", + "message": "(root): fooField3 is required", + "type": "required", + "value": { + "fooField": "abc", + "fooField2": "def" + } + }, + "causeMessage": "schema validation failed", + "code": "COULD_NOT_VALIDATE", + "message": "The supplied request contains an invalid document", + "requestId": "ac6766d6-3a09-44b3-8d8a-1b541d97fdd9" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + } + } + } + }, "/routers": { "get": { "description": "Retrieves a list of router resources; supports filtering, sorting, and pagination. Requires admin access.\n", @@ -6939,6 +7515,21 @@ func init() { } } }, + "raftMemberAdd": { + "type": "object", + "required": [ + "address", + "isVoter" + ], + "properties": { + "address": { + "type": "string" + }, + "isVoter": { + "type": "boolean" + } + } + }, "raftMemberListRequest": { "type": "object" }, @@ -6984,6 +7575,25 @@ func init() { } } }, + "raftMemberRemove": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + } + } + }, + "raftTransferLeadership": { + "type": "object", + "properties": { + "newLeaderId": { + "type": "string" + } + } + }, "routerCreate": { "type": "object", "required": [ diff --git a/controller/rest_server/operations/raft/raft_list_members_responses.go b/controller/rest_server/operations/raft/raft_list_members_responses.go index 53822fd85..e31a7bcc1 100644 --- a/controller/rest_server/operations/raft/raft_list_members_responses.go +++ b/controller/rest_server/operations/raft/raft_list_members_responses.go @@ -81,6 +81,50 @@ func (o *RaftListMembersOK) WriteResponse(rw http.ResponseWriter, producer runti } } +// RaftListMembersBadRequestCode is the HTTP code returned for type RaftListMembersBadRequest +const RaftListMembersBadRequestCode int = 400 + +/*RaftListMembersBadRequest The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information + +swagger:response raftListMembersBadRequest +*/ +type RaftListMembersBadRequest struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewRaftListMembersBadRequest creates RaftListMembersBadRequest with default headers values +func NewRaftListMembersBadRequest() *RaftListMembersBadRequest { + + return &RaftListMembersBadRequest{} +} + +// WithPayload adds the payload to the raft list members bad request response +func (o *RaftListMembersBadRequest) WithPayload(payload *rest_model.APIErrorEnvelope) *RaftListMembersBadRequest { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft list members bad request response +func (o *RaftListMembersBadRequest) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftListMembersBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(400) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + // RaftListMembersUnauthorizedCode is the HTTP code returned for type RaftListMembersUnauthorized const RaftListMembersUnauthorizedCode int = 401 diff --git a/controller/rest_server/operations/raft/raft_member_add.go b/controller/rest_server/operations/raft/raft_member_add.go new file mode 100644 index 000000000..e4761951b --- /dev/null +++ b/controller/rest_server/operations/raft/raft_member_add.go @@ -0,0 +1,82 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" +) + +// RaftMemberAddHandlerFunc turns a function with the right signature into a raft member add handler +type RaftMemberAddHandlerFunc func(RaftMemberAddParams) middleware.Responder + +// Handle executing the request and returning a response +func (fn RaftMemberAddHandlerFunc) Handle(params RaftMemberAddParams) middleware.Responder { + return fn(params) +} + +// RaftMemberAddHandler interface for that can handle valid raft member add params +type RaftMemberAddHandler interface { + Handle(RaftMemberAddParams) middleware.Responder +} + +// NewRaftMemberAdd creates a new http.Handler for the raft member add operation +func NewRaftMemberAdd(ctx *middleware.Context, handler RaftMemberAddHandler) *RaftMemberAdd { + return &RaftMemberAdd{Context: ctx, Handler: handler} +} + +/* RaftMemberAdd swagger:route POST /raft/add-member Raft raftMemberAdd + +Add a member to the raft cluster + +Add a member to the raft cluster. Requires admin access. + +*/ +type RaftMemberAdd struct { + Context *middleware.Context + Handler RaftMemberAddHandler +} + +func (o *RaftMemberAdd) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewRaftMemberAddParams() + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/controller/rest_server/operations/raft/raft_member_add_parameters.go b/controller/rest_server/operations/raft/raft_member_add_parameters.go new file mode 100644 index 000000000..d9db645d2 --- /dev/null +++ b/controller/rest_server/operations/raft/raft_member_add_parameters.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "io" + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" + + "github.com/openziti/ziti/controller/rest_model" +) + +// NewRaftMemberAddParams creates a new RaftMemberAddParams object +// +// There are no default values defined in the spec. +func NewRaftMemberAddParams() RaftMemberAddParams { + + return RaftMemberAddParams{} +} + +// RaftMemberAddParams contains all the bound params for the raft member add operation +// typically these are obtained from a http.Request +// +// swagger:parameters raftMemberAdd +type RaftMemberAddParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*member parameters + Required: true + In: body + */ + Member *rest_model.RaftMemberAdd +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewRaftMemberAddParams() beforehand. +func (o *RaftMemberAddParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + if runtime.HasBody(r) { + defer r.Body.Close() + var body rest_model.RaftMemberAdd + if err := route.Consumer.Consume(r.Body, &body); err != nil { + if err == io.EOF { + res = append(res, errors.Required("member", "body", "")) + } else { + res = append(res, errors.NewParseError("member", "body", "", err)) + } + } else { + // validate body object + if err := body.Validate(route.Formats); err != nil { + res = append(res, err) + } + + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + + if len(res) == 0 { + o.Member = &body + } + } + } else { + res = append(res, errors.Required("member", "body", "")) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/controller/rest_server/operations/raft/raft_member_add_responses.go b/controller/rest_server/operations/raft/raft_member_add_responses.go new file mode 100644 index 000000000..847454bac --- /dev/null +++ b/controller/rest_server/operations/raft/raft_member_add_responses.go @@ -0,0 +1,214 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/openziti/ziti/controller/rest_model" +) + +// RaftMemberAddOKCode is the HTTP code returned for type RaftMemberAddOK +const RaftMemberAddOKCode int = 200 + +/*RaftMemberAddOK Base empty response + +swagger:response raftMemberAddOK +*/ +type RaftMemberAddOK struct { + + /* + In: Body + */ + Payload *rest_model.Empty `json:"body,omitempty"` +} + +// NewRaftMemberAddOK creates RaftMemberAddOK with default headers values +func NewRaftMemberAddOK() *RaftMemberAddOK { + + return &RaftMemberAddOK{} +} + +// WithPayload adds the payload to the raft member add o k response +func (o *RaftMemberAddOK) WithPayload(payload *rest_model.Empty) *RaftMemberAddOK { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft member add o k response +func (o *RaftMemberAddOK) SetPayload(payload *rest_model.Empty) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftMemberAddOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(200) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// RaftMemberAddBadRequestCode is the HTTP code returned for type RaftMemberAddBadRequest +const RaftMemberAddBadRequestCode int = 400 + +/*RaftMemberAddBadRequest The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information + +swagger:response raftMemberAddBadRequest +*/ +type RaftMemberAddBadRequest struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewRaftMemberAddBadRequest creates RaftMemberAddBadRequest with default headers values +func NewRaftMemberAddBadRequest() *RaftMemberAddBadRequest { + + return &RaftMemberAddBadRequest{} +} + +// WithPayload adds the payload to the raft member add bad request response +func (o *RaftMemberAddBadRequest) WithPayload(payload *rest_model.APIErrorEnvelope) *RaftMemberAddBadRequest { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft member add bad request response +func (o *RaftMemberAddBadRequest) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftMemberAddBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(400) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// RaftMemberAddUnauthorizedCode is the HTTP code returned for type RaftMemberAddUnauthorized +const RaftMemberAddUnauthorizedCode int = 401 + +/*RaftMemberAddUnauthorized The currently supplied session does not have the correct access rights to request this resource + +swagger:response raftMemberAddUnauthorized +*/ +type RaftMemberAddUnauthorized struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewRaftMemberAddUnauthorized creates RaftMemberAddUnauthorized with default headers values +func NewRaftMemberAddUnauthorized() *RaftMemberAddUnauthorized { + + return &RaftMemberAddUnauthorized{} +} + +// WithPayload adds the payload to the raft member add unauthorized response +func (o *RaftMemberAddUnauthorized) WithPayload(payload *rest_model.APIErrorEnvelope) *RaftMemberAddUnauthorized { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft member add unauthorized response +func (o *RaftMemberAddUnauthorized) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftMemberAddUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(401) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// RaftMemberAddTooManyRequestsCode is the HTTP code returned for type RaftMemberAddTooManyRequests +const RaftMemberAddTooManyRequestsCode int = 429 + +/*RaftMemberAddTooManyRequests The resource requested is rate limited and the rate limit has been exceeded + +swagger:response raftMemberAddTooManyRequests +*/ +type RaftMemberAddTooManyRequests struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewRaftMemberAddTooManyRequests creates RaftMemberAddTooManyRequests with default headers values +func NewRaftMemberAddTooManyRequests() *RaftMemberAddTooManyRequests { + + return &RaftMemberAddTooManyRequests{} +} + +// WithPayload adds the payload to the raft member add too many requests response +func (o *RaftMemberAddTooManyRequests) WithPayload(payload *rest_model.APIErrorEnvelope) *RaftMemberAddTooManyRequests { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft member add too many requests response +func (o *RaftMemberAddTooManyRequests) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftMemberAddTooManyRequests) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(429) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/controller/rest_server/operations/raft/raft_member_add_urlbuilder.go b/controller/rest_server/operations/raft/raft_member_add_urlbuilder.go new file mode 100644 index 000000000..7de7c7b4b --- /dev/null +++ b/controller/rest_server/operations/raft/raft_member_add_urlbuilder.go @@ -0,0 +1,111 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" +) + +// RaftMemberAddURL generates an URL for the raft member add operation +type RaftMemberAddURL struct { + _basePath string +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *RaftMemberAddURL) WithBasePath(bp string) *RaftMemberAddURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *RaftMemberAddURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *RaftMemberAddURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/raft/add-member" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/fabric/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *RaftMemberAddURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *RaftMemberAddURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *RaftMemberAddURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on RaftMemberAddURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on RaftMemberAddURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *RaftMemberAddURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/controller/rest_server/operations/raft/raft_member_remove.go b/controller/rest_server/operations/raft/raft_member_remove.go new file mode 100644 index 000000000..2f69617ce --- /dev/null +++ b/controller/rest_server/operations/raft/raft_member_remove.go @@ -0,0 +1,82 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" +) + +// RaftMemberRemoveHandlerFunc turns a function with the right signature into a raft member remove handler +type RaftMemberRemoveHandlerFunc func(RaftMemberRemoveParams) middleware.Responder + +// Handle executing the request and returning a response +func (fn RaftMemberRemoveHandlerFunc) Handle(params RaftMemberRemoveParams) middleware.Responder { + return fn(params) +} + +// RaftMemberRemoveHandler interface for that can handle valid raft member remove params +type RaftMemberRemoveHandler interface { + Handle(RaftMemberRemoveParams) middleware.Responder +} + +// NewRaftMemberRemove creates a new http.Handler for the raft member remove operation +func NewRaftMemberRemove(ctx *middleware.Context, handler RaftMemberRemoveHandler) *RaftMemberRemove { + return &RaftMemberRemove{Context: ctx, Handler: handler} +} + +/* RaftMemberRemove swagger:route POST /raft/remove-member Raft raftMemberRemove + +Remove a member from the raft cluster + +Remove a member from the raft cluster. Requires admin access. + +*/ +type RaftMemberRemove struct { + Context *middleware.Context + Handler RaftMemberRemoveHandler +} + +func (o *RaftMemberRemove) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewRaftMemberRemoveParams() + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/controller/rest_server/operations/raft/raft_member_remove_parameters.go b/controller/rest_server/operations/raft/raft_member_remove_parameters.go new file mode 100644 index 000000000..ad78fb755 --- /dev/null +++ b/controller/rest_server/operations/raft/raft_member_remove_parameters.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "io" + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" + + "github.com/openziti/ziti/controller/rest_model" +) + +// NewRaftMemberRemoveParams creates a new RaftMemberRemoveParams object +// +// There are no default values defined in the spec. +func NewRaftMemberRemoveParams() RaftMemberRemoveParams { + + return RaftMemberRemoveParams{} +} + +// RaftMemberRemoveParams contains all the bound params for the raft member remove operation +// typically these are obtained from a http.Request +// +// swagger:parameters raftMemberRemove +type RaftMemberRemoveParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*member parameters + Required: true + In: body + */ + Member *rest_model.RaftMemberRemove +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewRaftMemberRemoveParams() beforehand. +func (o *RaftMemberRemoveParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + if runtime.HasBody(r) { + defer r.Body.Close() + var body rest_model.RaftMemberRemove + if err := route.Consumer.Consume(r.Body, &body); err != nil { + if err == io.EOF { + res = append(res, errors.Required("member", "body", "")) + } else { + res = append(res, errors.NewParseError("member", "body", "", err)) + } + } else { + // validate body object + if err := body.Validate(route.Formats); err != nil { + res = append(res, err) + } + + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + + if len(res) == 0 { + o.Member = &body + } + } + } else { + res = append(res, errors.Required("member", "body", "")) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/controller/rest_server/operations/raft/raft_member_remove_responses.go b/controller/rest_server/operations/raft/raft_member_remove_responses.go new file mode 100644 index 000000000..5b48e9423 --- /dev/null +++ b/controller/rest_server/operations/raft/raft_member_remove_responses.go @@ -0,0 +1,258 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/openziti/ziti/controller/rest_model" +) + +// RaftMemberRemoveOKCode is the HTTP code returned for type RaftMemberRemoveOK +const RaftMemberRemoveOKCode int = 200 + +/*RaftMemberRemoveOK Base empty response + +swagger:response raftMemberRemoveOK +*/ +type RaftMemberRemoveOK struct { + + /* + In: Body + */ + Payload *rest_model.Empty `json:"body,omitempty"` +} + +// NewRaftMemberRemoveOK creates RaftMemberRemoveOK with default headers values +func NewRaftMemberRemoveOK() *RaftMemberRemoveOK { + + return &RaftMemberRemoveOK{} +} + +// WithPayload adds the payload to the raft member remove o k response +func (o *RaftMemberRemoveOK) WithPayload(payload *rest_model.Empty) *RaftMemberRemoveOK { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft member remove o k response +func (o *RaftMemberRemoveOK) SetPayload(payload *rest_model.Empty) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftMemberRemoveOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(200) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// RaftMemberRemoveBadRequestCode is the HTTP code returned for type RaftMemberRemoveBadRequest +const RaftMemberRemoveBadRequestCode int = 400 + +/*RaftMemberRemoveBadRequest The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information + +swagger:response raftMemberRemoveBadRequest +*/ +type RaftMemberRemoveBadRequest struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewRaftMemberRemoveBadRequest creates RaftMemberRemoveBadRequest with default headers values +func NewRaftMemberRemoveBadRequest() *RaftMemberRemoveBadRequest { + + return &RaftMemberRemoveBadRequest{} +} + +// WithPayload adds the payload to the raft member remove bad request response +func (o *RaftMemberRemoveBadRequest) WithPayload(payload *rest_model.APIErrorEnvelope) *RaftMemberRemoveBadRequest { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft member remove bad request response +func (o *RaftMemberRemoveBadRequest) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftMemberRemoveBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(400) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// RaftMemberRemoveUnauthorizedCode is the HTTP code returned for type RaftMemberRemoveUnauthorized +const RaftMemberRemoveUnauthorizedCode int = 401 + +/*RaftMemberRemoveUnauthorized The currently supplied session does not have the correct access rights to request this resource + +swagger:response raftMemberRemoveUnauthorized +*/ +type RaftMemberRemoveUnauthorized struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewRaftMemberRemoveUnauthorized creates RaftMemberRemoveUnauthorized with default headers values +func NewRaftMemberRemoveUnauthorized() *RaftMemberRemoveUnauthorized { + + return &RaftMemberRemoveUnauthorized{} +} + +// WithPayload adds the payload to the raft member remove unauthorized response +func (o *RaftMemberRemoveUnauthorized) WithPayload(payload *rest_model.APIErrorEnvelope) *RaftMemberRemoveUnauthorized { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft member remove unauthorized response +func (o *RaftMemberRemoveUnauthorized) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftMemberRemoveUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(401) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// RaftMemberRemoveNotFoundCode is the HTTP code returned for type RaftMemberRemoveNotFound +const RaftMemberRemoveNotFoundCode int = 404 + +/*RaftMemberRemoveNotFound The requested resource does not exist + +swagger:response raftMemberRemoveNotFound +*/ +type RaftMemberRemoveNotFound struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewRaftMemberRemoveNotFound creates RaftMemberRemoveNotFound with default headers values +func NewRaftMemberRemoveNotFound() *RaftMemberRemoveNotFound { + + return &RaftMemberRemoveNotFound{} +} + +// WithPayload adds the payload to the raft member remove not found response +func (o *RaftMemberRemoveNotFound) WithPayload(payload *rest_model.APIErrorEnvelope) *RaftMemberRemoveNotFound { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft member remove not found response +func (o *RaftMemberRemoveNotFound) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftMemberRemoveNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(404) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// RaftMemberRemoveTooManyRequestsCode is the HTTP code returned for type RaftMemberRemoveTooManyRequests +const RaftMemberRemoveTooManyRequestsCode int = 429 + +/*RaftMemberRemoveTooManyRequests The resource requested is rate limited and the rate limit has been exceeded + +swagger:response raftMemberRemoveTooManyRequests +*/ +type RaftMemberRemoveTooManyRequests struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewRaftMemberRemoveTooManyRequests creates RaftMemberRemoveTooManyRequests with default headers values +func NewRaftMemberRemoveTooManyRequests() *RaftMemberRemoveTooManyRequests { + + return &RaftMemberRemoveTooManyRequests{} +} + +// WithPayload adds the payload to the raft member remove too many requests response +func (o *RaftMemberRemoveTooManyRequests) WithPayload(payload *rest_model.APIErrorEnvelope) *RaftMemberRemoveTooManyRequests { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft member remove too many requests response +func (o *RaftMemberRemoveTooManyRequests) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftMemberRemoveTooManyRequests) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(429) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/controller/rest_server/operations/raft/raft_member_remove_urlbuilder.go b/controller/rest_server/operations/raft/raft_member_remove_urlbuilder.go new file mode 100644 index 000000000..18f8046b6 --- /dev/null +++ b/controller/rest_server/operations/raft/raft_member_remove_urlbuilder.go @@ -0,0 +1,111 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" +) + +// RaftMemberRemoveURL generates an URL for the raft member remove operation +type RaftMemberRemoveURL struct { + _basePath string +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *RaftMemberRemoveURL) WithBasePath(bp string) *RaftMemberRemoveURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *RaftMemberRemoveURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *RaftMemberRemoveURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/raft/remove-member" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/fabric/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *RaftMemberRemoveURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *RaftMemberRemoveURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *RaftMemberRemoveURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on RaftMemberRemoveURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on RaftMemberRemoveURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *RaftMemberRemoveURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/controller/rest_server/operations/raft/raft_tranfer_leadership.go b/controller/rest_server/operations/raft/raft_tranfer_leadership.go new file mode 100644 index 000000000..ffd4240ba --- /dev/null +++ b/controller/rest_server/operations/raft/raft_tranfer_leadership.go @@ -0,0 +1,82 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" +) + +// RaftTranferLeadershipHandlerFunc turns a function with the right signature into a raft tranfer leadership handler +type RaftTranferLeadershipHandlerFunc func(RaftTranferLeadershipParams) middleware.Responder + +// Handle executing the request and returning a response +func (fn RaftTranferLeadershipHandlerFunc) Handle(params RaftTranferLeadershipParams) middleware.Responder { + return fn(params) +} + +// RaftTranferLeadershipHandler interface for that can handle valid raft tranfer leadership params +type RaftTranferLeadershipHandler interface { + Handle(RaftTranferLeadershipParams) middleware.Responder +} + +// NewRaftTranferLeadership creates a new http.Handler for the raft tranfer leadership operation +func NewRaftTranferLeadership(ctx *middleware.Context, handler RaftTranferLeadershipHandler) *RaftTranferLeadership { + return &RaftTranferLeadership{Context: ctx, Handler: handler} +} + +/* RaftTranferLeadership swagger:route POST /raft/transfer-leadership Raft raftTranferLeadership + +Attempts to transfer leadership to a different member of the cluster + +Attempts to transfer leadership to a different member of the cluster. Requires admin access. + +*/ +type RaftTranferLeadership struct { + Context *middleware.Context + Handler RaftTranferLeadershipHandler +} + +func (o *RaftTranferLeadership) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewRaftTranferLeadershipParams() + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/controller/rest_server/operations/raft/raft_tranfer_leadership_parameters.go b/controller/rest_server/operations/raft/raft_tranfer_leadership_parameters.go new file mode 100644 index 000000000..e700272f4 --- /dev/null +++ b/controller/rest_server/operations/raft/raft_tranfer_leadership_parameters.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "io" + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/validate" + + "github.com/openziti/ziti/controller/rest_model" +) + +// NewRaftTranferLeadershipParams creates a new RaftTranferLeadershipParams object +// +// There are no default values defined in the spec. +func NewRaftTranferLeadershipParams() RaftTranferLeadershipParams { + + return RaftTranferLeadershipParams{} +} + +// RaftTranferLeadershipParams contains all the bound params for the raft tranfer leadership operation +// typically these are obtained from a http.Request +// +// swagger:parameters raftTranferLeadership +type RaftTranferLeadershipParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*transfer operation parameters + Required: true + In: body + */ + Member *rest_model.RaftTransferLeadership +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewRaftTranferLeadershipParams() beforehand. +func (o *RaftTranferLeadershipParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + if runtime.HasBody(r) { + defer r.Body.Close() + var body rest_model.RaftTransferLeadership + if err := route.Consumer.Consume(r.Body, &body); err != nil { + if err == io.EOF { + res = append(res, errors.Required("member", "body", "")) + } else { + res = append(res, errors.NewParseError("member", "body", "", err)) + } + } else { + // validate body object + if err := body.Validate(route.Formats); err != nil { + res = append(res, err) + } + + ctx := validate.WithOperationRequest(context.Background()) + if err := body.ContextValidate(ctx, route.Formats); err != nil { + res = append(res, err) + } + + if len(res) == 0 { + o.Member = &body + } + } + } else { + res = append(res, errors.Required("member", "body", "")) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/controller/rest_server/operations/raft/raft_tranfer_leadership_responses.go b/controller/rest_server/operations/raft/raft_tranfer_leadership_responses.go new file mode 100644 index 000000000..744159fa5 --- /dev/null +++ b/controller/rest_server/operations/raft/raft_tranfer_leadership_responses.go @@ -0,0 +1,258 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/openziti/ziti/controller/rest_model" +) + +// RaftTranferLeadershipOKCode is the HTTP code returned for type RaftTranferLeadershipOK +const RaftTranferLeadershipOKCode int = 200 + +/*RaftTranferLeadershipOK Base empty response + +swagger:response raftTranferLeadershipOK +*/ +type RaftTranferLeadershipOK struct { + + /* + In: Body + */ + Payload *rest_model.Empty `json:"body,omitempty"` +} + +// NewRaftTranferLeadershipOK creates RaftTranferLeadershipOK with default headers values +func NewRaftTranferLeadershipOK() *RaftTranferLeadershipOK { + + return &RaftTranferLeadershipOK{} +} + +// WithPayload adds the payload to the raft tranfer leadership o k response +func (o *RaftTranferLeadershipOK) WithPayload(payload *rest_model.Empty) *RaftTranferLeadershipOK { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft tranfer leadership o k response +func (o *RaftTranferLeadershipOK) SetPayload(payload *rest_model.Empty) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftTranferLeadershipOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(200) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// RaftTranferLeadershipUnauthorizedCode is the HTTP code returned for type RaftTranferLeadershipUnauthorized +const RaftTranferLeadershipUnauthorizedCode int = 401 + +/*RaftTranferLeadershipUnauthorized The currently supplied session does not have the correct access rights to request this resource + +swagger:response raftTranferLeadershipUnauthorized +*/ +type RaftTranferLeadershipUnauthorized struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewRaftTranferLeadershipUnauthorized creates RaftTranferLeadershipUnauthorized with default headers values +func NewRaftTranferLeadershipUnauthorized() *RaftTranferLeadershipUnauthorized { + + return &RaftTranferLeadershipUnauthorized{} +} + +// WithPayload adds the payload to the raft tranfer leadership unauthorized response +func (o *RaftTranferLeadershipUnauthorized) WithPayload(payload *rest_model.APIErrorEnvelope) *RaftTranferLeadershipUnauthorized { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft tranfer leadership unauthorized response +func (o *RaftTranferLeadershipUnauthorized) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftTranferLeadershipUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(401) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// RaftTranferLeadershipNotFoundCode is the HTTP code returned for type RaftTranferLeadershipNotFound +const RaftTranferLeadershipNotFoundCode int = 404 + +/*RaftTranferLeadershipNotFound The requested resource does not exist + +swagger:response raftTranferLeadershipNotFound +*/ +type RaftTranferLeadershipNotFound struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewRaftTranferLeadershipNotFound creates RaftTranferLeadershipNotFound with default headers values +func NewRaftTranferLeadershipNotFound() *RaftTranferLeadershipNotFound { + + return &RaftTranferLeadershipNotFound{} +} + +// WithPayload adds the payload to the raft tranfer leadership not found response +func (o *RaftTranferLeadershipNotFound) WithPayload(payload *rest_model.APIErrorEnvelope) *RaftTranferLeadershipNotFound { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft tranfer leadership not found response +func (o *RaftTranferLeadershipNotFound) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftTranferLeadershipNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(404) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// RaftTranferLeadershipTooManyRequestsCode is the HTTP code returned for type RaftTranferLeadershipTooManyRequests +const RaftTranferLeadershipTooManyRequestsCode int = 429 + +/*RaftTranferLeadershipTooManyRequests The resource requested is rate limited and the rate limit has been exceeded + +swagger:response raftTranferLeadershipTooManyRequests +*/ +type RaftTranferLeadershipTooManyRequests struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewRaftTranferLeadershipTooManyRequests creates RaftTranferLeadershipTooManyRequests with default headers values +func NewRaftTranferLeadershipTooManyRequests() *RaftTranferLeadershipTooManyRequests { + + return &RaftTranferLeadershipTooManyRequests{} +} + +// WithPayload adds the payload to the raft tranfer leadership too many requests response +func (o *RaftTranferLeadershipTooManyRequests) WithPayload(payload *rest_model.APIErrorEnvelope) *RaftTranferLeadershipTooManyRequests { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft tranfer leadership too many requests response +func (o *RaftTranferLeadershipTooManyRequests) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftTranferLeadershipTooManyRequests) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(429) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// RaftTranferLeadershipInternalServerErrorCode is the HTTP code returned for type RaftTranferLeadershipInternalServerError +const RaftTranferLeadershipInternalServerErrorCode int = 500 + +/*RaftTranferLeadershipInternalServerError The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information + +swagger:response raftTranferLeadershipInternalServerError +*/ +type RaftTranferLeadershipInternalServerError struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewRaftTranferLeadershipInternalServerError creates RaftTranferLeadershipInternalServerError with default headers values +func NewRaftTranferLeadershipInternalServerError() *RaftTranferLeadershipInternalServerError { + + return &RaftTranferLeadershipInternalServerError{} +} + +// WithPayload adds the payload to the raft tranfer leadership internal server error response +func (o *RaftTranferLeadershipInternalServerError) WithPayload(payload *rest_model.APIErrorEnvelope) *RaftTranferLeadershipInternalServerError { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the raft tranfer leadership internal server error response +func (o *RaftTranferLeadershipInternalServerError) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *RaftTranferLeadershipInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(500) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/controller/rest_server/operations/raft/raft_tranfer_leadership_urlbuilder.go b/controller/rest_server/operations/raft/raft_tranfer_leadership_urlbuilder.go new file mode 100644 index 000000000..16e8f53bf --- /dev/null +++ b/controller/rest_server/operations/raft/raft_tranfer_leadership_urlbuilder.go @@ -0,0 +1,111 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// +// Copyright NetFoundry Inc. +// +// 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 +// +// https://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. +// +// __ __ _ +// \ \ / / (_) +// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _ +// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` | +// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it. +// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, | +// __/ | +// |___/ + +package raft + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" +) + +// RaftTranferLeadershipURL generates an URL for the raft tranfer leadership operation +type RaftTranferLeadershipURL struct { + _basePath string +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *RaftTranferLeadershipURL) WithBasePath(bp string) *RaftTranferLeadershipURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *RaftTranferLeadershipURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *RaftTranferLeadershipURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/raft/transfer-leadership" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/fabric/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *RaftTranferLeadershipURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *RaftTranferLeadershipURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *RaftTranferLeadershipURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on RaftTranferLeadershipURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on RaftTranferLeadershipURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *RaftTranferLeadershipURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/controller/rest_server/operations/ziti_fabric_api.go b/controller/rest_server/operations/ziti_fabric_api.go index f577cc6b6..ea2266037 100644 --- a/controller/rest_server/operations/ziti_fabric_api.go +++ b/controller/rest_server/operations/ziti_fabric_api.go @@ -168,6 +168,15 @@ func NewZitiFabricAPI(spec *loads.Document) *ZitiFabricAPI { RaftRaftListMembersHandler: raft.RaftListMembersHandlerFunc(func(params raft.RaftListMembersParams) middleware.Responder { return middleware.NotImplemented("operation raft.RaftListMembers has not yet been implemented") }), + RaftRaftMemberAddHandler: raft.RaftMemberAddHandlerFunc(func(params raft.RaftMemberAddParams) middleware.Responder { + return middleware.NotImplemented("operation raft.RaftMemberAdd has not yet been implemented") + }), + RaftRaftMemberRemoveHandler: raft.RaftMemberRemoveHandlerFunc(func(params raft.RaftMemberRemoveParams) middleware.Responder { + return middleware.NotImplemented("operation raft.RaftMemberRemove has not yet been implemented") + }), + RaftRaftTranferLeadershipHandler: raft.RaftTranferLeadershipHandlerFunc(func(params raft.RaftTranferLeadershipParams) middleware.Responder { + return middleware.NotImplemented("operation raft.RaftTranferLeadership has not yet been implemented") + }), RouterUpdateRouterHandler: router.UpdateRouterHandlerFunc(func(params router.UpdateRouterParams) middleware.Responder { return middleware.NotImplemented("operation router.UpdateRouter has not yet been implemented") }), @@ -275,6 +284,12 @@ type ZitiFabricAPI struct { TerminatorPatchTerminatorHandler terminator.PatchTerminatorHandler // RaftRaftListMembersHandler sets the operation handler for the raft list members operation RaftRaftListMembersHandler raft.RaftListMembersHandler + // RaftRaftMemberAddHandler sets the operation handler for the raft member add operation + RaftRaftMemberAddHandler raft.RaftMemberAddHandler + // RaftRaftMemberRemoveHandler sets the operation handler for the raft member remove operation + RaftRaftMemberRemoveHandler raft.RaftMemberRemoveHandler + // RaftRaftTranferLeadershipHandler sets the operation handler for the raft tranfer leadership operation + RaftRaftTranferLeadershipHandler raft.RaftTranferLeadershipHandler // RouterUpdateRouterHandler sets the operation handler for the update router operation RouterUpdateRouterHandler router.UpdateRouterHandler // ServiceUpdateServiceHandler sets the operation handler for the update service operation @@ -451,6 +466,15 @@ func (o *ZitiFabricAPI) Validate() error { if o.RaftRaftListMembersHandler == nil { unregistered = append(unregistered, "raft.RaftListMembersHandler") } + if o.RaftRaftMemberAddHandler == nil { + unregistered = append(unregistered, "raft.RaftMemberAddHandler") + } + if o.RaftRaftMemberRemoveHandler == nil { + unregistered = append(unregistered, "raft.RaftMemberRemoveHandler") + } + if o.RaftRaftTranferLeadershipHandler == nil { + unregistered = append(unregistered, "raft.RaftTranferLeadershipHandler") + } if o.RouterUpdateRouterHandler == nil { unregistered = append(unregistered, "router.UpdateRouterHandler") } @@ -672,6 +696,18 @@ func (o *ZitiFabricAPI) initHandlerCache() { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/raft/list-members"] = raft.NewRaftListMembers(o.context, o.RaftRaftListMembersHandler) + if o.handlers["POST"] == nil { + o.handlers["POST"] = make(map[string]http.Handler) + } + o.handlers["POST"]["/raft/add-member"] = raft.NewRaftMemberAdd(o.context, o.RaftRaftMemberAddHandler) + if o.handlers["POST"] == nil { + o.handlers["POST"] = make(map[string]http.Handler) + } + o.handlers["POST"]["/raft/remove-member"] = raft.NewRaftMemberRemove(o.context, o.RaftRaftMemberRemoveHandler) + if o.handlers["POST"] == nil { + o.handlers["POST"] = make(map[string]http.Handler) + } + o.handlers["POST"]["/raft/transfer-leadership"] = raft.NewRaftTranferLeadership(o.context, o.RaftRaftTranferLeadershipHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } diff --git a/controller/specs/swagger.yml b/controller/specs/swagger.yml index ef67482d9..86b7cf3b7 100644 --- a/controller/specs/swagger.yml +++ b/controller/specs/swagger.yml @@ -753,11 +753,90 @@ paths: responses: '200': $ref: '#/responses/raftListMembersResponse' + '400': + $ref: '#/responses/badRequestResponse' '401': $ref: '#/responses/unauthorizedResponse' '429': $ref: '#/responses/rateLimitedResponse' + + '/raft/add-member': + post: + summary: Add a member to the raft cluster + description: Add a member to the raft cluster. Requires admin access. + tags: + - Raft + operationId: raftMemberAdd + parameters: + - name: member + in: body + required: true + description: member parameters + schema: + $ref: '#/definitions/raftMemberAdd' + responses: + '200': + $ref: '#/responses/emptyResponse' + '400': + $ref: '#/responses/badRequestResponse' + '401': + $ref: '#/responses/unauthorizedResponse' + '429': + $ref: '#/responses/rateLimitedResponse' + + '/raft/remove-member': + post: + summary: Remove a member from the raft cluster + description: Remove a member from the raft cluster. Requires admin access. + tags: + - Raft + operationId: raftMemberRemove + parameters: + - name: member + in: body + required: true + description: member parameters + schema: + $ref: '#/definitions/raftMemberRemove' + responses: + '200': + $ref: '#/responses/emptyResponse' + '400': + $ref: '#/responses/badRequestResponse' + '401': + $ref: '#/responses/unauthorizedResponse' + '404': + $ref: '#/responses/notFoundResponse' + '429': + $ref: '#/responses/rateLimitedResponse' + + '/raft/transfer-leadership': + post: + summary: Attempts to transfer leadership to a different member of the cluster + description: Attempts to transfer leadership to a different member of the cluster. Requires admin access. + tags: + - Raft + operationId: raftTranferLeadership + parameters: + - name: member + in: body + required: true + description: transfer operation parameters + schema: + $ref: '#/definitions/raftTransferLeadership' + responses: + '200': + $ref: '#/responses/emptyResponse' + '401': + $ref: '#/responses/unauthorizedResponse' + '404': + $ref: '#/responses/notFoundResponse' + '429': + $ref: '#/responses/rateLimitedResponse' + '500': + $ref: '#/responses/badRequestResponse' + ####################################################################################################################### # # Parameters - Reusable parameters @@ -1239,6 +1318,32 @@ definitions: fixed: type: boolean + raftMemberAdd: + type: object + required: + - address + - isVoter + properties: + address: + type: string + isVoter: + type: boolean + + raftMemberRemove: + type: object + required: + - id + properties: + id: + type: string + + raftTransferLeadership: + type: object + properties: + newLeaderId: + type: string + + ################################################################### # Errors ################################################################## diff --git a/go.mod b/go.mod index dce0fd5fb..410d91478 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/go-acme/lego/v4 v4.14.2 github.com/go-openapi/errors v0.20.4 github.com/go-openapi/loads v0.21.2 - github.com/go-openapi/runtime v0.26.0 + github.com/go-openapi/runtime v0.26.2 github.com/go-openapi/spec v0.20.11 github.com/go-openapi/strfmt v0.21.9 github.com/go-openapi/swag v0.22.4 @@ -48,7 +48,7 @@ require ( github.com/natefinch/lumberjack v2.0.0+incompatible github.com/openziti/agent v1.0.16 github.com/openziti/channel/v2 v2.0.111 - github.com/openziti/edge-api v0.26.2-0.20231207222636-f76d62194689 + github.com/openziti/edge-api v0.26.5 github.com/openziti/foundation/v2 v2.0.35 github.com/openziti/identity v1.0.68 github.com/openziti/jwks v1.0.3 @@ -71,7 +71,7 @@ require ( github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.18.0 + github.com/spf13/viper v1.18.1 github.com/stretchr/testify v1.8.4 github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 github.com/xeipuuv/gojsonschema v1.2.0 diff --git a/go.sum b/go.sum index b7bf3ae2f..2f1f6de23 100644 --- a/go.sum +++ b/go.sum @@ -232,8 +232,8 @@ github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2Kv github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/loads v0.21.2 h1:r2a/xFIYeZ4Qd2TnGpWDIQNcP80dIaZgf704za8enro= github.com/go-openapi/loads v0.21.2/go.mod h1:Jq58Os6SSGz0rzh62ptiu8Z31I+OTHqmULx5e/gJbNw= -github.com/go-openapi/runtime v0.26.0 h1:HYOFtG00FM1UvqrcxbEJg/SwvDRvYLQKGhw2zaQjTcc= -github.com/go-openapi/runtime v0.26.0/go.mod h1:QgRGeZwrUcSHdeh4Ka9Glvo0ug1LC5WyE+EV88plZrQ= +github.com/go-openapi/runtime v0.26.2 h1:elWyB9MacRzvIVgAZCBJmqTi7hBzU0hlKD4IvfX0Zl0= +github.com/go-openapi/runtime v0.26.2/go.mod h1:O034jyRZ557uJKzngbMDJXkcKJVzXJiymdSfgejrcRw= github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= github.com/go-openapi/spec v0.20.11 h1:J/TzFDLTt4Rcl/l1PmyErvkqlJDncGvPTMnCI39I4gY= github.com/go-openapi/spec v0.20.11/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= @@ -584,8 +584,8 @@ github.com/openziti/channel/v2 v2.0.111 h1:ZZDyUUFcyshitXjUqAMjdAKbaDMpgV7oX1Jp1 github.com/openziti/channel/v2 v2.0.111/go.mod h1:abw0qwT0MzWvh1eI2P6D6CD17PRHL8EEo1d3DHCyCdM= github.com/openziti/dilithium v0.3.3 h1:PLgQ6PMNLSTzCFbX/h98cmudgz/cU6TmjdSv5NAPD8k= github.com/openziti/dilithium v0.3.3/go.mod h1:vsCjI2AU/hon9e+dLhUFbCNGesJDj2ASgkySOcpmvjo= -github.com/openziti/edge-api v0.26.2-0.20231207222636-f76d62194689 h1:pUEaO996Z2DCZq25XccpLAD2RTVKAasalMllpETmCJ4= -github.com/openziti/edge-api v0.26.2-0.20231207222636-f76d62194689/go.mod h1:6qK3uDsYSnTRqKTTEp8ANtrJANJrXHGwq6KWANw131Q= +github.com/openziti/edge-api v0.26.5 h1:O360x1ucLiCzibDBIVPEDlW5iZmA1pBVx/kfXKZusH8= +github.com/openziti/edge-api v0.26.5/go.mod h1:JskiZuulHR6CCCGT7P6MLupnC21Reg8viw127F4MRE8= github.com/openziti/foundation/v2 v2.0.35 h1:4VaMwZ2kAy6jwBYeQIBN2m8rcGroTDX4A2Jp7NAKb6M= github.com/openziti/foundation/v2 v2.0.35/go.mod h1:Xnb3IxP1e1UcgLggqSunEpCjH3iHozkPi9Bd9GESbwo= github.com/openziti/identity v1.0.68 h1:SaFr7BeFQBoWQDiT28vUb8D9w7v6lIAK6/9RkwmV0OU= @@ -755,8 +755,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= -github.com/spf13/viper v1.18.0 h1:pN6W1ub/G4OfnM+NR9p7xP9R6TltLUzp5JG9yZD3Qg0= -github.com/spf13/viper v1.18.0/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/spf13/viper v1.18.1 h1:rmuU42rScKWlhhJDyXZRKJQHXFX02chSVW1IvkPGiVM= +github.com/spf13/viper v1.18.1/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= @@ -844,8 +844,8 @@ go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= -go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= -go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= +go.opentelemetry.io/otel/sdk v1.17.0 h1:FLN2X66Ke/k5Sg3V623Q7h7nt3cHXaW1FOvKKrW0IpE= +go.opentelemetry.io/otel/sdk v1.17.0/go.mod h1:U87sE0f5vQB7hwUoW98pW5Rz4ZDuCFBZFNUBlSgmDFQ= go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= diff --git a/ziti/cmd/fabric/raft.go b/ziti/cmd/fabric/raft.go index 84663a00e..330ced501 100644 --- a/ziti/cmd/fabric/raft.go +++ b/ziti/cmd/fabric/raft.go @@ -2,9 +2,9 @@ package fabric import ( "context" - "github.com/jedib0t/go-pretty/v6/table" "github.com/openziti/ziti/controller/rest_client/raft" + "github.com/openziti/ziti/controller/rest_model" "github.com/openziti/ziti/ziti/cmd/api" "github.com/openziti/ziti/ziti/cmd/common" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" @@ -24,16 +24,15 @@ func newRaftCmd(p common.OptionsProvider) *cobra.Command { } cmd.AddCommand(newRaftListMembersCmd(p)) + cmd.AddCommand(newRaftAddMemberCmd(p)) + cmd.AddCommand(newRaftRemoveMemberCmd(p)) + cmd.AddCommand(newRaftTransferLeadershipCmd(p)) return cmd } -type raftListMembersOptions struct { - api.Options -} - func newRaftListMembersCmd(p common.OptionsProvider) *cobra.Command { - options := &raftListMembersOptions{ + action := &raftListMembersAction{ Options: api.Options{CommonOptions: p()}, } @@ -41,23 +40,23 @@ func newRaftListMembersCmd(p common.OptionsProvider) *cobra.Command { Use: "list-members", Short: "list cluster members and their status", Args: cobra.ExactArgs(0), - Run: func(cmd *cobra.Command, args []string) { - options.Cmd = cmd - options.Args = args - err := raftListMembers(options) - cmdhelper.CheckErr(err) - }, + RunE: action.run, } // allow interspersing positional args and flags cmd.Flags().SetInterspersed(true) - options.AddCommonFlags(cmd) + action.AddCommonFlags(cmd) return cmd } -func raftListMembers(o *raftListMembersOptions) error { - client, err := util.NewFabricManagementClient(o) +type raftListMembersAction struct { + api.Options +} + +func (self *raftListMembersAction) run(cmd *cobra.Command, _ []string) error { + self.Cmd = cmd + client, err := util.NewFabricManagementClient(self) if err != nil { return err } @@ -75,7 +74,141 @@ func raftListMembers(o *raftListMembersOptions) error { t.AppendRow(table.Row{*m.ID, *m.Address, *m.Voter, *m.Leader, *m.Version, *m.Connected}) } api.RenderTable(&api.Options{ - CommonOptions: o.CommonOptions, + CommonOptions: self.CommonOptions, }, t, nil) return nil } + +func newRaftAddMemberCmd(p common.OptionsProvider) *cobra.Command { + action := &raftAddMemberAction{ + Options: api.Options{CommonOptions: p()}, + } + + cmd := &cobra.Command{ + Use: "add-member
", + Short: "add cluster member", + Args: cobra.ExactArgs(1), + RunE: action.run, + } + + // allow interspersing positional args and flags + cmd.Flags().SetInterspersed(true) + action.AddCommonFlags(cmd) + cmd.Flags().BoolVar(&action.nonVoting, "non-voting", false, "Allows adding a non-voting member to the cluster") + + return cmd +} + +type raftAddMemberAction struct { + api.Options + nonVoting bool +} + +func (self *raftAddMemberAction) run(cmd *cobra.Command, args []string) error { + self.Cmd = cmd + client, err := util.NewFabricManagementClient(self) + if err != nil { + return err + } + + isVoter := !self.nonVoting + + _, err = client.Raft.RaftMemberAdd(&raft.RaftMemberAddParams{ + Context: context.Background(), + Member: &rest_model.RaftMemberAdd{ + Address: &args[0], + IsVoter: &isVoter, + }, + }) + + return err +} + +func newRaftRemoveMemberCmd(p common.OptionsProvider) *cobra.Command { + action := &raftRemoveMemberAction{ + Options: api.Options{CommonOptions: p()}, + } + + cmd := &cobra.Command{ + Use: "remove-member ", + Short: "remove cluster member", + Args: cobra.ExactArgs(1), + RunE: action.run, + } + + // allow interspersing positional args and flags + cmd.Flags().SetInterspersed(true) + action.AddCommonFlags(cmd) + + return cmd +} + +type raftRemoveMemberAction struct { + api.Options +} + +func (self *raftRemoveMemberAction) run(cmd *cobra.Command, args []string) error { + self.Cmd = cmd + + client, err := util.NewFabricManagementClient(self) + if err != nil { + return err + } + + _, err = client.Raft.RaftMemberRemove(&raft.RaftMemberRemoveParams{ + Context: context.Background(), + Member: &rest_model.RaftMemberRemove{ + ID: &args[0], + }, + }) + + return err +} + +func newRaftTransferLeadershipCmd(p common.OptionsProvider) *cobra.Command { + action := &raftTransferLeadershipAction{ + Options: api.Options{CommonOptions: p()}, + } + + cmd := &cobra.Command{ + Use: "transfer-leadership [cluster member id]?", + Short: "transfer cluster leadership to another member", + Long: "transfer cluster leadership to another member. If a node id is specified, leadership will be transferred to that node", + Args: cobra.RangeArgs(0, 1), + RunE: action.run, + } + + // allow interspersing positional args and flags + cmd.Flags().SetInterspersed(true) + action.AddCommonFlags(cmd) + + return cmd +} + +type raftTransferLeadershipAction struct { + api.Options +} + +func (self *raftTransferLeadershipAction) run(cmd *cobra.Command, args []string) error { + self.Cmd = cmd + + client, err := util.NewFabricManagementClient(self) + if err != nil { + return err + } + + newLeader := "" + + if len(args) > 0 { + newLeader = args[0] + } + + _, err = client.Raft.RaftTranferLeadership(&raft.RaftTranferLeadershipParams{ + Context: context.Background(), + Member: &rest_model.RaftTransferLeadership{ + NewLeaderID: newLeader, + }, + }) + + return err +} diff --git a/ziti/cmd/fabric/stream_events.go b/ziti/cmd/fabric/stream_events.go index 1185b30fa..8dfac7573 100644 --- a/ziti/cmd/fabric/stream_events.go +++ b/ziti/cmd/fabric/stream_events.go @@ -35,12 +35,14 @@ type streamEventsAction struct { all bool apiSessions bool circuits bool + entityChange bool entityCounts bool links bool metrics bool routers bool services bool sessions bool + terminators bool usage bool metricsSourceFilter string @@ -68,12 +70,14 @@ func NewStreamEventsCmd(p common.OptionsProvider) *cobra.Command { streamEventsCmd.Flags().BoolVar(&action.all, "all", false, "Include all events") streamEventsCmd.Flags().BoolVar(&action.apiSessions, "api-sessions", false, "Include api-session events") streamEventsCmd.Flags().BoolVar(&action.circuits, "circuits", false, "Include circuit events") + streamEventsCmd.Flags().BoolVar(&action.entityChange, "entity-change", false, "Include entity change events") streamEventsCmd.Flags().BoolVar(&action.entityCounts, "entity-counts", false, "Include entity count events") streamEventsCmd.Flags().BoolVar(&action.links, "links", false, "Include link events") streamEventsCmd.Flags().BoolVar(&action.metrics, "metrics", false, "Include metrics events") streamEventsCmd.Flags().BoolVar(&action.routers, "routers", false, "Include router events") streamEventsCmd.Flags().BoolVar(&action.services, "services", false, "Include service events") streamEventsCmd.Flags().BoolVar(&action.sessions, "sessions", false, "Include session events") + streamEventsCmd.Flags().BoolVar(&action.terminators, "terminators", false, "Include terminators events") streamEventsCmd.Flags().BoolVar(&action.usage, "usage", false, "Include usage events") streamEventsCmd.Flags().DurationVar(&action.entityCountsInterval, "entity-counts-interval", 5*time.Minute, "Specify the entity count event interval") streamEventsCmd.Flags().StringVar(&action.metricsSourceFilter, "metrics-source-filter", "", "Specify which sources to stream metrics from") @@ -97,6 +101,13 @@ func (self *streamEventsAction) buildSubscriptions(cmd *cobra.Command) []*event. }) } + if self.entityChange || (self.all && !cmd.Flags().Changed("entity-change")) { + subscription := &event.Subscription{ + Type: "entityChange", + } + subscriptions = append(subscriptions, subscription) + } + if self.entityCounts || (self.all && !cmd.Flags().Changed("entity-counts")) { subscription := &event.Subscription{ Type: "edge.entityCounts", @@ -150,6 +161,12 @@ func (self *streamEventsAction) buildSubscriptions(cmd *cobra.Command) []*event. }) } + if self.terminators || (self.all && !cmd.Flags().Changed("terminators")) { + subscriptions = append(subscriptions, &event.Subscription{ + Type: "fabric.terminators", + }) + } + if self.usage || (self.all && !cmd.Flags().Changed("usage")) { subscription := &event.Subscription{ Type: "fabric.usage", diff --git a/zititest/go.mod b/zititest/go.mod index 0feea80b1..b4f040300 100644 --- a/zititest/go.mod +++ b/zititest/go.mod @@ -70,7 +70,7 @@ require ( github.com/go-openapi/jsonpointer v0.20.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/loads v0.21.2 // indirect - github.com/go-openapi/runtime v0.26.0 // indirect + github.com/go-openapi/runtime v0.26.2 // indirect github.com/go-openapi/spec v0.20.11 // indirect github.com/go-openapi/strfmt v0.21.9 // indirect github.com/go-openapi/swag v0.22.4 // indirect @@ -129,7 +129,7 @@ require ( github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/openziti/dilithium v0.3.3 // indirect - github.com/openziti/edge-api v0.26.2-0.20231207222636-f76d62194689 // indirect + github.com/openziti/edge-api v0.26.5 // indirect github.com/openziti/jwks v1.0.3 // indirect github.com/openziti/metrics v1.2.40 // indirect github.com/openziti/runzmd v1.0.36 // indirect @@ -159,7 +159,7 @@ require ( github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.18.0 // indirect + github.com/spf13/viper v1.18.1 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect diff --git a/zititest/go.sum b/zititest/go.sum index 6a68a0dc0..d005a0819 100644 --- a/zititest/go.sum +++ b/zititest/go.sum @@ -233,8 +233,8 @@ github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2Kv github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/loads v0.21.2 h1:r2a/xFIYeZ4Qd2TnGpWDIQNcP80dIaZgf704za8enro= github.com/go-openapi/loads v0.21.2/go.mod h1:Jq58Os6SSGz0rzh62ptiu8Z31I+OTHqmULx5e/gJbNw= -github.com/go-openapi/runtime v0.26.0 h1:HYOFtG00FM1UvqrcxbEJg/SwvDRvYLQKGhw2zaQjTcc= -github.com/go-openapi/runtime v0.26.0/go.mod h1:QgRGeZwrUcSHdeh4Ka9Glvo0ug1LC5WyE+EV88plZrQ= +github.com/go-openapi/runtime v0.26.2 h1:elWyB9MacRzvIVgAZCBJmqTi7hBzU0hlKD4IvfX0Zl0= +github.com/go-openapi/runtime v0.26.2/go.mod h1:O034jyRZ557uJKzngbMDJXkcKJVzXJiymdSfgejrcRw= github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= github.com/go-openapi/spec v0.20.11 h1:J/TzFDLTt4Rcl/l1PmyErvkqlJDncGvPTMnCI39I4gY= github.com/go-openapi/spec v0.20.11/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= @@ -596,8 +596,8 @@ github.com/openziti/channel/v2 v2.0.111 h1:ZZDyUUFcyshitXjUqAMjdAKbaDMpgV7oX1Jp1 github.com/openziti/channel/v2 v2.0.111/go.mod h1:abw0qwT0MzWvh1eI2P6D6CD17PRHL8EEo1d3DHCyCdM= github.com/openziti/dilithium v0.3.3 h1:PLgQ6PMNLSTzCFbX/h98cmudgz/cU6TmjdSv5NAPD8k= github.com/openziti/dilithium v0.3.3/go.mod h1:vsCjI2AU/hon9e+dLhUFbCNGesJDj2ASgkySOcpmvjo= -github.com/openziti/edge-api v0.26.2-0.20231207222636-f76d62194689 h1:pUEaO996Z2DCZq25XccpLAD2RTVKAasalMllpETmCJ4= -github.com/openziti/edge-api v0.26.2-0.20231207222636-f76d62194689/go.mod h1:6qK3uDsYSnTRqKTTEp8ANtrJANJrXHGwq6KWANw131Q= +github.com/openziti/edge-api v0.26.5 h1:O360x1ucLiCzibDBIVPEDlW5iZmA1pBVx/kfXKZusH8= +github.com/openziti/edge-api v0.26.5/go.mod h1:JskiZuulHR6CCCGT7P6MLupnC21Reg8viw127F4MRE8= github.com/openziti/fablab v0.5.32 h1:F2n3m+EZ9ulXUnnox2x6SjsuYQkuNnSao62FaLhLSUA= github.com/openziti/fablab v0.5.32/go.mod h1:qgW8yiZ7lXuE0FZ85pL4t4ohD5JAnNU1r4EdGLs2TM4= github.com/openziti/foundation/v2 v2.0.35 h1:4VaMwZ2kAy6jwBYeQIBN2m8rcGroTDX4A2Jp7NAKb6M= @@ -771,8 +771,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= -github.com/spf13/viper v1.18.0 h1:pN6W1ub/G4OfnM+NR9p7xP9R6TltLUzp5JG9yZD3Qg0= -github.com/spf13/viper v1.18.0/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/spf13/viper v1.18.1 h1:rmuU42rScKWlhhJDyXZRKJQHXFX02chSVW1IvkPGiVM= +github.com/spf13/viper v1.18.1/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= @@ -860,8 +860,8 @@ go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= -go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= -go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= +go.opentelemetry.io/otel/sdk v1.17.0 h1:FLN2X66Ke/k5Sg3V623Q7h7nt3cHXaW1FOvKKrW0IpE= +go.opentelemetry.io/otel/sdk v1.17.0/go.mod h1:U87sE0f5vQB7hwUoW98pW5Rz4ZDuCFBZFNUBlSgmDFQ= go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=