Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: common/api/swarming/swarming/v1/swarming-gen.go

Issue 2219023003: Update APIs to use new Google cloud paths. (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: common/api/swarming/swarming/v1/swarming-gen.go
diff --git a/common/api/swarming/swarming/v1/swarming-gen.go b/common/api/swarming/swarming/v1/swarming-gen.go
index 7517c4f1177d7ca2538ece56c91409b9fea28839..0706c432ffe18031ae2155c47af471c5e939c01b 100644
--- a/common/api/swarming/swarming/v1/swarming-gen.go
+++ b/common/api/swarming/swarming/v1/swarming-gen.go
@@ -16,16 +16,15 @@ import (
"encoding/json"
"errors"
"fmt"
+ context "golang.org/x/net/context"
+ ctxhttp "golang.org/x/net/context/ctxhttp"
+ gensupport "google.golang.org/api/gensupport"
+ googleapi "google.golang.org/api/googleapi"
"io"
"net/http"
"net/url"
"strconv"
"strings"
-
- context "golang.org/x/net/context"
- ctxhttp "golang.org/x/net/context/ctxhttp"
- gensupport "google.golang.org/api/gensupport"
- googleapi "google.golang.org/api/googleapi"
)
// Always reference these packages, just in case the auto-generated code
@@ -302,6 +301,37 @@ func (s *SwarmingRpcsBotTasks) MarshalJSON() ([]byte, error) {
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
+// SwarmingRpcsBotsCount: Returns the count, as requested.
+type SwarmingRpcsBotsCount struct {
+ Busy int64 `json:"busy,omitempty,string"`
+
+ Count int64 `json:"count,omitempty,string"`
+
+ Dead int64 `json:"dead,omitempty,string"`
+
+ Now string `json:"now,omitempty"`
+
+ Quarantined int64 `json:"quarantined,omitempty,string"`
+
+ // ServerResponse contains the HTTP response code and headers from the
+ // server.
+ googleapi.ServerResponse `json:"-"`
+
+ // ForceSendFields is a list of field names (e.g. "Busy") to
+ // unconditionally include in API requests. By default, fields with
+ // empty values are omitted from API requests. However, any non-pointer,
+ // non-interface field appearing in ForceSendFields will be sent to the
+ // server regardless of whether the field is empty or not. This may be
+ // used to include empty fields in Patch requests.
+ ForceSendFields []string `json:"-"`
+}
+
+func (s *SwarmingRpcsBotsCount) MarshalJSON() ([]byte, error) {
+ type noMethod SwarmingRpcsBotsCount
+ raw := noMethod(*s)
+ return gensupport.MarshalJSON(raw, s.ForceSendFields)
+}
+
// SwarmingRpcsCancelResponse: Result of a request to cancel a task.
type SwarmingRpcsCancelResponse struct {
Ok bool `json:"ok,omitempty"`
@@ -1001,18 +1031,19 @@ func (c *BotDeleteCall) Context(ctx context.Context) *BotDeleteCall {
}
func (c *BotDeleteCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "bot/{bot_id}/delete")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"bot_id": c.botId,
})
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.bot.delete" call.
@@ -1047,8 +1078,7 @@ func (c *BotDeleteCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsDeletedRe
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -1121,21 +1151,22 @@ func (c *BotEventsCall) Context(ctx context.Context) *BotEventsCall {
}
func (c *BotEventsCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "bot/{bot_id}/events")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"bot_id": c.botId,
})
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.bot.events" call.
@@ -1170,8 +1201,7 @@ func (c *BotEventsCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsBotEvents
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -1245,21 +1275,22 @@ func (c *BotGetCall) Context(ctx context.Context) *BotGetCall {
}
func (c *BotGetCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "bot/{bot_id}/get")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"bot_id": c.botId,
})
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.bot.get" call.
@@ -1294,8 +1325,7 @@ func (c *BotGetCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsBotInfo, err
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -1372,21 +1402,22 @@ func (c *BotTasksCall) Context(ctx context.Context) *BotTasksCall {
}
func (c *BotTasksCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "bot/{bot_id}/tasks")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"bot_id": c.botId,
})
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.bot.tasks" call.
@@ -1421,8 +1452,7 @@ func (c *BotTasksCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsBotTasks,
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -1491,18 +1521,19 @@ func (c *BotTerminateCall) Context(ctx context.Context) *BotTerminateCall {
}
func (c *BotTerminateCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "bot/{bot_id}/terminate")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"bot_id": c.botId,
})
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.bot.terminate" call.
@@ -1537,8 +1568,7 @@ func (c *BotTerminateCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsTermin
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -1567,6 +1597,150 @@ func (c *BotTerminateCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsTermin
}
+// method id "swarming.bots.count":
+
+type BotsCountCall struct {
+ s *Service
+ urlParams_ gensupport.URLParams
+ ifNoneMatch_ string
+ ctx_ context.Context
+}
+
+// Count: Counts number of bots with given dimensions.
+func (r *BotsService) Count() *BotsCountCall {
+ c := &BotsCountCall{s: r.s, urlParams_: make(gensupport.URLParams)}
+ return c
+}
+
+// Cursor sets the optional parameter "cursor":
+func (c *BotsCountCall) Cursor(cursor string) *BotsCountCall {
+ c.urlParams_.Set("cursor", cursor)
+ return c
+}
+
+// Dimensions sets the optional parameter "dimensions":
+func (c *BotsCountCall) Dimensions(dimensions ...string) *BotsCountCall {
+ c.urlParams_.SetMulti("dimensions", append([]string{}, dimensions...))
+ return c
+}
+
+// Limit sets the optional parameter "limit":
+func (c *BotsCountCall) Limit(limit int64) *BotsCountCall {
+ c.urlParams_.Set("limit", fmt.Sprint(limit))
+ return c
+}
+
+// Fields allows partial responses to be retrieved. See
+// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
+// for more information.
+func (c *BotsCountCall) Fields(s ...googleapi.Field) *BotsCountCall {
+ c.urlParams_.Set("fields", googleapi.CombineFields(s))
+ return c
+}
+
+// IfNoneMatch sets the optional parameter which makes the operation
+// fail if the object's ETag matches the given value. This is useful for
+// getting updates only after the object has changed since the last
+// request. Use googleapi.IsNotModified to check whether the response
+// error from Do is the result of In-None-Match.
+func (c *BotsCountCall) IfNoneMatch(entityTag string) *BotsCountCall {
+ c.ifNoneMatch_ = entityTag
+ return c
+}
+
+// Context sets the context to be used in this call's Do method. Any
+// pending HTTP request will be aborted if the provided context is
+// canceled.
+func (c *BotsCountCall) Context(ctx context.Context) *BotsCountCall {
+ c.ctx_ = ctx
+ return c
+}
+
+func (c *BotsCountCall) doRequest(alt string) (*http.Response, error) {
+ var body io.Reader = nil
+ c.urlParams_.Set("alt", alt)
+ urls := googleapi.ResolveRelative(c.s.BasePath, "bots/count")
+ urls += "?" + c.urlParams_.Encode()
+ req, _ := http.NewRequest("GET", urls, body)
+ googleapi.SetOpaque(req.URL)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
+}
+
+// Do executes the "swarming.bots.count" call.
+// Exactly one of *SwarmingRpcsBotsCount or error will be non-nil. Any
+// non-2xx status code is an error. Response headers are in either
+// *SwarmingRpcsBotsCount.ServerResponse.Header or (if a response was
+// returned at all) in error.(*googleapi.Error).Header. Use
+// googleapi.IsNotModified to check whether the returned error was
+// because http.StatusNotModified was returned.
+func (c *BotsCountCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsBotsCount, error) {
+ gensupport.SetOptions(c.urlParams_, opts...)
+ res, err := c.doRequest("json")
+ if res != nil && res.StatusCode == http.StatusNotModified {
+ if res.Body != nil {
+ res.Body.Close()
+ }
+ return nil, &googleapi.Error{
+ Code: res.StatusCode,
+ Header: res.Header,
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ defer googleapi.CloseBody(res)
+ if err := googleapi.CheckResponse(res); err != nil {
+ return nil, err
+ }
+ ret := &SwarmingRpcsBotsCount{
+ ServerResponse: googleapi.ServerResponse{
+ Header: res.Header,
+ HTTPStatusCode: res.StatusCode,
+ },
+ }
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
+ return nil, err
+ }
+ return ret, nil
+ // {
+ // "description": "Counts number of bots with given dimensions.",
+ // "httpMethod": "GET",
+ // "id": "swarming.bots.count",
+ // "parameters": {
+ // "cursor": {
+ // "location": "query",
+ // "type": "string"
+ // },
+ // "dimensions": {
+ // "location": "query",
+ // "repeated": true,
+ // "type": "string"
+ // },
+ // "limit": {
+ // "default": "200",
+ // "format": "int64",
+ // "location": "query",
+ // "type": "string"
+ // }
+ // },
+ // "path": "bots/count",
+ // "response": {
+ // "$ref": "SwarmingRpcsBotsCount"
+ // },
+ // "scopes": [
+ // "https://www.googleapis.com/auth/userinfo.email"
+ // ]
+ // }
+
+}
+
// method id "swarming.bots.list":
type BotsListCall struct {
@@ -1627,19 +1801,20 @@ func (c *BotsListCall) Context(ctx context.Context) *BotsListCall {
}
func (c *BotsListCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "bots/list")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.SetOpaque(req.URL)
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.bots.list" call.
@@ -1674,8 +1849,7 @@ func (c *BotsListCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsBotList, e
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -1753,19 +1927,20 @@ func (c *ServerDetailsCall) Context(ctx context.Context) *ServerDetailsCall {
}
func (c *ServerDetailsCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "server/details")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.SetOpaque(req.URL)
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.server.details" call.
@@ -1800,8 +1975,7 @@ func (c *ServerDetailsCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsServe
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -1869,19 +2043,20 @@ func (c *ServerGetBootstrapCall) Context(ctx context.Context) *ServerGetBootstra
}
func (c *ServerGetBootstrapCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "server/get_bootstrap")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.SetOpaque(req.URL)
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.server.get_bootstrap" call.
@@ -1916,8 +2091,7 @@ func (c *ServerGetBootstrapCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcs
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -1992,19 +2166,20 @@ func (c *ServerGetBotConfigCall) Context(ctx context.Context) *ServerGetBotConfi
}
func (c *ServerGetBotConfigCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "server/get_bot_config")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.SetOpaque(req.URL)
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.server.get_bot_config" call.
@@ -2039,8 +2214,7 @@ func (c *ServerGetBotConfigCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcs
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -2099,21 +2273,23 @@ func (c *ServerPutBootstrapCall) Context(ctx context.Context) *ServerPutBootstra
}
func (c *ServerPutBootstrapCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.swarmingrpcsfilecontentrequest)
if err != nil {
return nil, err
}
- reqHeaders.Set("Content-Type", "application/json")
+ ctype := "application/json"
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "server/put_bootstrap")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
- req.Header = reqHeaders
googleapi.SetOpaque(req.URL)
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("Content-Type", ctype)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.server.put_bootstrap" call.
@@ -2148,8 +2324,7 @@ func (c *ServerPutBootstrapCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcs
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -2205,21 +2380,23 @@ func (c *ServerPutBotConfigCall) Context(ctx context.Context) *ServerPutBotConfi
}
func (c *ServerPutBotConfigCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.swarmingrpcsfilecontentrequest)
if err != nil {
return nil, err
}
- reqHeaders.Set("Content-Type", "application/json")
+ ctype := "application/json"
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "server/put_bot_config")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
- req.Header = reqHeaders
googleapi.SetOpaque(req.URL)
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("Content-Type", ctype)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.server.put_bot_config" call.
@@ -2254,8 +2431,7 @@ func (c *ServerPutBotConfigCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcs
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -2312,18 +2488,19 @@ func (c *TaskCancelCall) Context(ctx context.Context) *TaskCancelCall {
}
func (c *TaskCancelCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "task/{task_id}/cancel")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"task_id": c.taskId,
})
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.task.cancel" call.
@@ -2358,8 +2535,7 @@ func (c *TaskCancelCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsCancelRe
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -2432,21 +2608,22 @@ func (c *TaskRequestCall) Context(ctx context.Context) *TaskRequestCall {
}
func (c *TaskRequestCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "task/{task_id}/request")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"task_id": c.taskId,
})
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.task.request" call.
@@ -2481,8 +2658,7 @@ func (c *TaskRequestCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsTaskReq
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -2566,21 +2742,22 @@ func (c *TaskResultCall) Context(ctx context.Context) *TaskResultCall {
}
func (c *TaskResultCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "task/{task_id}/result")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"task_id": c.taskId,
})
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.task.result" call.
@@ -2615,8 +2792,7 @@ func (c *TaskResultCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsTaskResu
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -2693,21 +2869,22 @@ func (c *TaskStdoutCall) Context(ctx context.Context) *TaskStdoutCall {
}
func (c *TaskStdoutCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "task/{task_id}/stdout")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"task_id": c.taskId,
})
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.task.stdout" call.
@@ -2742,8 +2919,7 @@ func (c *TaskStdoutCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsTaskOutp
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -2852,19 +3028,20 @@ func (c *TasksCountCall) Context(ctx context.Context) *TasksCountCall {
}
func (c *TasksCountCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "tasks/count")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.SetOpaque(req.URL)
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.tasks.count" call.
@@ -2899,8 +3076,7 @@ func (c *TasksCountCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsTasksCou
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -3081,19 +3257,20 @@ func (c *TasksListCall) Context(ctx context.Context) *TasksListCall {
}
func (c *TasksListCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "tasks/list")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.SetOpaque(req.URL)
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.tasks.list" call.
@@ -3128,8 +3305,7 @@ func (c *TasksListCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsTaskList,
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -3264,21 +3440,23 @@ func (c *TasksNewCall) Context(ctx context.Context) *TasksNewCall {
}
func (c *TasksNewCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.swarmingrpcsnewtaskrequest)
if err != nil {
return nil, err
}
- reqHeaders.Set("Content-Type", "application/json")
+ ctype := "application/json"
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "tasks/new")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
- req.Header = reqHeaders
googleapi.SetOpaque(req.URL)
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("Content-Type", ctype)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.tasks.new" call.
@@ -3313,8 +3491,7 @@ func (c *TasksNewCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsTaskReques
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
@@ -3449,19 +3626,20 @@ func (c *TasksRequestsCall) Context(ctx context.Context) *TasksRequestsCall {
}
func (c *TasksRequestsCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "tasks/requests")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.SetOpaque(req.URL)
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
+ req.Header.Set("User-Agent", c.s.userAgent())
+ if c.ifNoneMatch_ != "" {
+ req.Header.Set("If-None-Match", c.ifNoneMatch_)
+ }
+ if c.ctx_ != nil {
+ return ctxhttp.Do(c.ctx_, c.s.client, req)
+ }
+ return c.s.client.Do(req)
}
// Do executes the "swarming.tasks.requests" call.
@@ -3496,8 +3674,7 @@ func (c *TasksRequestsCall) Do(opts ...googleapi.CallOption) (*SwarmingRpcsTaskR
HTTPStatusCode: res.StatusCode,
},
}
- target := &ret
- if err := json.NewDecoder(res.Body).Decode(target); err != nil {
+ if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil

Powered by Google App Engine
This is Rietveld 408576698