-
Notifications
You must be signed in to change notification settings - Fork 679
/
p2_p_client.go
98 lines (84 loc) · 2.9 KB
/
p2_p_client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/* _ _
*__ _____ __ ___ ___ __ _| |_ ___
*\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
* \ V V / __/ (_| |\ V /| | (_| | || __/
* \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
*
* Copyright © 2016 - 2019 Weaviate. All rights reserved.
* LICENSE: https://github.com/creativesoftwarefdn/weaviate/blob/develop/LICENSE.md
* DESIGN & CONCEPT: Bob van Luijt (@bobvanluijt)
* CONTACT: hello@creativesoftwarefdn.org
*/ // Code generated by go-swagger; DO NOT EDIT.
package p2_p
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
)
// New creates a new p2 p API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for p2 p API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
WeaviateP2pGenesisUpdate Receive an update from the Genesis server.
*/
func (a *Client) WeaviateP2pGenesisUpdate(params *WeaviateP2pGenesisUpdateParams) (*WeaviateP2pGenesisUpdateOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewWeaviateP2pGenesisUpdateParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "weaviate.p2p.genesis_update",
Method: "PUT",
PathPattern: "/p2p/genesis",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &WeaviateP2pGenesisUpdateReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*WeaviateP2pGenesisUpdateOK), nil
}
/*
WeaviateP2pHealth checks if a peer is alive
Check if a peer is alive and healthy.
*/
func (a *Client) WeaviateP2pHealth(params *WeaviateP2pHealthParams) (*WeaviateP2pHealthOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewWeaviateP2pHealthParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "weaviate.p2p.health",
Method: "GET",
PathPattern: "/p2p/health",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &WeaviateP2pHealthReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*WeaviateP2pHealthOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}