-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: library generation example of Geo #8745
Changes from all commits
4599843
bdf2f3f
2ceb9e3
7c2c6fb
37be2cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,7 @@ You can run these next commands in the home directory (or IdeaProjects). Otherwi | |
Confirm pyenv installation succeeded: | ||
|
||
``` | ||
suztomo@suztomo:~$ pyenv | ||
~$ pyenv | ||
pyenv 2.3.4 | ||
Usage: pyenv <command> [<args>] | ||
|
||
|
@@ -71,7 +71,7 @@ Some useful pyenv commands are: | |
### Install Python 3.9 via pyenv | ||
|
||
``` | ||
suztomo@suztomo:~$ pyenv install 3.9.13 | ||
~$ pyenv install 3.9.13 | ||
Downloading Python-3.9.13.tar.xz... | ||
-> https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tar.xz | ||
Installing Python-3.9.13... | ||
|
@@ -176,6 +176,88 @@ Please create a pull request: | |
|
||
Create a pull request from the change. | ||
|
||
## Advanced Options | ||
|
||
For the explanation of the available parameters, run: | ||
`python3.9 generation/new_client/new-client.py generate --help`. | ||
|
||
``` | ||
~/google-cloud-java$ python3.9 generation/new_client/new-client.py generate --help | ||
/usr/local/google/home/suztomo/google-cloud-java/generation/new_client | ||
Usage: new-client.py generate [OPTIONS] | ||
|
||
Options: | ||
--api_shortname TEXT Name for the new directory name and | ||
(default) artifact name [required] | ||
--name-pretty TEXT The human-friendly name that appears in | ||
README.md [required] | ||
--product-docs TEXT Documentation URL that appears in README.md | ||
[required] | ||
--api-description TEXT Description that appears in README.md | ||
[required] | ||
--release-level [stable|preview] | ||
A label that appears in repo-metadata.json. | ||
The first library generation is always | ||
'preview'. [default: preview] | ||
--transport [grpc|http|both] A label that appears in repo-metadata.json | ||
[default: grpc] | ||
--language TEXT [default: java] | ||
--distribution-name TEXT Maven coordinates of the generated library. | ||
By default it's com.google.cloud:google- | ||
cloud-<api_shortname> | ||
--api-id TEXT The value of the apiid parameter used in | ||
README.md It has link to https://console.clo | ||
ud.google.com/flows/enableapi?apiid=<api_id> | ||
--requires-billing BOOLEAN Based on this value, README.md explains | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding: "Defaults to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added default values in help. |
||
whether billing setup is needed or not. | ||
[default: True] | ||
--destination-name TEXT The directory name of the new library. By | ||
default it's java-<api_shortname> | ||
--proto-path TEXT Path to proto file from the root of the | ||
googleapis repository to thedirectory that | ||
contains the proto files (without the | ||
version).For example, to generate the | ||
library for 'google/maps/routing/v2', then | ||
you specify this value as | ||
'google/maps/routing' [required] | ||
--cloud-api BOOLEAN If true, the artifact ID of the library is | ||
'google-cloud-'; otherwise 'google-' | ||
[default: True] | ||
--group-id TEXT The group ID of the artifact when | ||
distribution name is not set [default: | ||
com.google.cloud] | ||
--owlbot-image TEXT The owlbot container image used in | ||
OwlBot.yaml [default: gcr.io/cloud-devrel- | ||
public-resources/owlbot-java] | ||
--library-type TEXT A label that appear in repo-metadata.json to | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding: "Defaults to |
||
tell how the library is maintained or | ||
generated [default: GAPIC_AUTO] | ||
--googleapis-gen-url TEXT The URL of the repository that has generated | ||
Java code from proto service definition | ||
[default: | ||
https://github.com/googleapis/googleapis- | ||
gen.git] | ||
--help Show this message and exit. | ||
``` | ||
|
||
Sometimes, a library generation requires special handling for | ||
Maven coordinates or API ID, especially when the library is not | ||
specific to Google Cloud. Refer to the following command example when we | ||
generated Google Maps Routes API Java client library. | ||
|
||
``` | ||
~/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 \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does |
||
--cloud-api=false \ | ||
--requires-billing=true \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's default to true. |
||
--distribution-name="com.google.maps:google-maps-routing" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's Group ID and artifact ID. |
||
``` | ||
|
||
# Principles | ||
|
||
The script should finish creating a pull request even when the newly created | ||
|
@@ -271,4 +353,4 @@ subprocess.CalledProcessError: Command '['docker', 'run', '--rm', '-v', '/usr/lo | |
You have run the `pyenv local 3.9.13` in the `google-cloud-java` repo. | ||
1. Remove the `.python-version` file in `google-cloud-java`. | ||
2. `cd ..` out to the parent directory and run `pyenv local 3.9.13` there | ||
3. `cd google-cloud-java` back into the repo and run the generation script again | ||
3. `cd google-cloud-java` back into the repo and run the generation script again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding: "Defaults to
grpc
"There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added default values in help.