Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
*: update google golang api package locations
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Rooth committed Dec 12, 2014
1 parent 6e18560 commit 8295bd8
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 14 deletions.
2 changes: 1 addition & 1 deletion api/serialization.go
Expand Up @@ -62,7 +62,7 @@ func sendResponse(rw http.ResponseWriter, code int, resp interface{}) {
}
}

// errorEntity is a fork of "code.google.com/p/google-api-go-client/googleapi".Error
// errorEntity is a fork of "google.golang.org/api/googleapi".Error
type errorEntity struct {
// Code is the HTTP response status code and will always be populated.
Code int `json:"code"`
Expand Down
2 changes: 1 addition & 1 deletion client/http.go
Expand Up @@ -21,7 +21,7 @@ import (
"net/url"
"path"

"github.com/coreos/fleet/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi"
"github.com/coreos/fleet/Godeps/_workspace/src/google.golang.org/api/googleapi"

"github.com/coreos/fleet/machine"
"github.com/coreos/fleet/schema"
Expand Down
85 changes: 77 additions & 8 deletions schema/v1-gen.go
Expand Up @@ -4,7 +4,7 @@
//
// Usage example:
//
// import "github.com/coreos/fleet/Godeps/_workspace/src/code.google.com/p/google-api-go-client/schema/v1"
// import "github.com/coreos/fleet/Godeps/_workspace/src/google.golang.org/api/schema/v1"
// ...
// schemaService, err := schema.New(oauthHttpClient)
package schema
Expand All @@ -20,7 +20,7 @@ import (
"strconv"
"strings"

"github.com/coreos/fleet/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi"
"github.com/coreos/fleet/Godeps/_workspace/src/google.golang.org/api/googleapi"
)

// Always reference these packages, just in case the auto-generated code
Expand Down Expand Up @@ -168,13 +168,24 @@ func (c *MachinesListCall) NextPageToken(nextPageToken string) *MachinesListCall
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 *MachinesListCall) Fields(s ...googleapi.Field) *MachinesListCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}

func (c *MachinesListCall) Do() (*MachinePage, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["nextPageToken"]; ok {
params.Set("nextPageToken", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "machines")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
Expand Down Expand Up @@ -242,6 +253,14 @@ func (c *UnitStateListCall) UnitName(unitName string) *UnitStateListCall {
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 *UnitStateListCall) Fields(s ...googleapi.Field) *UnitStateListCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}

func (c *UnitStateListCall) Do() (*UnitStatePage, error) {
var body io.Reader = nil
params := make(url.Values)
Expand All @@ -255,6 +274,9 @@ func (c *UnitStateListCall) Do() (*UnitStatePage, error) {
if v, ok := c.opt_["unitName"]; ok {
params.Set("unitName", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "state")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
Expand Down Expand Up @@ -314,15 +336,27 @@ func (r *UnitsService) Delete(unitName string) *UnitsDeleteCall {
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 *UnitsDeleteCall) Fields(s ...googleapi.Field) *UnitsDeleteCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}

func (c *UnitsDeleteCall) Do() error {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "units/{unitName}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("DELETE", urls, body)
req.URL.Path = strings.Replace(req.URL.Path, "{unitName}", url.QueryEscape(c.unitName), 1)
googleapi.SetOpaque(req.URL)
googleapi.Expand(req.URL, map[string]string{
"unitName": c.unitName,
})
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
Expand Down Expand Up @@ -367,15 +401,27 @@ func (r *UnitsService) Get(unitName string) *UnitsGetCall {
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 *UnitsGetCall) Fields(s ...googleapi.Field) *UnitsGetCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}

func (c *UnitsGetCall) Do() (*Unit, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "units/{unitName}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.URL.Path = strings.Replace(req.URL.Path, "{unitName}", url.QueryEscape(c.unitName), 1)
googleapi.SetOpaque(req.URL)
googleapi.Expand(req.URL, map[string]string{
"unitName": c.unitName,
})
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
Expand Down Expand Up @@ -431,13 +477,24 @@ func (c *UnitsListCall) NextPageToken(nextPageToken string) *UnitsListCall {
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 *UnitsListCall) Fields(s ...googleapi.Field) *UnitsListCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}

func (c *UnitsListCall) Do() (*UnitPage, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["nextPageToken"]; ok {
params.Set("nextPageToken", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "units")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
Expand Down Expand Up @@ -491,6 +548,14 @@ func (r *UnitsService) Set(unitName string, unit *Unit) *UnitsSetCall {
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 *UnitsSetCall) Fields(s ...googleapi.Field) *UnitsSetCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}

func (c *UnitsSetCall) Do() error {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.unit)
Expand All @@ -500,11 +565,15 @@ func (c *UnitsSetCall) Do() error {
ctype := "application/json"
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "units/{unitName}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("PUT", urls, body)
req.URL.Path = strings.Replace(req.URL.Path, "{unitName}", url.QueryEscape(c.unitName), 1)
googleapi.SetOpaque(req.URL)
googleapi.Expand(req.URL, map[string]string{
"unitName": c.unitName,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
Expand Down
6 changes: 3 additions & 3 deletions scripts/schema-generator
Expand Up @@ -5,7 +5,7 @@ OUT="schema/v1-json.go"
GEN="schema/v1-gen.go"

# See scripts/schema_generator_import.go for instructions on updating the dependency
PKG="code.google.com/p/google-api-go-client/google-api-go-generator"
PKG="google.golang.org/api/google-api-go-generator"

# First, write the discovery document into a go file so it can be served statically by the API
cat << 'EOF' > "${OUT}"
Expand All @@ -29,11 +29,11 @@ fi

# Build the bindings
GOPATH=${PWD}/gopath ./bin/google-api-go-generator \
-googleapi_pkg "code.google.com/p/google-api-go-client/googleapi" \
-googleapi_pkg "google.golang.org/api/googleapi" \
-api_json_file "${IN}" \
-output "${GEN}"


# Finally, fix the import in the bindings to refer to the vendored google-api package
sed -i -e "s%code.google.com%github.com/coreos/fleet/Godeps/_workspace/src/code.google.com%" "${GEN}"
sed -i -e "s%google.golang.org%github.com/coreos/fleet/Godeps/_workspace/src/google.golang.org%" "${GEN}"
goimports -w ${GEN}
2 changes: 1 addition & 1 deletion scripts/schema_generator_import.go
Expand Up @@ -28,4 +28,4 @@ package scripts
// 4. Run `godep save` as usual across the entire project (e.g. `godep save -r ./...`)
// 5. Revert this file (i.e. comment the line again, and revert to the original import) as it will not build properly
//
// import _ "code.google.com/p/google-api-go-client/google-api-go-generator"
// import _ "google.golang.org/api/google-api-go-generator"

0 comments on commit 8295bd8

Please sign in to comment.