2019-11-07 19:05:39 +00:00
# Google Cloud Client Libraries for Go
2021-01-13 10:19:05 +00:00
[![Go Reference ](https://pkg.go.dev/badge/cloud.google.com/go.svg )](https://pkg.go.dev/cloud.google.com/go)
2019-11-07 19:05:39 +00:00
Go packages for [Google Cloud Platform ](https://cloud.google.com ) services.
``` go
import "cloud.google.com/go"
```
To install the packages on your system, *do not clone the repo* . Instead:
1. Change to your project directory:
2021-07-15 09:56:59 +00:00
```bash
2019-11-07 19:05:39 +00:00
cd /my/cloud/project
```
1. Get the package you want to use. Some products have their own module, so it's
best to `go get` the package(s) you want to use:
```
$ go get cloud.google.com/go/firestore # Replace with the package you want to use.
```
**NOTE:** Some of these packages are under development, and may occasionally
make backwards-incompatible changes.
## Supported APIs
2021-09-30 14:54:37 +00:00
For an updated list of all of our released APIs please see our
[reference docs ](https://cloud.google.com/go/docs/reference ).
2019-11-07 19:05:39 +00:00
2020-09-16 22:44:08 +00:00
## [Go Versions Supported](#supported-versions)
2019-11-07 19:05:39 +00:00
2022-04-21 13:00:47 +00:00
Our libraries are compatible with at least the three most recent, major Go
releases. They are currently compatible with:
2022-05-04 20:50:38 +00:00
- Go 1.18
2022-04-21 13:00:47 +00:00
- Go 1.17
- Go 1.16
- Go 1.15
2019-11-07 19:05:39 +00:00
## Authorization
By default, each API will use [Google Application Default Credentials ](https://developers.google.com/identity/protocols/application-default-credentials )
for authorization credentials used in calling the API endpoints. This will allow your
application to run in many environments without requiring explicit configuration.
[snip]:# (auth)
```go
client, err := storage.NewClient(ctx)
```
To authorize using a
[JSON key file ](https://cloud.google.com/iam/docs/managing-service-account-keys ),
pass
2020-03-12 16:11:27 +00:00
[`option.WithCredentialsFile` ](https://pkg.go.dev/google.golang.org/api/option#WithCredentialsFile )
2019-11-07 19:05:39 +00:00
to the `NewClient` function of the desired package. For example:
[snip]:# (auth-JSON)
```go
client, err := storage.NewClient(ctx, option.WithCredentialsFile("path/to/keyfile.json"))
```
You can exert more control over authorization by using the
2020-03-12 16:11:27 +00:00
[`golang.org/x/oauth2` ](https://pkg.go.dev/golang.org/x/oauth2 ) package to
2019-11-07 19:05:39 +00:00
create an `oauth2.TokenSource` . Then pass
2020-03-12 16:11:27 +00:00
[`option.WithTokenSource` ](https://pkg.go.dev/google.golang.org/api/option#WithTokenSource )
2019-11-07 19:05:39 +00:00
to the `NewClient` function:
[snip]:# (auth-ts)
```go
tokenSource := ...
client, err := storage.NewClient(ctx, option.WithTokenSource(tokenSource))
```
## Contributing
Contributions are welcome. Please, see the
2021-12-06 07:56:06 +00:00
[CONTRIBUTING ](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/main/CONTRIBUTING.md )
2020-06-25 20:42:41 +00:00
document for details.
2019-11-07 19:05:39 +00:00
Please note that this project is released with a Contributor Code of Conduct.
By participating in this project you agree to abide by its terms.
2021-12-06 07:56:06 +00:00
See [Contributor Code of Conduct ](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/main/CONTRIBUTING.md#contributor-code-of-conduct )
2019-11-07 19:05:39 +00:00
for more information.
2019-11-19 19:34:00 +00:00
[cloud-asset]: https://cloud.google.com/security-command-center/docs/how-to-asset-inventory
[cloud-automl]: https://cloud.google.com/automl
[cloud-build]: https://cloud.google.com/cloud-build/
2019-11-07 19:05:39 +00:00
[cloud-bigquery]: https://cloud.google.com/bigquery/
2019-11-19 19:34:00 +00:00
[cloud-bigtable]: https://cloud.google.com/bigtable/
2021-07-26 13:01:28 +00:00
[cloud-compute]: https://cloud.google.com/compute
2019-11-07 19:05:39 +00:00
[cloud-container]: https://cloud.google.com/containers/
2019-11-19 19:34:00 +00:00
[cloud-containeranalysis]: https://cloud.google.com/container-registry/docs/container-analysis
[cloud-dataproc]: https://cloud.google.com/dataproc/
[cloud-datastore]: https://cloud.google.com/datastore/
[cloud-dialogflow]: https://cloud.google.com/dialogflow-enterprise/
2019-11-07 19:05:39 +00:00
[cloud-debugger]: https://cloud.google.com/debugger/
[cloud-dlp]: https://cloud.google.com/dlp/
2019-11-19 19:34:00 +00:00
[cloud-errors]: https://cloud.google.com/error-reporting/
[cloud-firestore]: https://cloud.google.com/firestore/
2019-11-07 19:05:39 +00:00
[cloud-iam]: https://cloud.google.com/iam/
2019-11-19 19:34:00 +00:00
[cloud-iot]: https://cloud.google.com/iot-core/
[cloud-irm]: https://cloud.google.com/incident-response/docs/concepts
2019-11-07 19:05:39 +00:00
[cloud-kms]: https://cloud.google.com/kms/
2019-11-19 19:34:00 +00:00
[cloud-pubsub]: https://cloud.google.com/pubsub/
2021-02-28 12:51:43 +00:00
[cloud-pubsublite]: https://cloud.google.com/pubsub/lite
2019-11-19 19:34:00 +00:00
[cloud-storage]: https://cloud.google.com/storage/
[cloud-language]: https://cloud.google.com/natural-language
[cloud-logging]: https://cloud.google.com/logging/
2019-11-07 19:05:39 +00:00
[cloud-natural-language]: https://cloud.google.com/natural-language/
[cloud-memorystore]: https://cloud.google.com/memorystore/
2019-11-19 19:34:00 +00:00
[cloud-monitoring]: https://cloud.google.com/monitoring/
[cloud-oslogin]: https://cloud.google.com/compute/docs/oslogin/rest
[cloud-phishingprotection]: https://cloud.google.com/phishing-protection/
[cloud-securitycenter]: https://cloud.google.com/security-command-center/
[cloud-scheduler]: https://cloud.google.com/scheduler
[cloud-spanner]: https://cloud.google.com/spanner/
[cloud-speech]: https://cloud.google.com/speech
[cloud-talent]: https://cloud.google.com/solutions/talent-solution/
[cloud-tasks]: https://cloud.google.com/tasks/
2019-11-07 19:05:39 +00:00
[cloud-texttospeech]: https://cloud.google.com/texttospeech/
2019-11-19 19:34:00 +00:00
[cloud-talent]: https://cloud.google.com/solutions/talent-solution/
2019-11-07 19:05:39 +00:00
[cloud-trace]: https://cloud.google.com/trace/
2019-11-19 19:34:00 +00:00
[cloud-translate]: https://cloud.google.com/translate
2019-11-07 19:05:39 +00:00
[cloud-recaptcha]: https://cloud.google.com/recaptcha-enterprise/
2019-11-19 19:34:00 +00:00
[cloud-recommender]: https://cloud.google.com/recommendations/
[cloud-video]: https://cloud.google.com/video-intelligence/
[cloud-vision]: https://cloud.google.com/vision
[cloud-webrisk]: https://cloud.google.com/web-risk/
2020-12-11 21:30:42 +00:00
## Links
- [Go on Google Cloud ](https://cloud.google.com/go/home )
- [Getting started with Go on Google Cloud ](https://cloud.google.com/go/getting-started )
- [App Engine Quickstart ](https://cloud.google.com/appengine/docs/standard/go/quickstart )
- [Cloud Functions Quickstart ](https://cloud.google.com/functions/docs/quickstart-go )
- [Cloud Run Quickstart ](https://cloud.google.com/run/docs/quickstarts/build-and-deploy#go )