|
| 1 | +# Google Cloud Java Client for Bigtable Admin |
| 2 | + |
| 3 | +Java idiomatic client for [Cloud Bigtable Admin][cloud-bigtable]. Please note that this client is under |
| 4 | +heavy development and is not ready for production use. Please continue to use the |
| 5 | +[HBase API client](https://github.com/GoogleCloudPlatform/cloud-bigtable-client) for production. |
| 6 | + |
| 7 | +[[](https://circleci.com/gh/GoogleCloudPlatform/google-cloud-java/tree/master) |
| 8 | +[](https://coveralls.io/r/GoogleCloudPlatform/google-cloud-java?branch=master) |
| 9 | +[](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigtable-admin.svg) |
| 10 | +[](https://www.codacy.com/app/mziccard/google-cloud-java) |
| 11 | +[](https://www.versioneye.com/user/projects/58fe4c8d6ac171426c414772) |
| 12 | + |
| 13 | +- [Product Documentation][bigtable-product-docs] |
| 14 | +- [Client Library Documentation][bigtable-admin-client-lib-docs] |
| 15 | + |
| 16 | +> Note: This client is under heavy development and should not be used in production. |
| 17 | +
|
| 18 | +## Quickstart |
| 19 | + |
| 20 | +[//]: # ({x-version-update-start:google-cloud-bigtable-admin:released}) |
| 21 | +If you are using Maven, add this to your pom.xml file |
| 22 | +```xml |
| 23 | +<dependency> |
| 24 | + <groupId>com.google.cloud</groupId> |
| 25 | + <artifactId>google-cloud-bigtable-admin</artifactId> |
| 26 | + <version>0.55.1-alpha</version> |
| 27 | +</dependency> |
| 28 | +``` |
| 29 | +If you are using Gradle, add this to your dependencies |
| 30 | +```Groovy |
| 31 | +compile 'com.google.cloud:google-cloud-bigtable-admin:0.55.1-alpha' |
| 32 | +``` |
| 33 | +If you are using SBT, add this to your dependencies |
| 34 | +```Scala |
| 35 | +libraryDependencies += "com.google.cloud" % "google-cloud-bigtable-admin" % "0.55.1-alpha" |
| 36 | +``` |
| 37 | +[//]: # ({x-version-update-end}) |
| 38 | + |
| 39 | +## Authentication |
| 40 | + |
| 41 | +See the |
| 42 | +[Authentication](https://github.com/GoogleCloudPlatform/google-cloud-java#authentication) |
| 43 | +section in the base directory's README. |
| 44 | + |
| 45 | +## About Cloud Bigtable Admin |
| 46 | + |
| 47 | +[Cloud Bigtable][cloud-bigtable] is Google's NoSQL Big Data database service. It's |
| 48 | +the same database that powers many core Google services, including Search, Analytics, Maps, and |
| 49 | +Gmail. The API is split into the data api and the admin api. This client targets the admin api. |
| 50 | + |
| 51 | +Be sure to activate the Cloud Bigtable Admin API on the Developer's Console to use Cloud Bigtable |
| 52 | +from your project. |
| 53 | + |
| 54 | +See the [Bigtable Amin client lib docs][bigtable-admin-client-lib-docs] to learn how to |
| 55 | +interact with Cloud Bigtable Admin API using this Client Library. |
| 56 | + |
| 57 | +## Getting Started |
| 58 | +#### Prerequisites |
| 59 | +For this tutorial, you will need a |
| 60 | +[Google Developers Console](https://console.developers.google.com/) project with the Cloud Bigtable |
| 61 | +API enabled. You will need to |
| 62 | +[enable billing](https://support.google.com/cloud/answer/6158867?hl=en) to use Google Cloud Bigtable. |
| 63 | +[Follow these instructions](https://cloud.google.com/docs/authentication#preparation) to get your |
| 64 | +project set up. You will also need to set up the local development environment by [installing the |
| 65 | +Google Cloud SDK](https://cloud.google.com/sdk/) and running the following commands in command line: |
| 66 | +`gcloud auth login`. |
| 67 | + |
| 68 | +#### Calling Cloud Bigtable |
| 69 | + |
| 70 | +The Cloud Bigtable API is split into 2 parts: Data API, Instance Admin API and Table Admin API. |
| 71 | + |
| 72 | +Here is a code snippet showing simple usage of the Table API. Add the following imports |
| 73 | +at the top of your file: |
| 74 | + |
| 75 | + |
| 76 | +```java |
| 77 | +import com.google.bigtable.admin.v2.ColumnFamily; |
| 78 | +import com.google.bigtable.admin.v2.InstanceName; |
| 79 | +import com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient; |
| 80 | +``` |
| 81 | + |
| 82 | +Then, to create a table, use the following code: |
| 83 | +```java |
| 84 | +InstanceName instanceName = InstanceName.of("my-project", "my-instance"); |
| 85 | + |
| 86 | +TableAdminClient tableAdminClient = TableAdminClient.create(instanceName); |
| 87 | + |
| 88 | +try { |
| 89 | + CreateTable createTableReq = TableAdminRequests.createTable("tableId") |
| 90 | + .addFamily("cf2", GCRULES.maxVersions(10)); |
| 91 | + client.createTable(createTableReq); |
| 92 | + |
| 93 | +} finally { |
| 94 | + tableAdminClient.close(); |
| 95 | +} |
| 96 | +``` |
| 97 | + |
| 98 | +## Troubleshooting |
| 99 | + |
| 100 | +To get help, follow the instructions in the [shared Troubleshooting |
| 101 | +document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/troubleshooting/readme.md#troubleshooting). |
| 102 | + |
| 103 | +Transport |
| 104 | +--------- |
| 105 | +Bigtable uses gRPC for the transport layer. |
| 106 | + |
| 107 | +## Java Versions |
| 108 | + |
| 109 | +Java 7 or above is required for using this client. |
| 110 | + |
| 111 | +## Versioning |
| 112 | + |
| 113 | +This library follows [Semantic Versioning](http://semver.org/). |
| 114 | + |
| 115 | +It is currently in major version zero (`0.y.z`), which means that anything may |
| 116 | +change at any time and the public API should not be considered stable. |
| 117 | + |
| 118 | +## Contributing |
| 119 | + |
| 120 | +Contributions to this library are always welcome and highly encouraged. |
| 121 | + |
| 122 | +See [CONTRIBUTING] for more information on how to get started and [DEVELOPING] for a layout of the |
| 123 | +codebase. |
| 124 | + |
| 125 | +## License |
| 126 | + |
| 127 | +Apache 2.0 - See [LICENSE] for more information. |
| 128 | + |
| 129 | +[CONTRIBUTING]:https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/CONTRIBUTING.md |
| 130 | +[LICENSE]: https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/LICENSE |
| 131 | +[cloud-platform]: https://cloud.google.com/ |
| 132 | +[cloud-bigtable]: https://cloud.google.com/bigtable/ |
| 133 | +[bigtable-product-docs]: https://cloud.google.com/bigtable/docs/ |
| 134 | +[bigtable-admin-client-lib-docs]: https://googlecloudplatform.github.io/google-cloud-java/google-cloud-clients/apidocs/index.html?com/google/cloud/bigtable/admin/v2/package-summary.html |
0 commit comments