@@ -13,7 +13,6 @@ import (
13
13
kgxapi "github.com/akitasoftware/akita-libs/api_schema"
14
14
"github.com/akitasoftware/akita-libs/path_trie"
15
15
"github.com/akitasoftware/akita-libs/tags"
16
- "github.com/pkg/errors"
17
16
)
18
17
19
18
var (
@@ -37,7 +36,7 @@ func NewLearnClient(host string, cli akid.ClientID, svc akid.ServiceID) *learnCl
37
36
}
38
37
39
38
func (c * learnClientImpl ) ListLearnSessions (ctx context.Context , svc akid.ServiceID , tags map [tags.Key ]string , limit int , offset int ) ([]* kgxapi.ListedLearnSession , error ) {
40
- p := path .Join ("/v1 /services" , akid .String (c .serviceID ), "learn" )
39
+ p := path .Join ("/v2/agent /services" , akid .String (c .serviceID ), "learn" )
41
40
q := url.Values {}
42
41
q .Add ("limit" , strconv .Itoa (limit ))
43
42
q .Add ("offset" , strconv .Itoa (offset ))
@@ -54,7 +53,7 @@ func (c *learnClientImpl) ListLearnSessions(ctx context.Context, svc akid.Servic
54
53
}
55
54
56
55
func (c * learnClientImpl ) ListLearnSessionsWithStats (ctx context.Context , svc akid.ServiceID , limit int ) ([]* kgxapi.ListedLearnSession , error ) {
57
- p := path .Join ("/v1 /services" , akid .String (c .serviceID ), "learn" )
56
+ p := path .Join ("/v2/agent /services" , akid .String (c .serviceID ), "learn" )
58
57
q := url.Values {}
59
58
q .Add ("limit" , fmt .Sprintf ("%d" , limit ))
60
59
q .Add ("get_stats" , "true" )
@@ -67,6 +66,7 @@ func (c *learnClientImpl) ListLearnSessionsWithStats(ctx context.Context, svc ak
67
66
return resp .Sessions , nil
68
67
}
69
68
69
+ // Deprecated: Only used in learn command which is deprecated.
70
70
func (c * learnClientImpl ) GetLearnSession (ctx context.Context , svc akid.ServiceID , lrn akid.LearnSessionID ) (* kgxapi.LearnSession , error ) {
71
71
p := path .Join ("/v1/services" , akid .String (c .serviceID ), "learn" , akid .String (lrn ))
72
72
var resp kgxapi.LearnSession
@@ -80,7 +80,7 @@ func (c *learnClientImpl) GetLearnSession(ctx context.Context, svc akid.ServiceI
80
80
func (c * learnClientImpl ) CreateLearnSession (ctx context.Context , baseSpecRef * kgxapi.APISpecReference , name string , tags map [tags.Key ]string ) (akid.LearnSessionID , error ) {
81
81
req := kgxapi.CreateLearnSessionRequest {BaseAPISpecRef : baseSpecRef , Tags : tags , Name : name }
82
82
var resp kgxapi.LearnSession
83
- p := path .Join ("/v1 /services" , akid .String (c .serviceID ), "learn" )
83
+ p := path .Join ("/v2/agent /services" , akid .String (c .serviceID ), "learn" )
84
84
err := c .Post (ctx , p , req , & resp )
85
85
if err != nil {
86
86
return akid.LearnSessionID {}, err
@@ -92,10 +92,11 @@ func (c *learnClientImpl) AsyncReportsUpload(ctx context.Context, lrn akid.Learn
92
92
req .ClientID = c .clientID
93
93
resp := map [string ]interface {}{}
94
94
95
- p := path .Join ("/v1 /services" , akid .String (c .serviceID ), "learn" , akid .String (lrn ), "async_reports" )
95
+ p := path .Join ("/v2/agent /services" , akid .String (c .serviceID ), "learn" , akid .String (lrn ), "async_reports" )
96
96
return c .Post (ctx , p , req , & resp )
97
97
}
98
98
99
+ // Deprecated: Function not used anywhere.
99
100
func (c * learnClientImpl ) CreateSpec (ctx context.Context , name string , lrns []akid.LearnSessionID , opts CreateSpecOptions ) (akid.APISpecID , error ) {
100
101
// Go cannot marshal regexp into JSON unfortunately.
101
102
pathExclusions := make ([]string , len (opts .PathExclusions ))
@@ -126,6 +127,7 @@ func (c *learnClientImpl) CreateSpec(ctx context.Context, name string, lrns []ak
126
127
return resp .ID , err
127
128
}
128
129
130
+ // Deprecated: Used in legacy and get command which is deprecated.
129
131
func (c * learnClientImpl ) GetSpec (ctx context.Context , api akid.APISpecID , opts GetSpecOptions ) (kgxapi.GetSpecResponse , error ) {
130
132
qs := make (url.Values )
131
133
if ! opts .EnableRelatedTypes {
@@ -138,6 +140,7 @@ func (c *learnClientImpl) GetSpec(ctx context.Context, api akid.APISpecID, opts
138
140
return resp , err
139
141
}
140
142
143
+ // Deprecated: Used only in get command which is deprecated.
141
144
func (c * learnClientImpl ) ListSpecs (ctx context.Context ) ([]kgxapi.SpecInfo , error ) {
142
145
qs := make (url.Values )
143
146
@@ -152,6 +155,7 @@ func (c *learnClientImpl) ListSpecs(ctx context.Context) ([]kgxapi.SpecInfo, err
152
155
return resp .Specs , err
153
156
}
154
157
158
+ // Deprecated: Used in legacy commands which are deprecated.
155
159
func (c * learnClientImpl ) GetSpecVersion (ctx context.Context , version string ) (kgxapi.APISpecVersion , error ) {
156
160
var resp kgxapi.APISpecVersion
157
161
p := path .Join ("/v1/services" , akid .String (c .serviceID ), "spec-versions" , version )
@@ -162,13 +166,15 @@ func (c *learnClientImpl) GetSpecVersion(ctx context.Context, version string) (k
162
166
return resp , nil
163
167
}
164
168
169
+ // Deprecated: Used in upload command which is deprecated.
165
170
func (c * learnClientImpl ) UploadSpec (ctx context.Context , req kgxapi.UploadSpecRequest ) (* kgxapi.UploadSpecResponse , error ) {
166
171
p := path .Join ("/v1/services" , akid .String (c .serviceID ), "upload-spec" )
167
172
var resp kgxapi.UploadSpecResponse
168
173
err := c .Post (ctx , p , req , & resp )
169
174
return & resp , err
170
175
}
171
176
177
+ // Deprecated: Used in apidiff, get and set command which are deprecated.
172
178
func (c * learnClientImpl ) GetAPISpecIDByName (ctx context.Context , n string ) (akid.APISpecID , error ) {
173
179
resp := struct {
174
180
ID akid.APISpecID `json:"id"`
@@ -187,6 +193,7 @@ func (c *learnClientImpl) GetLearnSessionIDByName(ctx context.Context, n string)
187
193
return resp .ID , err
188
194
}
189
195
196
+ // Deprecated: Used in apidiff command which is deprecated.
190
197
func (c * learnClientImpl ) GetSpecDiffTrie (ctx context.Context , baseID , newID akid.APISpecID ) (* path_trie.PathTrie , error ) {
191
198
var resp path_trie.PathTrie
192
199
path := fmt .Sprintf ("/v1/services/%s/specs/%s/diff/%s/trie" ,
@@ -195,26 +202,19 @@ func (c *learnClientImpl) GetSpecDiffTrie(ctx context.Context, baseID, newID aki
195
202
return & resp , err
196
203
}
197
204
198
- func (c * learnClientImpl ) PostClientPacketCaptureStats (ctx context.Context , serviceID akid.ServiceID , deployment string , req kgxapi.PostClientPacketCaptureStatsRequest ) error {
199
- if deployment == "" {
200
- return errors .Errorf ("missing deployment tag" )
201
- }
202
-
203
- path := fmt .Sprintf ("/v1/services/%s/telemetry/client/deployment/%s" , serviceID , deployment )
205
+ func (c * learnClientImpl ) PostClientPacketCaptureStats (ctx context.Context , serviceID akid.ServiceID , req kgxapi.PostClientPacketCaptureStatsRequest ) error {
206
+ path := fmt .Sprintf ("/v2/agent/services/%s/telemetry/client/deployment" , serviceID )
204
207
var resp struct {}
205
208
return c .Post (ctx , path , req , & resp )
206
209
}
207
210
208
- func (c * learnClientImpl ) PostInitialClientTelemetry (ctx context.Context , serviceID akid.ServiceID , deployment string , req kgxapi.PostInitialClientTelemetryRequest ) error {
209
- if deployment == "" {
210
- return errors .Errorf ("missing deployment tag" )
211
- }
212
-
213
- path := fmt .Sprintf ("/v1/services/%s/telemetry/client/deployment/%s/start" , serviceID , deployment )
211
+ func (c * learnClientImpl ) PostInitialClientTelemetry (ctx context.Context , serviceID akid.ServiceID , req kgxapi.PostInitialClientTelemetryRequest ) error {
212
+ path := fmt .Sprintf ("/v2/agent/services/%s/telemetry/client/deployment/start" , serviceID )
214
213
var resp struct {}
215
214
return c .Post (ctx , path , req , & resp )
216
215
}
217
216
217
+ // Deprecated: Used in setversion command which is deprecated.
218
218
func (c * learnClientImpl ) SetSpecVersion (ctx context.Context , specID akid.APISpecID , versionName string ) error {
219
219
resp := struct {
220
220
}{}
@@ -228,6 +228,7 @@ func (c *learnClientImpl) SetSpecVersion(ctx context.Context, specID akid.APISpe
228
228
}
229
229
230
230
// Returns events aggregated in 1-minute intervals.
231
+ // Deprecated: Used in get command which is deprecated.
231
232
func (c * learnClientImpl ) GetTimeline (ctx context.Context , serviceID akid.ServiceID , deployment string , start time.Time , end time.Time , limit int ) (kgxapi.TimelineResponse , error ) {
232
233
path := fmt .Sprintf ("/v1/services/%s/timeline/%s/query" ,
233
234
akid .String (serviceID ), deployment )
@@ -249,6 +250,7 @@ func (c *learnClientImpl) GetTimeline(ctx context.Context, serviceID akid.Servic
249
250
}
250
251
251
252
// Return the edges of the service graph in the specified time window
253
+ // Deprecated: Used in get command which is deprecated.
252
254
func (c * learnClientImpl ) GetGraphEdges (ctx context.Context , serviceID akid.ServiceID , deployment string , start time.Time , end time.Time , graphType string ) (kgxapi.GraphResponse , error ) {
253
255
path := fmt .Sprintf ("/v1/services/%s/servicegraph/%s/query" ,
254
256
akid .String (serviceID ), deployment )
0 commit comments