Skip to content

Commit

Permalink
chore(docs): add Authorization section to Java README template (#1161)
Browse files Browse the repository at this point in the history
as a part of the PR 582 for java-logging an authorization section is added to the Java README template.

Fixing googleapis/java-logging#570.
  • Loading branch information
minherz authored Jul 27, 2021
1 parent dd05f9d commit 3d32990
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions synthtool/gcp/templates/java_library/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% set group_id = metadata['repo']['distribution_name'].split(':')|first -%}
{% set artifact_id = metadata['repo']['distribution_name'].split(':')|last -%}
{% set repo_short = metadata['repo']['repo'].split('/')|last -%}

# Google {{ metadata['repo']['name_pretty'] }} Client for Java

Java idiomatic client for [{{metadata['repo']['name_pretty']}}][product-docs].
Expand All @@ -16,10 +17,12 @@ Java idiomatic client for [{{metadata['repo']['name_pretty']}}][product-docs].
> Note: This client is a work-in-progress, and may occasionally
> make backwards-incompatible changes.
{% endif %}

## Quickstart

{% if 'snippets' in metadata and metadata['snippets'][metadata['repo']['name'] + '_install_with_bom'] -%}
If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file

```xml
{{ metadata['snippets'][metadata['repo']['name'] + '_install_with_bom'] }}
```
Expand All @@ -28,6 +31,7 @@ If you are using Maven without BOM, add this to your dependencies:
{% else %}
If you are using Maven, add this to your pom.xml file:
{% endif %}

```xml
{% if 'snippets' in metadata and metadata['snippets'][metadata['repo']['name'] + '_install_without_bom'] -%}
{{ metadata['snippets'][metadata['repo']['name'] + '_install_without_bom'] }}
Expand All @@ -42,6 +46,7 @@ If you are using Maven, add this to your pom.xml file:

{% if 'snippets' in metadata and metadata['snippets'][metadata['repo']['name'] + '_install_with_bom'] -%}
If you are using Gradle 5.x or later, add this to your dependencies

```Groovy
implementation platform('com.google.cloud:libraries-bom:{{metadata['latest_bom_version']}}')
Expand All @@ -50,11 +55,13 @@ compile '{{ group_id }}:{{ artifact_id }}'
{% endif -%}

If you are using Gradle without BOM, add this to your dependencies

```Groovy
compile '{{ group_id }}:{{ artifact_id }}:{{ metadata['latest_version'] }}'
```

If you are using SBT, add this to your dependencies

```Scala
libraryDependencies += "{{ group_id }}" % "{{ artifact_id }}" % "{{ metadata['latest_version'] }}"
```
Expand All @@ -63,6 +70,10 @@ libraryDependencies += "{{ group_id }}" % "{{ artifact_id }}" % "{{ metadata['la

See the [Authentication][authentication] section in the base directory's README.

## Authorization

The 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.

## Getting Started

### Prerequisites
Expand Down Expand Up @@ -175,6 +186,7 @@ This library follows [Semantic Versioning](http://semver.org/).
It is currently in major version zero (``0.y.z``), which means that anything may change at any time
and the public API should not be considered stable.
{% endif %}{% endif %}

## Contributing

{% if 'partials' in metadata and metadata['partials']['contributing'] -%}
Expand All @@ -188,6 +200,7 @@ Please note that this project is released with a Contributor Code of Conduct. By
this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more
information.
{% endif %}

## License

Apache 2.0 - See [LICENSE][license] for more information.
Expand Down Expand Up @@ -220,6 +233,9 @@ Java is a registered trademark of Oracle and/or its affiliates.
[maven-version-image]: https://img.shields.io/maven-central/v/{{ group_id }}/{{ artifact_id }}.svg
[maven-version-link]: https://search.maven.org/search?q=g:{{ group_id }}%20AND%20a:{{ artifact_id }}&core=gav
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
[iam-policy]: https://cloud.google.com/iam/docs/overview#cloud-iam-policy
[developer-console]: https://console.developers.google.com/
[create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects
[cloud-sdk]: https://cloud.google.com/sdk/
Expand Down

0 comments on commit 3d32990

Please sign in to comment.