1{% set group_id = metadata['repo']['distribution_name'].split(':')|first -%} 2{% set artifact_id = metadata['repo']['distribution_name'].split(':')|last -%} 3{% set repo_short = metadata['repo']['repo'].split('/')|last -%} 4 5# Google {{ metadata['repo']['name_pretty'] }} Client for Java 6 7Java idiomatic client for [{{metadata['repo']['name_pretty']}}][product-docs]. 8 9[![Maven][maven-version-image]][maven-version-link] 10![Stability][stability-image] 11 12- [Product Documentation][product-docs] 13- [Client Library Documentation][javadocs] 14{% if 'partials' in metadata and metadata['partials']['deprecation_warning'] -%} 15{{ metadata['partials']['deprecation_warning'] }} 16{% elif metadata['repo']['release_level'] in ['preview'] %} 17> Note: This client is a work-in-progress, and may occasionally 18> make backwards-incompatible changes. 19{% endif %} 20{% if migrated_split_repo %} 21:bus: In October 2022, this library has moved to 22[google-cloud-java/{{ metadata['repo']['repo_short'] }}]( 23https://github.com/googleapis/google-cloud-java/tree/main/{{ metadata['repo']['repo_short'] }}). 24This repository will be archived in the future. 25Future releases will appear in the new repository (https://github.com/googleapis/google-cloud-java/releases). 26The Maven artifact coordinates (`{{ group_id }}:{{ artifact_id }}`) remain the same. 27{% endif %} 28## Quickstart 29 30{% if 'snippets' in metadata and metadata['snippets'][metadata['repo']['api_shortname'] + '_install_with_bom'] -%} 31If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: 32 33```xml 34{{ metadata['snippets'][metadata['repo']['api_shortname'] + '_install_with_bom'] }} 35``` 36 37If you are using Maven without BOM, add this to your dependencies: 38{% else %} 39If you are using Maven, add this to your pom.xml file: 40{% endif %} 41 42```xml 43{% if 'snippets' in metadata and metadata['snippets'][metadata['repo']['api_shortname'] + '_install_without_bom'] -%} 44{{ metadata['snippets'][metadata['repo']['api_shortname'] + '_install_without_bom'] }} 45{% else -%} 46<dependency> 47 <groupId>{{ group_id }}</groupId> 48 <artifactId>{{ artifact_id }}</artifactId> 49 <version>{{ metadata['latest_version'] }}</version> 50</dependency> 51{% endif -%} 52``` 53 54{% if 'snippets' in metadata and metadata['snippets'][metadata['repo']['api_shortname'] + '_install_with_bom'] -%} 55If you are using Gradle 5.x or later, add this to your dependencies: 56 57```Groovy 58implementation platform('com.google.cloud:libraries-bom:{{metadata['latest_bom_version']}}') 59 60implementation '{{ group_id }}:{{ artifact_id }}' 61``` 62{% endif -%} 63 64If you are using Gradle without BOM, add this to your dependencies: 65 66```Groovy 67implementation '{{ group_id }}:{{ artifact_id }}:{{ metadata['latest_version'] }}' 68``` 69 70If you are using SBT, add this to your dependencies: 71 72```Scala 73libraryDependencies += "{{ group_id }}" % "{{ artifact_id }}" % "{{ metadata['latest_version'] }}" 74``` 75 76## Authentication 77 78See the [Authentication][authentication] section in the base directory's README. 79 80## Authorization 81 82The client application making API calls must be granted [authorization scopes][auth-scopes] required for the desired {{metadata['repo']['name_pretty']}} APIs, and the authenticated principal must have the [IAM role(s)][predefined-iam-roles] required to access GCP resources using the {{metadata['repo']['name_pretty']}} API calls. 83 84## Getting Started 85 86### Prerequisites 87 88You will need a [Google Cloud Platform Console][developer-console] project with the {{metadata['repo']['name_pretty']}} [API enabled][enable-api]. 89{% if metadata['repo']['requires_billing'] %}You will need to [enable billing][enable-billing] to use Google {{metadata['repo']['name_pretty']}}.{% endif %} 90[Follow these instructions][create-project] to get your project set up. You will also need to set up the local development environment by 91[installing the Google Cloud SDK][cloud-sdk] and running the following commands in command line: 92`gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. 93 94### Installation and setup 95 96You'll need to obtain the `{{ artifact_id }}` library. See the [Quickstart](#quickstart) section 97to add `{{ artifact_id }}` as a dependency in your code. 98 99## About {{metadata['repo']['name_pretty']}} 100 101{% if 'partials' in metadata and metadata['partials']['about'] -%} 102{{ metadata['partials']['about'] }} 103{% else %} 104[{{ metadata['repo']['name_pretty'] }}][product-docs] {{ metadata['repo']['api_description'] }} 105 106See the [{{metadata['repo']['name_pretty']}} client library docs][javadocs] to learn how to 107use this {{metadata['repo']['name_pretty']}} Client Library. 108{% endif %} 109 110{% if 'partials' in metadata and metadata['partials']['custom_content'] -%} 111{{ metadata['partials']['custom_content'] }} 112{% endif %} 113 114{% if metadata['samples']|length %} 115## Samples 116 117Samples are in the [`samples/`](https://github.com/{{ metadata['repo']['repo'] }}/tree/main/samples) directory. 118 119| Sample | Source Code | Try it | 120| --------------------------- | --------------------------------- | ------ | 121{% for sample in metadata['samples'] %}| {{ sample.title }} | [source code](https://github.com/{{ metadata['repo']['repo'] }}/blob/main/{{ sample.file }}) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/{{ metadata['repo']['repo'] }}&page=editor&open_in_editor={{ sample.file }}) | 122{% endfor %} 123{% endif %} 124 125## Troubleshooting 126 127To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting]. 128 129{% if metadata['repo']['transport'] -%} 130## Transport 131 132{% if metadata['repo']['transport'] == 'grpc' -%} 133{{metadata['repo']['name_pretty']}} uses gRPC for the transport layer. 134{% elif metadata['repo']['transport'] == 'http' -%} 135{{metadata['repo']['name_pretty']}} uses HTTP/JSON for the transport layer. 136{% elif metadata['repo']['transport'] == 'both' -%} 137{{metadata['repo']['name_pretty']}} uses both gRPC and HTTP/JSON for the transport layer. 138{% endif %} 139{% endif -%} 140 141## Supported Java Versions 142 143Java {{ metadata['min_java_version'] }} or above is required for using this client. 144 145Google's Java client libraries, 146[Google Cloud Client Libraries][cloudlibs] 147and 148[Google Cloud API Libraries][apilibs], 149follow the 150[Oracle Java SE support roadmap][oracle] 151(see the Oracle Java SE Product Releases section). 152 153### For new development 154 155In general, new feature development occurs with support for the lowest Java 156LTS version covered by Oracle's Premier Support (which typically lasts 5 years 157from initial General Availability). If the minimum required JVM for a given 158library is changed, it is accompanied by a [semver][semver] major release. 159 160Java 11 and (in September 2021) Java 17 are the best choices for new 161development. 162 163### Keeping production systems current 164 165Google tests its client libraries with all current LTS versions covered by 166Oracle's Extended Support (which typically lasts 8 years from initial 167General Availability). 168 169#### Legacy support 170 171Google's client libraries support legacy versions of Java runtimes with long 172term stable libraries that don't receive feature updates on a best efforts basis 173as it may not be possible to backport all patches. 174 175Google provides updates on a best efforts basis to apps that continue to use 176Java 7, though apps might need to upgrade to current versions of the library 177that supports their JVM. 178 179#### Where to find specific information 180 181The latest versions and the supported Java versions are identified on 182the individual GitHub repository `github.com/GoogleAPIs/java-SERVICENAME` 183and on [google-cloud-java][g-c-j]. 184 185## Versioning 186 187{% if 'partials' in metadata and metadata['partials']['versioning'] -%} 188{{ metadata['partials']['versioning'] }} 189{% else %} 190This library follows [Semantic Versioning](http://semver.org/). 191 192{% if metadata['repo']['release_level'] in ['preview'] %} 193It is currently in major version zero (``0.y.z``), which means that anything may change at any time 194and the public API should not be considered stable. 195{% endif %}{% endif %} 196 197## Contributing 198 199{% if 'partials' in metadata and metadata['partials']['contributing'] -%} 200{{ metadata['partials']['contributing'] }} 201{% else %} 202Contributions to this library are always welcome and highly encouraged. 203 204See [CONTRIBUTING][contributing] for more information how to get started. 205 206Please note that this project is released with a Contributor Code of Conduct. By participating in 207this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more 208information. 209{% endif %} 210 211## License 212 213Apache 2.0 - See [LICENSE][license] for more information. 214 215## CI Status 216 217Java Version | Status 218------------ | ------{% if metadata['min_java_version'] <= 7 %} 219Java 7 | [![Kokoro CI][kokoro-badge-image-1]][kokoro-badge-link-1]{% endif %} 220Java 8 | [![Kokoro CI][kokoro-badge-image-2]][kokoro-badge-link-2] 221Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3] 222Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4] 223Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5] 224 225Java is a registered trademark of Oracle and/or its affiliates. 226 227[product-docs]: {{metadata['repo']['product_documentation']}} 228[javadocs]: {{metadata['repo']['client_documentation']}} 229[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/{{ repo_short }}/java7.svg 230[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/{{ repo_short }}/java7.html 231[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/{{ repo_short }}/java8.svg 232[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/{{ repo_short }}/java8.html 233[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/{{ repo_short }}/java8-osx.svg 234[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/{{ repo_short }}/java8-osx.html 235[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/{{ repo_short }}/java8-win.svg 236[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/{{ repo_short }}/java8-win.html 237[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/{{ repo_short }}/java11.svg 238[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/{{ repo_short }}/java11.html 239[stability-image]: https://img.shields.io/badge/stability-{% if metadata['repo']['release_level'] == 'stable' %}stable-green{% elif metadata['repo']['release_level'] == 'preview' %}preview-yellow{% else %}unknown-red{% endif %} 240[maven-version-image]: https://img.shields.io/maven-central/v/{{ group_id }}/{{ artifact_id }}.svg 241[maven-version-link]: https://search.maven.org/search?q=g:{{ group_id }}%20AND%20a:{{ artifact_id }}&core=gav 242[authentication]: https://github.com/googleapis/google-cloud-java#authentication 243[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes 244[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles 245[iam-policy]: https://cloud.google.com/iam/docs/overview#cloud-iam-policy 246[developer-console]: https://console.developers.google.com/ 247[create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects 248[cloud-sdk]: https://cloud.google.com/sdk/ 249[troubleshooting]: https://github.com/googleapis/google-cloud-common/blob/main/troubleshooting/readme.md#troubleshooting 250[contributing]: https://github.com/{{metadata['repo']['repo']}}/blob/main/CONTRIBUTING.md 251[code-of-conduct]: https://github.com/{{metadata['repo']['repo']}}/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct 252[license]: https://github.com/{{metadata['repo']['repo']}}/blob/main/LICENSE 253{% if metadata['repo']['requires_billing'] %}[enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing{% endif %} 254{% if metadata['repo']['api_id'] %}[enable-api]: https://console.cloud.google.com/flows/enableapi?apiid={{ metadata['repo']['api_id'] }}{% endif %} 255[libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM 256[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png 257 258[semver]: https://semver.org/ 259[cloudlibs]: https://cloud.google.com/apis/docs/client-libraries-explained 260[apilibs]: https://cloud.google.com/apis/docs/client-libraries-explained#google_api_client_libraries 261[oracle]: https://www.oracle.com/java/technologies/java-se-support-roadmap.html 262[g-c-j]: http://github.com/googleapis/google-cloud-java 263