Name: google-cloud-java
Owner: Google Cloud Platform
Description: Google Cloud Client Library for Java
Created: 2014-11-04 17:57:16.0
Updated: 2018-01-18 10:45:09.0
Pushed: 2018-01-18 17:26:27.0
Homepage: https://googlecloudplatform.github.io/google-cloud-java/
Size: 243974
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Java idiomatic client for Google Cloud Platform services.
This library supports the following Google Cloud Platform services with clients at a GA quality level:
This library supports the following Google Cloud Platform services with clients at a Beta quality level:
This library supports the following Google Cloud Platform services with clients at an Alpha quality level:
These libraries are deprecated and no longer receive updates:
The easy way to get started is to add the umbrella package which pulls in all of the supported clients as dependencies. Note that even though the version of the umbrella package is Alpha, the individual clients are at different support levels (Alpha, Beta, and GA).
If you are using Maven, add this to your pom.xml file
endency>
roupId>com.google.cloud</groupId>
rtifactId>google-cloud</artifactId>
ersion>0.33.0-alpha</version>
pendency>
If you are using Gradle, add this to your dependencies
ile 'com.google.cloud:google-cloud:0.33.0-alpha'
If you are using SBT, add this to your dependencies
aryDependencies += "com.google.cloud" % "google-cloud" % "0.33.0-alpha"
It also works just as well to declare a dependency only on the specific clients that you need. See the README of each client for instructions.
For running on Google App Engine, see more instructions here.
If you are running into problems with version conflicts, see Version Management.
Most google-cloud
libraries require a project ID. There are multiple ways to specify this project ID.
When using google-cloud
libraries from within Compute/App Engine, there's no need to specify a project ID. It is automatically inferred from the production environment.
When using google-cloud
elsewhere, you can do one of the following:
Supply the project ID when building the service options. For example, to use Datastore from a project with ID “PROJECT_ID”, you can write:
store datastore = DatastoreOptions.newBuilder().setProjectId("PROJECT_ID").build().getService();
Specify the environment variable GOOGLE_CLOUD_PROJECT
to be your desired project ID.
Set the project ID using the Google Cloud SDK. To use the SDK, download the SDK if you haven't already, and set the project ID from the command line. For example:
ud config set project PROJECT_ID
google-cloud
determines the project ID from the following sources in the listed order, stopping once it finds a value:
GOOGLE_CLOUD_PROJECT
GOOGLE_APPLICATION_CREDENTIALS
environment variableIn cases where the library may expect a project ID explicitly, we provide a helper that can provide the inferred project ID:
import com.google.cloud.ServiceOptions;
...
String projectId = ServiceOptions.getDefaultProjectId();
google-cloud-java
uses
https://github.com/google/google-auth-library-java
to authenticate requests. google-auth-library-java
supports a wide range of authentication types;
see the project's README
and javadoc for more
details.
To access Google Cloud services, you first need to ensure that the necessary Google Cloud APIs are enabled for your project. To do this, follow the instructions on the authentication document shared by all the Google Cloud language libraries.
Next, choose a method for authenticating API requests from within your project:
google-cloud
libraries from within Compute/App Engine, no additional authentication
steps are necessary. For example:age storage = StorageOptions.getDefaultInstance().getService();
google-cloud
libraries elsewhere, there are several options:rt GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/key.json
age storage = StorageOptions.newBuilder()
Credentials(ServiceAccountCredentials.fromStream(new FileInputStream("/path/to/my/key.json")))
ld()
Service();
gcloud auth application-default login
, and then google-cloud
will automatically detect such
credentials.age storage = StorageOptions.newBuilder()
etCredentials(new GoogleCredentials(new AccessToken(accessToken, expirationTime)))
uild()
etService();
If no credentials are provided, google-cloud
will attempt to detect them from the environment
using GoogleCredentials.getApplicationDefault()
which will search for Application Default
Credentials in the following locations (in order):
GOOGLE_APPLICATION_CREDENTIALS
environment variablegcloud auth application-default login
commandTo get help, follow the instructions in the shared Troubleshooting document.
Clients in this repository use either HTTP or gRPC for the transport layer. The README of each client documents the transport layer the client uses.
For HTTP clients, a proxy can be configured by using http.proxyHost
and
related system properties as documented by
Java Networking and Proxies.
For gRPC clients, a proxy can be configured by using the
GRPC_PROXY_EXP
environment variable as documented by
the gRPC release notes.
Please note that gRPC proxy support is currently experimental.
Java 7 or above is required for using the clients in this repository.
Clients in this repository use either HTTP or gRPC for the transport layer. All HTTP-based clients should work in all environments.
For clients that use gRPC, the supported platforms are constrained by the platforms that Forked Tomcat Native supports, which for architectures means only x86_64, and for operating systems means Mac OS X, Windows, and Linux. Additionally, gRPC constrains the use of platforms with threading restrictions.
Thus, the following are not supported:
The following environments should work (among others):
This library provides tools to help write tests for code that uses google-cloud services.
See TESTING to read more about using our testing helpers.
This library follows Semantic Versioning, but with some additional qualifications:
Components marked with @BetaApi
are considered to be “0.x” features inside
a “1.x” library. This means they can change between minor and patch releases
in incompatible ways. These features should not be used by any library “B”
that itself has consumers, unless the components of library B that use
@BetaApi
features are also marked with @BetaApi
. Features marked as
@BetaApi
are on a path to eventually become “1.x” features with the marker
removed.
Special exception for google-cloud-java: google-cloud-java is
allowed to depend on @BetaApi
features in gax-java without declaring the consuming
code @BetaApi
, because gax-java and google-cloud-java move in step
with each other. For this reason, gax-java should not be used
independently of google-cloud-java.
Components marked with @InternalApi
are technically public, but are only
public for technical reasons, because of the limitations of Java's access
modifiers. For the purposes of semver, they should be considered private.
Please note it is currently under active development. Any release versioned 0.x.y is subject to backwards incompatible changes at any time.
GA: Libraries defined at a GA quality level are expected to be stable and all updates in the libraries are guaranteed to be backwards-compatible. Any backwards-incompatible changes will lead to the major version increment (1.x.y -> 2.0.0).
Beta: Libraries defined at a Beta quality level are expected to be mostly stable and we're working towards their release candidate. We will address issues and requests with a higher priority.
Alpha: Libraries defined at an Alpha quality level are still a work-in-progress and are more likely to get backwards-incompatible updates.
The easiest way to solve version conflicts is to use google-cloud's BOM. In Maven, add the following to your POM:
ependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-bom</artifactId>
<version>0.33.0-alpha</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
dependencyManagement>
This BOM is only available starting at version 0.32.0-alpha. If you are having problems with prior versions of google-cloud, use the following table as a reference to make sure that your versions are compatible. Definitions:
Something to be aware of is that a package can be promoted from alpha -> beta or beta -> GA between versions, which means that after a certain point for any given package, the alpha or beta version won't be valid any more.
alpha | beta | GA | gax | gax-grpc ————- | ———— | ———- | ———- | ——– 0.30.0-alpha | 0.30.0-beta | 1.12.0 | 1.15.0 | 1.15.0 0.29.0-alpha | 0.29.0-beta | 1.11.0 | 1.15.0 | 1.15.0 0.28.0-alpha | 0.28.0-beta | 1.10.0 | 1.14.0 | 1.14.0 0.27.0-alpha | 0.27.0-beta | 1.9.0 | 1.13.0 | 0.30.0 0.26.0-alpha | 0.26.0-beta | 1.8.0 | 1.9.0 | 0.26.0 0.25.0-alpha | 0.25.0-beta | 1.7.0 | 1.8.1 | 0.25.1 0.24.0-alpha | 0.24.0-beta | 1.6.0 | 1.8.1 | 0.25.1 0.23.1-alpha | 0.23.1-beta | 1.5.1 | 1.8.1 | 0.25.1 0.23.0-alpha | 0.23.0-beta | 1.5.0 | 1.5.0 | 0.22.0 0.22.0-alpha | 0.22.0-beta | 1.4.0 | 1.5.0 | 0.22.0 0.21.1-alpha | 0.21.1-beta | 1.3.1 | 1.5.0 | 0.22.0 0.21.0-alpha | 0.21.0-beta | 1.3.0 | 1.5.0 | 0.22.0 0.20.3-alpha | 0.20.3-beta | 1.2.3 | 1.4.2 | 0.21.2 0.20.2-alpha | 0.20.2-beta | 1.2.2 | 1.4.2 | 0.21.2 0.20.1-alpha | 0.20.1-beta | 1.2.1 | 1.4.1 | 0.21.1 0.20.0-alpha | 0.20.0-beta | 1.2.0 | 1.3.1 | 0.20.0 0.19.0-alpha | 0.19.0-beta | 1.1.0 | 1.3.0 | 0.19.0 0.18.0-alpha | 0.18.0-beta | 1.0.2 | 1.1.0 | 0.17.0 0.17.2-alpha | 0.17.2-beta | 1.0.1 | 1.0.0 | 0.16.0 0.17.1-alpha | 0.17.1-beta | 1.0.0 | 1.0.0 | 0.16.0 0.17.0-alpha | 0.17.0-beta | 1.0.0-rc4 | 1.0.0-rc1 | 0.15.0
Contributions to this library are always welcome and highly encouraged.
See google-cloud
's CONTRIBUTING documentation and the shared documentation for more information on how to get started.
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. See Code of Conduct for more information.
Apache 2.0 - See LICENSE for more information.