Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update new client generation instructions #9931

Merged
merged 6 commits into from
Dec 19, 2023
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions generation/new_client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,20 @@ The example in this README uses AlloyDB's [Cloud Drop](https://github.com/google
### API short name

For convenience of the subsequent commands, define a variable for API short name.
This value will be used by default to generate the following:
* `distribution_name`
suztomo marked this conversation as resolved.
Show resolved Hide resolved
* `destination-name`
* `proto_path`
suztomo marked this conversation as resolved.
Show resolved Hide resolved
suztomo marked this conversation as resolved.
Show resolved Hide resolved

The corresponding value in the Cloud Drop page is `api_short_name`.

Example: `alloydb`

> [!IMPORTANT]
> `api_short_name` is not always unique across client libraries.
> In the instance that the `api_short_name` is already in use by an existing client library, you will need to determine a unique name.
> See example under [Advanced Options](#Example with duplicate api_short_name).

### Proto path

The script takes "proto path" parameter. This is the path from the internal `google3/third_party/googleapis/stable` root to the
Expand Down Expand Up @@ -312,6 +322,34 @@ generated Google Maps Routes API Java client library.
--requires-billing=true \
--distribution-name="com.google.maps:google-maps-routing"
```
### Example with duplicate api_short_name

Let's say you get a new library request where the Cloud Drop value for `api_short_name` is `maps-routing`.

You discover that `maps-routing` is already in use by an existing client library!

You need to determine a unique `destination_name` for the new library's subdirectory as well as a unique `distribution_name` for the artifact to be published (confirm these values with the service team on the buganizer ticket before proceeding).

You will **still use** the non-unique `api_short_name` for the `api_short_name` flag.
suztomo marked this conversation as resolved.
Show resolved Hide resolved

There is no hard and fast rule for determining a unique name, so some discussion will be necessary.

Let's say that after some discussion, `maps-routing-gps` is selected as a suitable unique subdirectory name and artifact name.
suztomo marked this conversation as resolved.
Show resolved Hide resolved

You would then use the following command:
alicejli marked this conversation as resolved.
Show resolved Hide resolved
```
~/google-cloud-java$ python3.9 generation/new_client/new-client.py generate \
--api_shortname=maps-routing \
--proto-path=google/maps/routing \
--name-pretty="Routes API" \
--product-docs="https://developers.google.com/maps/documentation/routes" \
--api-description="Routes API is the next generation, performance optimized version of the existing Directions API and Distance Matrix API. It helps you find the ideal route from A to Z, calculates ETAs and distances for matrices of origin and destination locations, and also offers new features." \
--api-id=routes.googleapis.com \
--cloud-api=false \
--requires-billing=true \
--distribution-name="com.google.maps:google-maps-routing-gps" \
--destination-name="maps-routing-gps"
```

# Principles

Expand Down
Loading