mirror of
https://github.com/hanzozt/zt.git
synced 2026-10-30 15:04:55 +00:00
232 lines
7.9 KiB
Go
232 lines
7.9 KiB
Go
// 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 cluster
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/go-openapi/runtime"
|
|
"github.com/go-openapi/strfmt"
|
|
)
|
|
|
|
// New creates a new cluster API client.
|
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
|
|
return &Client{transport: transport, formats: formats}
|
|
}
|
|
|
|
/*
|
|
Client for cluster API
|
|
*/
|
|
type Client struct {
|
|
transport runtime.ClientTransport
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
// ClientOption is the option for Client methods
|
|
type ClientOption func(*runtime.ClientOperation)
|
|
|
|
// ClientService is the interface for Client methods
|
|
type ClientService interface {
|
|
ClusterListMembers(params *ClusterListMembersParams, opts ...ClientOption) (*ClusterListMembersOK, error)
|
|
|
|
ClusterMemberAdd(params *ClusterMemberAddParams, opts ...ClientOption) (*ClusterMemberAddOK, error)
|
|
|
|
ClusterMemberRemove(params *ClusterMemberRemoveParams, opts ...ClientOption) (*ClusterMemberRemoveOK, error)
|
|
|
|
ClusterTransferLeadership(params *ClusterTransferLeadershipParams, opts ...ClientOption) (*ClusterTransferLeadershipOK, error)
|
|
|
|
SetTransport(transport runtime.ClientTransport)
|
|
}
|
|
|
|
/*
|
|
ClusterListMembers returns all members of a cluster and their current status
|
|
|
|
Returns all members of a cluster and their current status
|
|
*/
|
|
func (a *Client) ClusterListMembers(params *ClusterListMembersParams, opts ...ClientOption) (*ClusterListMembersOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewClusterListMembersParams()
|
|
}
|
|
op := &runtime.ClientOperation{
|
|
ID: "clusterListMembers",
|
|
Method: "GET",
|
|
PathPattern: "/cluster/list-members",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"https"},
|
|
Params: params,
|
|
Reader: &ClusterListMembersReader{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.(*ClusterListMembersOK)
|
|
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 clusterListMembers: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
/*
|
|
ClusterMemberAdd adds a member to the controller cluster
|
|
|
|
Add a member to the controller cluster. Requires admin access.
|
|
*/
|
|
func (a *Client) ClusterMemberAdd(params *ClusterMemberAddParams, opts ...ClientOption) (*ClusterMemberAddOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewClusterMemberAddParams()
|
|
}
|
|
op := &runtime.ClientOperation{
|
|
ID: "clusterMemberAdd",
|
|
Method: "POST",
|
|
PathPattern: "/cluster/add-member",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"https"},
|
|
Params: params,
|
|
Reader: &ClusterMemberAddReader{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.(*ClusterMemberAddOK)
|
|
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 clusterMemberAdd: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
/*
|
|
ClusterMemberRemove removes a member from the controller cluster
|
|
|
|
Remove a member from the controller cluster. Requires admin access.
|
|
*/
|
|
func (a *Client) ClusterMemberRemove(params *ClusterMemberRemoveParams, opts ...ClientOption) (*ClusterMemberRemoveOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewClusterMemberRemoveParams()
|
|
}
|
|
op := &runtime.ClientOperation{
|
|
ID: "clusterMemberRemove",
|
|
Method: "POST",
|
|
PathPattern: "/cluster/remove-member",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"https"},
|
|
Params: params,
|
|
Reader: &ClusterMemberRemoveReader{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.(*ClusterMemberRemoveOK)
|
|
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 clusterMemberRemove: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
|
panic(msg)
|
|
}
|
|
|
|
/*
|
|
ClusterTransferLeadership 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) ClusterTransferLeadership(params *ClusterTransferLeadershipParams, opts ...ClientOption) (*ClusterTransferLeadershipOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewClusterTransferLeadershipParams()
|
|
}
|
|
op := &runtime.ClientOperation{
|
|
ID: "clusterTransferLeadership",
|
|
Method: "POST",
|
|
PathPattern: "/cluster/transfer-leadership",
|
|
ProducesMediaTypes: []string{"application/json"},
|
|
ConsumesMediaTypes: []string{"application/json"},
|
|
Schemes: []string{"https"},
|
|
Params: params,
|
|
Reader: &ClusterTransferLeadershipReader{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.(*ClusterTransferLeadershipOK)
|
|
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 clusterTransferLeadership: 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
|
|
}
|