internal: add copyright notices

Fixes failing tests (vet.sh is checking for copyrights).

Updates the generator to add copyrights at the top of packages, and manually
adds the copyrights to packages that are no longer being generated. The
generator always updates packages to include a copyright with the current
year.

In 2019 (and each subsequent year) this will cause generator tests to fail due
to the stubs expecting 2018, and receiving 2019. We should at that point
follow up this commit with a change to makes tests ignore year.

Change-Id: I5799929e5b70161676607a9232650381dc8b6650
Reviewed-on: https://code-review.googlesource.com/c/35750
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Eno Compton <enocom@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
254 files changed
tree: 598086e0d6e9d58346109a9c8445e81b7796bbce
  1. abusiveexperiencereport/
  2. acceleratedmobilepageurl/
  3. accesscontextmanager/
  4. adexchangebuyer/
  5. adexchangebuyer2/
  6. adexchangeseller/
  7. adexperiencereport/
  8. admin/
  9. adsense/
  10. adsensehost/
  11. alertcenter/
  12. analytics/
  13. analyticsreporting/
  14. androiddeviceprovisioning/
  15. androidenterprise/
  16. androidmanagement/
  17. androidpublisher/
  18. appengine/
  19. appsactivity/
  20. appstate/
  21. bigquery/
  22. bigquerydatatransfer/
  23. binaryauthorization/
  24. blogger/
  25. books/
  26. calendar/
  27. chat/
  28. civicinfo/
  29. classroom/
  30. cloudasset/
  31. cloudbilling/
  32. cloudbuild/
  33. clouddebugger/
  34. clouderrorreporting/
  35. cloudfunctions/
  36. cloudiot/
  37. cloudkms/
  38. cloudprofiler/
  39. cloudresourcemanager/
  40. cloudsearch/
  41. cloudshell/
  42. cloudtasks/
  43. cloudtrace/
  44. composer/
  45. compute/
  46. consumersurveys/
  47. container/
  48. content/
  49. customsearch/
  50. dataflow/
  51. dataproc/
  52. datastore/
  53. deploymentmanager/
  54. dfareporting/
  55. dialogflow/
  56. digitalassetlinks/
  57. discovery/
  58. dlp/
  59. dns/
  60. doubleclickbidmanager/
  61. doubleclicksearch/
  62. drive/
  63. examples/
  64. file/
  65. firebasedynamiclinks/
  66. firebasehosting/
  67. firebaseremoteconfig/
  68. firebaserules/
  69. firestore/
  70. fitness/
  71. fusiontables/
  72. games/
  73. gamesconfiguration/
  74. gamesmanagement/
  75. genomics/
  76. gensupport/
  77. gmail/
  78. google-api-go-generator/
  79. googleapi/
  80. groupsmigration/
  81. groupssettings/
  82. iam/
  83. iamcredentials/
  84. iap/
  85. identitytoolkit/
  86. indexing/
  87. integration-tests/
  88. internal/
  89. iterator/
  90. jobs/
  91. kgsearch/
  92. language/
  93. lib/
  94. licensing/
  95. logging/
  96. manufacturers/
  97. mirror/
  98. ml/
  99. monitoring/
  100. oauth2/
  101. option/
  102. oslogin/
  103. pagespeedonline/
  104. partners/
  105. people/
  106. photoslibrary/
  107. playcustomapp/
  108. playmoviespartner/
  109. plus/
  110. plusdomains/
  111. poly/
  112. prediction/
  113. proximitybeacon/
  114. pubsub/
  115. qpxexpress/
  116. redis/
  117. replicapool/
  118. replicapoolupdater/
  119. reseller/
  120. runtimeconfig/
  121. safebrowsing/
  122. script/
  123. searchconsole/
  124. servicebroker/
  125. serviceconsumermanagement/
  126. servicecontrol/
  127. servicemanagement/
  128. servicenetworking/
  129. serviceusage/
  130. serviceuser/
  131. sheets/
  132. siteverification/
  133. slides/
  134. sourcerepo/
  135. spanner/
  136. spectrum/
  137. speech/
  138. sqladmin/
  139. storage/
  140. storagetransfer/
  141. streetviewpublish/
  142. support/
  143. surveys/
  144. tagmanager/
  145. tasks/
  146. testing/
  147. texttospeech/
  148. toolresults/
  149. tpu/
  150. tracing/
  151. translate/
  152. transport/
  153. urlshortener/
  154. vault/
  155. videointelligence/
  156. vision/
  157. webfonts/
  158. webmasters/
  159. websecurityscanner/
  160. youtube/
  161. youtubeanalytics/
  162. youtubereporting/
  163. .gitignore
  164. .hgtags
  165. .travis.yml
  166. api-list.json
  167. AUTHORS
  168. CONTRIBUTING.md
  169. CONTRIBUTORS
  170. GettingStarted.md
  171. key.json.enc
  172. LICENSE
  173. NOTES
  174. README.md
  175. TODO
README.md

Google APIs Client Library for Go

Getting Started

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

and using:

package main

import (
	"net/http"

	"google.golang.org/api/urlshortener/v1"
)

func main() {
	svc, err := urlshortener.New(http.DefaultClient)
	// ...
}

Status

Build Status GoDoc

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.

These client libraries are officially supported by Google. However, the libraries are considered complete and are in maintenance mode. This means that we will address critical bugs and security issues but will not add any new features.

If you're working with Google Cloud Platform APIs such as Datastore or Pub/Sub, consider using the Cloud Client Libraries for Go instead. These are the new and idiomatic Go libraries targeted specifically at Google Cloud Platform Services.

The generator itself and the code it produces are beta. Some APIs are alpha/beta, and indicated as such in the import path (e.g., “google.golang.org/api/someapi/v1alpha”).

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 (
        "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.