-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathagent.go
161 lines (108 loc) · 5.58 KB
/
agent.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// Code generated by "mock-api-gen -type Consul -pkg mockconsul -endpoints agent.json -output ./agent.go"; DO NOT EDIT.
package mockconsul
import (
"fmt"
"io"
"github.com/hashicorp/consul/api"
mockapi "github.com/mkeeler/mock-http-api"
)
func (m *Consul) AgentCheckDeregister(checkID string, status int) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("PUT", fmt.Sprintf("/v1/agent/check/deregister/%s", checkID))
return m.WithNoResponseBody(req, status)
}
func (m *Consul) AgentCheckRegister(body *api.AgentCheckRegistration, status int) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("PUT", "/v1/agent/check/register").WithBody(body)
return m.WithNoResponseBody(req, status)
}
func (m *Consul) AgentCheckUpdateTLL(checkID string, body map[string]interface{}, status int) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("PUT", fmt.Sprintf("/v1/agent/check/update/%s", checkID)).WithBody(body)
return m.WithNoResponseBody(req, status)
}
func (m *Consul) AgentChecks(status int, reply map[string]*api.AgentCheck) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("GET", "/v1/agent/checks")
return m.WithJSONReply(req, status, reply)
}
func (m *Consul) AgentConnectAuthorize(body *api.AgentAuthorizeParams, status int) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("POST", "/v1/agent/connect/authorize").WithBody(body)
return m.WithNoResponseBody(req, status)
}
func (m *Consul) AgentConnectCALeaf(serviceID string, status int, reply *api.LeafCert) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("GET", fmt.Sprintf("/v1/agent/connect/ca/leaf/%s", serviceID))
return m.WithJSONReply(req, status, reply)
}
func (m *Consul) AgentConnectCARoots(status int, reply *api.CARootList) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("GET", "/v1/agent/connect/ca/roots")
return m.WithJSONReply(req, status, reply)
}
func (m *Consul) AgentForceLeave(node string, status int) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("PUT", fmt.Sprintf("/v1/agent/force-leave/%s", node))
return m.WithNoResponseBody(req, status)
}
func (m *Consul) AgentHealthServiceByID(serviceID string, status int, reply *api.AgentServiceChecksInfo) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("GET", fmt.Sprintf("/v1/agent/health/service/id/%s", serviceID))
return m.WithJSONReply(req, status, reply)
}
func (m *Consul) AgentHealthServiceByName(serviceName string, status int, reply []api.AgentServiceChecksInfo) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("GET", fmt.Sprintf("/v1/agent/health/service/name/%s", serviceName))
return m.WithJSONReply(req, status, reply)
}
func (m *Consul) AgentHost(status int, reply map[string]interface{}) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("GET", "/v1/agent/host")
return m.WithJSONReply(req, status, reply)
}
func (m *Consul) AgentJoin(address string, status int) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("PUT", fmt.Sprintf("/v1/agent/join/%s", address))
return m.WithNoResponseBody(req, status)
}
func (m *Consul) AgentLeave(status int) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("PUT", "/v1/agent/leave/%s")
return m.WithNoResponseBody(req, status)
}
func (m *Consul) AgentMaintenance(status int) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("PUT", "/v1/agent/maintenance")
return m.WithNoResponseBody(req, status)
}
func (m *Consul) AgentMembers(status int, reply []*api.AgentMember) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("GET", "/v1/agent/members")
return m.WithJSONReply(req, status, reply)
}
func (m *Consul) AgentMetrics(status int, reply *api.MetricsInfo) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("GET", "/v1/agent/metrics")
return m.WithJSONReply(req, status, reply)
}
func (m *Consul) AgentMonitor(status int, reply io.Reader) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("GET", "/v1/agent/monitor")
return m.WithStreamingReply(req, status, reply)
}
func (m *Consul) AgentReload(status int) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("PUT", "/v1/agent/reload")
return m.WithNoResponseBody(req, status)
}
func (m *Consul) AgentSelf(status int, reply map[string]map[string]interface{}) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("GET", "/v1/agent/self")
return m.WithJSONReply(req, status, reply)
}
func (m *Consul) AgentService(serviceID string, status int, reply *api.AgentService) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("GET", fmt.Sprintf("/v1/agent/service/%s", serviceID))
return m.WithJSONReply(req, status, reply)
}
func (m *Consul) AgentServiceDeregister(status int) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("PUT", "/v1/agent/service/deregister")
return m.WithNoResponseBody(req, status)
}
func (m *Consul) AgentServiceMaintenance(serviceID string, status int) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("PUT", fmt.Sprintf("/v1/agent/service/maintenance/%s", serviceID))
return m.WithNoResponseBody(req, status)
}
func (m *Consul) AgentServiceRegister(body *api.AgentServiceRegistration, status int) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("PUT", "/v1/agent/service/register").WithBody(body)
return m.WithNoResponseBody(req, status)
}
func (m *Consul) AgentServices(status int, reply map[string]*api.AgentService) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("GET", "/v1/agent/services")
return m.WithJSONReply(req, status, reply)
}
func (m *Consul) AgentTokenSet(tokenType string, body []byte, status int) *mockapi.MockAPICall {
req := mockapi.NewMockRequest("PUT", fmt.Sprintf("/v1/agent/token/%s", tokenType)).WithBody(body)
return m.WithNoResponseBody(req, status)
}