gen: support for x-goog-api-client header

Follows the spec for this header, designed for internal
reporting. There is a hook for Google client libraries built on top of
these clients to add their own information.

Change-Id: I34c580b96ba8815de95def037acdfc3a9026925e
Reviewed-on: https://code-review.googlesource.com/10851
Reviewed-by: Jonathan Amsterdam <jba@google.com>
27 files changed
tree: 9aacf00a07b7905c22491480d1f6b6dbe625b49d
  1. acceleratedmobilepageurl/
  2. adexchangebuyer/
  3. adexchangebuyer2/
  4. adexchangeseller/
  5. admin/
  6. adsense/
  7. adsensehost/
  8. analytics/
  9. analyticsreporting/
  10. androidenterprise/
  11. androidpublisher/
  12. appengine/
  13. appsactivity/
  14. appstate/
  15. autoscaler/
  16. bigquery/
  17. blogger/
  18. books/
  19. calendar/
  20. civicinfo/
  21. classroom/
  22. cloudbilling/
  23. cloudbuild/
  24. clouddebugger/
  25. clouderrorreporting/
  26. cloudkms/
  27. cloudlatencytest/
  28. cloudmonitoring/
  29. cloudresourcemanager/
  30. cloudtrace/
  31. clouduseraccounts/
  32. compute/
  33. consumersurveys/
  34. container/
  35. content/
  36. coordinate/
  37. customsearch/
  38. dataflow/
  39. dataproc/
  40. datastore/
  41. deploymentmanager/
  42. dfareporting/
  43. discovery/
  44. dns/
  45. doubleclickbidmanager/
  46. doubleclicksearch/
  47. drive/
  48. examples/
  49. firebasedynamiclinks/
  50. firebaserules/
  51. fitness/
  52. freebase/
  53. fusiontables/
  54. games/
  55. gamesconfiguration/
  56. gamesmanagement/
  57. gan/
  58. genomics/
  59. gensupport/
  60. gmail/
  61. google-api-go-generator/
  62. googleapi/
  63. groupsmigration/
  64. groupssettings/
  65. iam/
  66. identitytoolkit/
  67. integration-tests/
  68. internal/
  69. iterator/
  70. kgsearch/
  71. language/
  72. lib/
  73. licensing/
  74. logging/
  75. manager/
  76. manufacturers/
  77. mapsengine/
  78. mirror/
  79. ml/
  80. monitoring/
  81. oauth2/
  82. option/
  83. pagespeedonline/
  84. partners/
  85. people/
  86. playmoviespartner/
  87. plus/
  88. plusdomains/
  89. prediction/
  90. proximitybeacon/
  91. pubsub/
  92. qpxexpress/
  93. replicapool/
  94. replicapoolupdater/
  95. reseller/
  96. resourceviews/
  97. runtimeconfig/
  98. safebrowsing/
  99. script/
  100. servicecontrol/
  101. servicemanagement/
  102. serviceregistry/
  103. sheets/
  104. siteverification/
  105. slides/
  106. spectrum/
  107. speech/
  108. sqladmin/
  109. storage/
  110. storagetransfer/
  111. support/
  112. surveys/
  113. tagmanager/
  114. taskqueue/
  115. tasks/
  116. toolresults/
  117. translate/
  118. transport/
  119. urlshortener/
  120. vision/
  121. webfonts/
  122. webmasters/
  123. youtube/
  124. youtubeanalytics/
  125. youtubereporting/
  126. .hgignore
  127. .hgtags
  128. .travis.yml
  129. api-list.json
  130. AUTHORS
  131. CONTRIBUTING.md
  132. CONTRIBUTORS
  133. GettingStarted.md
  134. key.json.enc
  135. LICENSE
  136. Makefile
  137. NOTES
  138. README.md
  139. TODO
README.md

Google APIs Client Library for Go

Status

Build Status

These are auto-generated Go libraries from the Google Discovery Service's JSON description files of the available “new style” Google APIs.

Due to the auto-generated nature of this collection of libraries, complete APIs or specific versions can appear or go away without notice. As a result, you should always locally vendor any API(s) that your code relies upon.

Announcement email:

Getting started documentation:

In summary:

$ go get google.golang.org/api/storage/v1
$ go get google.golang.org/api/tasks/v1
$ go get google.golang.org/api/moderator/v1
... etc ...

For docs, see e.g.:

The package of a given import is the second-to-last component, before the version number.

For examples, see:

For support, use the golang-nuts@ mailing list:

Application Default Credentials Example

Application Default Credentials provide a simplified way to obtain credentials for authenticating with Google APIs.

The Application Default Credentials authenticate as the application itself, which make them great for working with Google Cloud APIs like Storage or Datastore. They are the recommended form of authentication when building applications that run on Google Compute Engine or Google App Engine.

Default credentials are provided by the golang.org/x/oauth2/google package. To use them, add the following import:

import "golang.org/x/oauth2/google"

Some credentials types require you to specify scopes, and service entry points may not inject them. If you encounter this situation you may need to specify scopes as follows:

import (
        "golang.org/x/net/context"
        "golang.org/x/oauth2/google"
        "google.golang.org/api/compute/v1"
)

func main() {
        // Use oauth2.NoContext if there isn't a good context to pass in.
        ctx := context.Background()

        client, err := google.DefaultClient(ctx, compute.ComputeScope)
        if err != nil {
                //...
        }
        computeService, err := compute.New(client)
        if err != nil {
                //...
        }
}

If you need a oauth2.TokenSource, use the DefaultTokenSource function:

ts, err := google.DefaultTokenSource(ctx, scope1, scope2, ...)
if err != nil {
        //...
}
client := oauth2.NewClient(ctx, ts)

See also: golang.org/x/oauth2/google package documentation.