Skip to content

Commit 26c5ae3

Browse files
authored
chore: update README for new client generation to use Cloud Drop and fix workflow scripts (#9336)
* chore: update README for new client generation to use Cloud Drop * update mvn command * update mvn commands * update description * update to use first sentence and include a line about maps clients * add check for existing library * update google3 link with external link * clarify proto path * clarify proto path
1 parent 34fd837 commit 26c5ae3

File tree

4 files changed

+52
-27
lines changed

4 files changed

+52
-27
lines changed

.github/workflows/merge_repository.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424
USERNAME: ${{ github.actor }}
2525
- name: Compile
2626
working-directory: generation/monorepo/google-cloud-java-merged
27-
run: mvn compile -T C1 -B
27+
run: mvn compile -T 1C -B
2828
- name: Unit Tests
2929
working-directory: generation/monorepo/google-cloud-java-merged
30-
run: mvn test -T C1 -B
30+
run: mvn test -T 1C -B
3131
- name: Push monorepo to branch
3232
if: ${{ github.event_name != 'pull_request' }}
3333
run: |

.github/workflows/newclient.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ jobs:
7575
grep -q ${API_SHORT_NAME} pom.xml
7676
grep -q ${API_SHORT_NAME} gapic-libraries-bom/pom.xml
7777
- name: Test
78-
run: mvn -B -ntp test -T C1
78+
run: mvn -B -ntp test -T 1C

generation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ After running the script locally, you can `cd` into the generated repository and
1515

1616
```shell
1717
cd monorepo/google-cloud-java
18-
mvn test -T C1 -B
18+
mvn test -T 1C -B
1919
```
2020

2121
### Input

generation/new_client/README.md

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -124,55 +124,78 @@ $ sudo apt-get install gh
124124
$ gh auth login
125125
```
126126

127+
## Double check that the library does not already exist within `google-cloud-java`!
128+
129+
Some languages require a new request when a new version of a service is created, but Java manages all versions of the service as a single package, so the client library will automatically be updated to include new versions.
130+
127131
## Run client generation script
128132

129133
You will run new-client.py script with the following parameters.
130-
Collect them from the ticket before running the command.
134+
These parameters will be available in the Cloud Drop link (a YAML file) included in the buganizer request.
135+
The example in this README uses AlloyDB's [Cloud Drop](https://github.com/googleapis/googleapis/blob/master/google/cloud/alloydb/v1/alloydb_v1.yaml) file as an example.
131136

132137
### API short name
133138

134139
For convenience of the subsequent commands, define a variable for API short name.
135-
Get the value from the DevRel Services page (Example: `apikeys`):
140+
The corresponding value in the Cloud Drop page is `api_short_name`.
141+
142+
Example: `alloydb`
136143

137144
### Proto path
138145

139-
The script takes "proto path" parameter. This is path from google3's root to the
140-
directory that contains versions (e.g., "v1" or "v2"). For example, if we
141-
have
146+
The script takes "proto path" parameter. This is the path from the internal `google3/third_party/googleapis/stable` root to the
147+
directory that contains versions (e.g., "v1" or "v2").
148+
Note that the internal `google3/third_party/googleapis/stable` directory is mirrored externally in https://github.com/googleapis/googleapis/blob/master/.
149+
150+
For example, if the buganizer ticket includes:
151+
152+
> Link to protos: `http://...(omit).../google/cloud/alloydb/v1alpha/alloydb_v1alpha.yaml`.
153+
154+
then the corresponding external mirrored proto is here: https://github.com/googleapis/googleapis/blob/master/google/cloud/alloydb/v1alpha/alloydb_v1alpha.yaml.
142155

143-
> Link to protos: http://google3/google/api/apikeys/v2/apikeys.proto
156+
Therefore, the "proto path" value we supply to the command is `google/cloud/alloydb`.
144157

145-
then the "proto path" value we supply to the command is "google/api/apikeys".
158+
We will publish a single module for a service that includes all versions in this path. Once the service has been published once, any future additional versions will automatically be generated via OwlBot.
146159

147160
### Name pretty
148161

149-
Pick name from the display name in the DevRel Services site.
150-
For example, "API Keys API" in
151-
https://devrel.corp.google.com/admin/products/479.
162+
The corresponding value in the Cloud Drop page is `title`.
163+
164+
Example: `AlloyDB API`
152165

153166
### Product Docs
154167

155-
Find product document URL in the DevRel Services site.
156-
For example, "https://cloud.google.com/api-keys/" in
157-
https://devrel.corp.google.com/admin/products/479.
168+
The corresponding value in the Cloud Drop page is `documentation_uri`.
158169
The value must starts with "https://".
159170

171+
Example: `https://cloud.google.com/alloydb/docs`
172+
160173
### API description
161174

162-
Find the short description of the API. Usually the first sentence in the product
163-
document above.
175+
The corresponding value in the Cloud Drop page is `documentation.summary` or `documentation.overview`.
176+
If both of those fields are missing, take the description from the product page above. Use the first sentence to keep it concise.
177+
178+
Example:
179+
```
180+
AlloyDB for PostgreSQL is an open source-compatible database service that
181+
provides a powerful option for migrating, modernizing, or building
182+
commercial-grade applications.
183+
```
184+
164185

165186
### Example arguments
166187

167188
Run `new-client.py` with the arguments above:
168189

169190
```
170191
$ python3.9 generation/new_client/new-client.py generate \
171-
--api_shortname=apikeys \
172-
--proto-path=google/api/apikeys \
173-
--name-pretty="API Keys API" \
174-
--product-docs="https://cloud.google.com/api-keys/" \
175-
--api-description="API Keys lets you create and manage your API keys for your projects."
192+
--api_shortname=alloydb \
193+
--proto-path=google/cloud/alloydb \
194+
--name-pretty="AlloyDB API" \
195+
--product-docs="https://cloud.google.com/alloydb/docs" \
196+
--api-description="AlloyDB for PostgreSQL is an open source-compatible database service that
197+
provides a powerful option for migrating, modernizing, or building
198+
commercial-grade applications."
176199
```
177200

178201
The command creates changes for
@@ -182,10 +205,10 @@ create a pull request in the monorepo:
182205
```
183206
...
184207
Please create a pull request:
185-
$ git checkout -b new_module_java-discoveryengine
208+
$ git checkout -b new_module_java-alloydb
186209
$ git add .
187-
$ git commit -m 'feat: [apikeys] new module for apikeys'
188-
$ gh pr create --title 'feat: [apikeys] new module for apikeys'
210+
$ git commit -m 'feat: [alloydb] new module for alloydb'
211+
$ gh pr create --title 'feat: [alloydb] new module for alloydb'
189212
```
190213

191214
Create a pull request from the change.
@@ -261,6 +284,8 @@ Maven coordinates or API ID, especially when the library is not
261284
specific to Google Cloud. Refer to the following command example when we
262285
generated Google Maps Routes API Java client library.
263286

287+
**Note that for `maps` clients, include `maps` as a prefix to the `api_shortname`.**
288+
264289
```
265290
~/google-cloud-java$ python3.9 generation/new_client/new-client.py generate \
266291
--api_shortname=maps-routing \

0 commit comments

Comments
 (0)