2018-04-18 21:55:50 +00:00
# Google Cloud Client Libraries for Go
2017-03-06 09:17:55 +00:00
2022-03-10 21:26:02 +00:00
[![Go Reference ](https://pkg.go.dev/badge/cloud.google.com/go.svg )](https://pkg.go.dev/cloud.google.com/go)
2017-03-06 09:17:55 +00:00
2018-04-18 21:55:50 +00:00
Go packages for [Google Cloud Platform ](https://cloud.google.com ) services.
2017-03-06 09:17:55 +00:00
``` go
import "cloud.google.com/go"
```
2022-01-10 11:01:48 +00:00
To install the packages on your system, *do not clone the repo* . Instead:
2017-03-06 09:17:55 +00:00
2022-01-10 11:01:48 +00:00
1. Change to your project directory:
2022-02-17 22:49:31 +00:00
```bash
2022-01-10 11:01:48 +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.
```
2017-03-06 09:17:55 +00:00
2018-04-18 21:55:50 +00:00
**NOTE:** Some of these packages are under development, and may occasionally
make backwards-incompatible changes.
2017-03-06 09:17:55 +00:00
2018-04-18 21:55:50 +00:00
## Supported APIs
2022-11-23 17:25:17 +00:00
For an updated list of all of our released APIs please see our
[reference docs ](https://cloud.google.com/go/docs/reference ).
2017-03-06 09:17:55 +00:00
2022-03-10 21:26:02 +00:00
## [Go Versions Supported](#supported-versions)
2017-03-06 09:17:55 +00:00
2022-11-23 17:25:17 +00:00
Our libraries are compatible with at least the three most recent, major Go
releases. They are currently compatible with:
2023-07-19 14:04:42 +00:00
- Go 1.20
2023-07-19 14:32:42 +00:00
- Go 1.19
2022-11-23 17:25:17 +00:00
- Go 1.18
- Go 1.17
2017-03-06 09:17:55 +00:00
## Authorization
2019-08-26 13:47:02 +00:00
By default, each API will use [Google Application Default Credentials ](https://developers.google.com/identity/protocols/application-default-credentials )
2017-03-06 09:17:55 +00:00
for authorization credentials used in calling the API endpoints. This will allow your
application to run in many environments without requiring explicit configuration.
2018-04-18 21:55:50 +00:00
[snip]:# (auth)
```go
client, err := storage.NewClient(ctx)
```
2017-03-06 09:17:55 +00:00
To authorize using a
[JSON key file ](https://cloud.google.com/iam/docs/managing-service-account-keys ),
pass
2022-01-10 11:01:48 +00:00
[`option.WithCredentialsFile` ](https://pkg.go.dev/google.golang.org/api/option#WithCredentialsFile )
2017-03-06 09:17:55 +00:00
to the `NewClient` function of the desired package. For example:
2018-04-18 21:55:50 +00:00
[snip]:# (auth-JSON)
2017-03-06 09:17:55 +00:00
```go
2019-08-26 13:47:02 +00:00
client, err := storage.NewClient(ctx, option.WithCredentialsFile("path/to/keyfile.json"))
2017-03-06 09:17:55 +00:00
```
You can exert more control over authorization by using the
2022-01-10 11:01:48 +00:00
[`golang.org/x/oauth2` ](https://pkg.go.dev/golang.org/x/oauth2 ) package to
2017-03-06 09:17:55 +00:00
create an `oauth2.TokenSource` . Then pass
2022-01-10 11:01:48 +00:00
[`option.WithTokenSource` ](https://pkg.go.dev/google.golang.org/api/option#WithTokenSource )
2017-03-06 09:17:55 +00:00
to the `NewClient` function:
2018-04-18 21:55:50 +00:00
[snip]:# (auth-ts)
2017-03-06 09:17:55 +00:00
```go
tokenSource := ...
client, err := storage.NewClient(ctx, option.WithTokenSource(tokenSource))
```
## Contributing
Contributions are welcome. Please, see the
2022-11-23 17:25:17 +00:00
[CONTRIBUTING ](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/main/CONTRIBUTING.md )
2022-01-10 11:01:48 +00:00
document for details.
2017-03-06 09:17:55 +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.
2022-11-23 17:25:17 +00:00
See [Contributor Code of Conduct ](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/main/CONTRIBUTING.md#contributor-code-of-conduct )
2017-03-06 09:17:55 +00:00
for more information.
2022-01-10 11:01:48 +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/
2017-03-06 09:17:55 +00:00
[cloud-bigquery]: https://cloud.google.com/bigquery/
2022-01-10 11:01:48 +00:00
[cloud-bigtable]: https://cloud.google.com/bigtable/
2022-02-17 22:49:31 +00:00
[cloud-compute]: https://cloud.google.com/compute
2018-04-18 21:55:50 +00:00
[cloud-container]: https://cloud.google.com/containers/
2022-01-10 11:01:48 +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/
2018-04-18 21:55:50 +00:00
[cloud-debugger]: https://cloud.google.com/debugger/
[cloud-dlp]: https://cloud.google.com/dlp/
2022-01-10 11:01:48 +00:00
[cloud-errors]: https://cloud.google.com/error-reporting/
[cloud-firestore]: https://cloud.google.com/firestore/
2019-08-26 13:47:02 +00:00
[cloud-iam]: https://cloud.google.com/iam/
2022-01-10 11:01:48 +00:00
[cloud-iot]: https://cloud.google.com/iot-core/
[cloud-irm]: https://cloud.google.com/incident-response/docs/concepts
2019-08-26 13:47:02 +00:00
[cloud-kms]: https://cloud.google.com/kms/
2022-01-10 11:01:48 +00:00
[cloud-pubsub]: https://cloud.google.com/pubsub/
2022-03-10 21:26:02 +00:00
[cloud-pubsublite]: https://cloud.google.com/pubsub/lite
2022-01-10 11:01:48 +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-08-26 13:47:02 +00:00
[cloud-natural-language]: https://cloud.google.com/natural-language/
[cloud-memorystore]: https://cloud.google.com/memorystore/
2022-01-10 11:01:48 +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-08-26 13:47:02 +00:00
[cloud-texttospeech]: https://cloud.google.com/texttospeech/
2022-01-10 11:01:48 +00:00
[cloud-talent]: https://cloud.google.com/solutions/talent-solution/
2019-08-26 13:47:02 +00:00
[cloud-trace]: https://cloud.google.com/trace/
2022-01-10 11:01:48 +00:00
[cloud-translate]: https://cloud.google.com/translate
2019-08-26 13:47:02 +00:00
[cloud-recaptcha]: https://cloud.google.com/recaptcha-enterprise/
2022-01-10 11:01:48 +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/
2022-03-10 21:26:02 +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 )