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

Unified Diff: common/api/luci_config/config/v1/config-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/luci_config/config/v1/config-gen.go
diff --git a/common/api/luci_config/config/v1/config-gen.go b/common/api/luci_config/config/v1/config-gen.go
index f7562b6058e5170c76f77e52ec0b1549d0b62c18..b5ac448f095c91c32f15e70e36ea30ac8fb61444 100644
--- a/common/api/luci_config/config/v1/config-gen.go
+++ b/common/api/luci_config/config/v1/config-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
@@ -483,22 +482,23 @@ func (c *GetConfigCall) Context(ctx context.Context) *GetConfigCall {
}
func (c *GetConfigCall) 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, "config_sets/{config_set}/config/{path}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"config_set": c.configSet,
"path": c.path,
})
- 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 "config.get_config" call.
@@ -534,8 +534,7 @@ func (c *GetConfigCall) Do(opts ...googleapi.CallOption) (*LuciConfigGetConfigRe
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
@@ -622,21 +621,22 @@ func (c *GetConfigByHashCall) Context(ctx context.Context) *GetConfigByHashCall
}
func (c *GetConfigByHashCall) 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, "config/{content_hash}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"content_hash": c.contentHash,
})
- 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 "config.get_config_by_hash" call.
@@ -673,8 +673,7 @@ func (c *GetConfigByHashCall) Do(opts ...googleapi.CallOption) (*LuciConfigGetCo
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
@@ -758,19 +757,20 @@ func (c *GetConfigSetsCall) Context(ctx context.Context) *GetConfigSetsCall {
}
func (c *GetConfigSetsCall) 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, "config-sets")
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 "config.get_config_sets" call.
@@ -806,8 +806,7 @@ func (c *GetConfigSetsCall) Do(opts ...googleapi.CallOption) (*LuciConfigGetConf
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
@@ -884,19 +883,20 @@ func (c *GetMappingCall) Context(ctx context.Context) *GetMappingCall {
}
func (c *GetMappingCall) 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, "mapping")
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 "config.get_mapping" call.
@@ -932,8 +932,7 @@ func (c *GetMappingCall) Do(opts ...googleapi.CallOption) (*LuciConfigGetMapping
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
@@ -1008,21 +1007,22 @@ func (c *GetProjectConfigsCall) Context(ctx context.Context) *GetProjectConfigsC
}
func (c *GetProjectConfigsCall) 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, "configs/projects/{path}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"path": c.path,
})
- 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 "config.get_project_configs" call.
@@ -1058,8 +1058,7 @@ func (c *GetProjectConfigsCall) Do(opts ...googleapi.CallOption) (*LuciConfigGet
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
@@ -1135,19 +1134,20 @@ func (c *GetProjectsCall) Context(ctx context.Context) *GetProjectsCall {
}
func (c *GetProjectsCall) 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, "projects")
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 "config.get_projects" call.
@@ -1183,8 +1183,7 @@ func (c *GetProjectsCall) Do(opts ...googleapi.CallOption) (*LuciConfigGetProjec
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
@@ -1253,21 +1252,22 @@ func (c *GetRefConfigsCall) Context(ctx context.Context) *GetRefConfigsCall {
}
func (c *GetRefConfigsCall) 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, "configs/refs/{path}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"path": c.path,
})
- 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 "config.get_ref_configs" call.
@@ -1303,8 +1303,7 @@ func (c *GetRefConfigsCall) Do(opts ...googleapi.CallOption) (*LuciConfigGetConf
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
@@ -1381,21 +1380,22 @@ func (c *GetRefsCall) Context(ctx context.Context) *GetRefsCall {
}
func (c *GetRefsCall) 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, "projects/{project_id}/refs")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
- req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"project_id": c.projectId,
})
- 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 "config.get_refs" call.
@@ -1430,8 +1430,7 @@ func (c *GetRefsCall) Do(opts ...googleapi.CallOption) (*LuciConfigGetRefsRespon
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
@@ -1492,16 +1491,17 @@ func (c *ReimportCall) Context(ctx context.Context) *ReimportCall {
}
func (c *ReimportCall) 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, "reimport")
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("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 "config.reimport" call.

Powered by Google App Engine
This is Rietveld 408576698