@@ -156,7 +156,7 @@ func (c *ClusterClient) Login(ctx context.Context, sa *ServiceAccount) (*AuthTok
156
156
return nil , err
157
157
}
158
158
159
- loc := c .url ("/acs/api/v1/auth/login" )
159
+ loc := c .toURL ("/acs/api/v1/auth/login" )
160
160
req , err := http .NewRequest ("POST" , loc , bytes .NewBuffer (octets ))
161
161
if err != nil {
162
162
return nil , err
@@ -208,7 +208,7 @@ func (c *ClusterClient) Login(ctx context.Context, sa *ServiceAccount) (*AuthTok
208
208
209
209
func (c * ClusterClient ) GetSummary (ctx context.Context ) (* Summary , error ) {
210
210
summary := & Summary {}
211
- err := c .doGet (ctx , c .url ("/mesos/master/state-summary" ), summary )
211
+ err := c .doGet (ctx , c .toURL ("/mesos/master/state-summary" ), summary )
212
212
if err != nil {
213
213
return nil , err
214
214
}
@@ -220,7 +220,7 @@ func (c *ClusterClient) GetContainers(ctx context.Context, node string) ([]Conta
220
220
list := []string {}
221
221
222
222
path := fmt .Sprintf ("/system/v1/agent/%s/metrics/v0/containers" , node )
223
- err := c .doGet (ctx , c .url (path ), & list )
223
+ err := c .doGet (ctx , c .toURL (path ), & list )
224
224
if err != nil {
225
225
return nil , err
226
226
}
@@ -233,10 +233,10 @@ func (c *ClusterClient) GetContainers(ctx context.Context, node string) ([]Conta
233
233
return containers , nil
234
234
}
235
235
236
- func (c * ClusterClient ) getMetrics (ctx context.Context , url string ) (* Metrics , error ) {
236
+ func (c * ClusterClient ) getMetrics (ctx context.Context , address string ) (* Metrics , error ) {
237
237
metrics := & Metrics {}
238
238
239
- err := c .doGet (ctx , url , metrics )
239
+ err := c .doGet (ctx , address , metrics )
240
240
if err != nil {
241
241
return nil , err
242
242
}
@@ -246,21 +246,21 @@ func (c *ClusterClient) getMetrics(ctx context.Context, url string) (*Metrics, e
246
246
247
247
func (c * ClusterClient ) GetNodeMetrics (ctx context.Context , node string ) (* Metrics , error ) {
248
248
path := fmt .Sprintf ("/system/v1/agent/%s/metrics/v0/node" , node )
249
- return c .getMetrics (ctx , c .url (path ))
249
+ return c .getMetrics (ctx , c .toURL (path ))
250
250
}
251
251
252
252
func (c * ClusterClient ) GetContainerMetrics (ctx context.Context , node , container string ) (* Metrics , error ) {
253
253
path := fmt .Sprintf ("/system/v1/agent/%s/metrics/v0/containers/%s" , node , container )
254
- return c .getMetrics (ctx , c .url (path ))
254
+ return c .getMetrics (ctx , c .toURL (path ))
255
255
}
256
256
257
257
func (c * ClusterClient ) GetAppMetrics (ctx context.Context , node , container string ) (* Metrics , error ) {
258
258
path := fmt .Sprintf ("/system/v1/agent/%s/metrics/v0/containers/%s/app" , node , container )
259
- return c .getMetrics (ctx , c .url (path ))
259
+ return c .getMetrics (ctx , c .toURL (path ))
260
260
}
261
261
262
- func createGetRequest (url string , token string ) (* http.Request , error ) {
263
- req , err := http .NewRequest ("GET" , url , nil )
262
+ func createGetRequest (address string , token string ) (* http.Request , error ) {
263
+ req , err := http .NewRequest ("GET" , address , nil )
264
264
if err != nil {
265
265
return nil , err
266
266
}
@@ -273,8 +273,8 @@ func createGetRequest(url string, token string) (*http.Request, error) {
273
273
return req , nil
274
274
}
275
275
276
- func (c * ClusterClient ) doGet (ctx context.Context , url string , v interface {}) error {
277
- req , err := createGetRequest (url , c .token )
276
+ func (c * ClusterClient ) doGet (ctx context.Context , address string , v interface {}) error {
277
+ req , err := createGetRequest (address , c .token )
278
278
if err != nil {
279
279
return err
280
280
}
@@ -304,7 +304,7 @@ func (c *ClusterClient) doGet(ctx context.Context, url string, v interface{}) er
304
304
305
305
if resp .StatusCode < 200 || resp .StatusCode >= 300 {
306
306
return & APIError {
307
- URL : url ,
307
+ URL : address ,
308
308
StatusCode : resp .StatusCode ,
309
309
Title : resp .Status ,
310
310
}
@@ -318,10 +318,10 @@ func (c *ClusterClient) doGet(ctx context.Context, url string, v interface{}) er
318
318
return err
319
319
}
320
320
321
- func (c * ClusterClient ) url (path string ) string {
322
- url := * c .clusterURL
323
- url .Path = path
324
- return url .String ()
321
+ func (c * ClusterClient ) toURL (path string ) string {
322
+ clusterURL := * c .clusterURL
323
+ clusterURL .Path = path
324
+ return clusterURL .String ()
325
325
}
326
326
327
327
func (c * ClusterClient ) createLoginToken (sa * ServiceAccount ) (string , error ) {
0 commit comments