Skip to content
This repository was archived by the owner on Oct 14, 2023. It is now read-only.

Commit 2de43ad

Browse files
fix: add missing annotation for batch document translation (#759)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 392949968 Source-Link: googleapis/googleapis@41e44ac Source-Link: https://github.com/googleapis/googleapis-gen/commit/2a89e1166976d1d910103bc9a967e2596123a19f
1 parent 2273ad6 commit 2de43ad

26 files changed

+357
-385
lines changed

google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStubSettings.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,9 @@ public static List<String> getDefaultServiceScopes() {
287287

288288
/** Returns a builder for the default credentials for this service. */
289289
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
290-
return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES);
290+
return GoogleCredentialsProvider.newBuilder()
291+
.setScopesToApply(DEFAULT_SERVICE_SCOPES)
292+
.setUseJwtAccessWithScope(true);
291293
}
292294

293295
/** Returns a builder for the default ChannelProvider for this service. */

google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/TranslationServiceClient.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ public final UnaryCallable<TranslateTextRequest, TranslateTextResponse> translat
256256
* `projects/{project-number-or-id}`.
257257
* <p>For global calls, use `projects/{project-number-or-id}/locations/global` or
258258
* `projects/{project-number-or-id}`.
259-
* <p>Only models within the same region, which have the same location-id, can be used.
260-
* Otherwise an INVALID_ARGUMENT (400) error is returned.
259+
* <p>Only models within the same region (has same location-id) can be used. Otherwise an
260+
* INVALID_ARGUMENT (400) error is returned.
261261
* @param model Optional. The language detection model to be used.
262262
* <p>Format:
263263
* `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
@@ -300,8 +300,8 @@ public final DetectLanguageResponse detectLanguage(
300300
* `projects/{project-number-or-id}`.
301301
* <p>For global calls, use `projects/{project-number-or-id}/locations/global` or
302302
* `projects/{project-number-or-id}`.
303-
* <p>Only models within the same region, which have the same location-id, can be used.
304-
* Otherwise an INVALID_ARGUMENT (400) error is returned.
303+
* <p>Only models within the same region (has same location-id) can be used. Otherwise an
304+
* INVALID_ARGUMENT (400) error is returned.
305305
* @param model Optional. The language detection model to be used.
306306
* <p>Format:
307307
* `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
@@ -408,9 +408,8 @@ public final DetectLanguageResponse detectLanguage(DetectLanguageRequest request
408408
* `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
409409
* <p>- General (built-in) models:
410410
* `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
411-
* `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
412411
* <p>Returns languages supported by the specified model. If missing, we get supported
413-
* languages of Google general base (PBMT) model.
412+
* languages of Google general NMT model.
414413
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
415414
*/
416415
public final SupportedLanguages getSupportedLanguages(
@@ -457,9 +456,8 @@ public final SupportedLanguages getSupportedLanguages(
457456
* `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
458457
* <p>- General (built-in) models:
459458
* `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
460-
* `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
461459
* <p>Returns languages supported by the specified model. If missing, we get supported
462-
* languages of Google general base (PBMT) model.
460+
* languages of Google general NMT model.
463461
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
464462
*/
465463
public final SupportedLanguages getSupportedLanguages(
@@ -710,7 +708,7 @@ public final UnaryCallable<BatchTranslateTextRequest, Operation> batchTranslateT
710708
* try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
711709
* BatchTranslateDocumentRequest request =
712710
* BatchTranslateDocumentRequest.newBuilder()
713-
* .setParent("parent-995424086")
711+
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
714712
* .setSourceLanguageCode("sourceLanguageCode1645917472")
715713
* .addAllTargetLanguageCodes(new ArrayList<String>())
716714
* .addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
@@ -747,7 +745,7 @@ public final UnaryCallable<BatchTranslateTextRequest, Operation> batchTranslateT
747745
* try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
748746
* BatchTranslateDocumentRequest request =
749747
* BatchTranslateDocumentRequest.newBuilder()
750-
* .setParent("parent-995424086")
748+
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
751749
* .setSourceLanguageCode("sourceLanguageCode1645917472")
752750
* .addAllTargetLanguageCodes(new ArrayList<String>())
753751
* .addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
@@ -786,7 +784,7 @@ public final UnaryCallable<BatchTranslateTextRequest, Operation> batchTranslateT
786784
* try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
787785
* BatchTranslateDocumentRequest request =
788786
* BatchTranslateDocumentRequest.newBuilder()
789-
* .setParent("parent-995424086")
787+
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
790788
* .setSourceLanguageCode("sourceLanguageCode1645917472")
791789
* .addAllTargetLanguageCodes(new ArrayList<String>())
792790
* .addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())

google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/stub/TranslationServiceStubSettings.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,9 @@ public static List<String> getDefaultServiceScopes() {
323323

324324
/** Returns a builder for the default credentials for this service. */
325325
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
326-
return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES);
326+
return GoogleCredentialsProvider.newBuilder()
327+
.setScopesToApply(DEFAULT_SERVICE_SCOPES)
328+
.setUseJwtAccessWithScope(true);
327329
}
328330

329331
/** Returns a builder for the default ChannelProvider for this service. */

google-cloud-translate/src/test/java/com/google/cloud/translate/v3beta1/TranslationServiceClientTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ public void batchTranslateDocumentTest() throws Exception {
498498

499499
BatchTranslateDocumentRequest request =
500500
BatchTranslateDocumentRequest.newBuilder()
501-
.setParent("parent-995424086")
501+
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
502502
.setSourceLanguageCode("sourceLanguageCode1645917472")
503503
.addAllTargetLanguageCodes(new ArrayList<String>())
504504
.addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
@@ -538,7 +538,7 @@ public void batchTranslateDocumentExceptionTest() throws Exception {
538538
try {
539539
BatchTranslateDocumentRequest request =
540540
BatchTranslateDocumentRequest.newBuilder()
541-
.setParent("parent-995424086")
541+
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
542542
.setSourceLanguageCode("sourceLanguageCode1645917472")
543543
.addAllTargetLanguageCodes(new ArrayList<String>())
544544
.addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())

proto-google-cloud-translate-v3beta1/src/main/java/com/google/cloud/translate/v3beta1/BatchDocumentInputConfig.java

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ public SourceCase getSourceCase() {
180180
* application/vnd.openxmlformats-officedocument.presentationml.presentation
181181
* - `xlsx`,
182182
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
183-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
184-
* The max file size supported for `.pdf` is 1GB and the max page limit is
183+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
184+
* The max file size to support for `.pdf` is 1GB and the max page limit is
185185
* 1000 pages.
186-
* The max file size supported for all input documents is 1GB.
186+
* The max file size to support for all input documents is 1GB.
187187
* </pre>
188188
*
189189
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
@@ -211,10 +211,10 @@ public boolean hasGcsSource() {
211211
* application/vnd.openxmlformats-officedocument.presentationml.presentation
212212
* - `xlsx`,
213213
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
214-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
215-
* The max file size supported for `.pdf` is 1GB and the max page limit is
214+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
215+
* The max file size to support for `.pdf` is 1GB and the max page limit is
216216
* 1000 pages.
217-
* The max file size supported for all input documents is 1GB.
217+
* The max file size to support for all input documents is 1GB.
218218
* </pre>
219219
*
220220
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
@@ -245,10 +245,10 @@ public com.google.cloud.translate.v3beta1.GcsSource getGcsSource() {
245245
* application/vnd.openxmlformats-officedocument.presentationml.presentation
246246
* - `xlsx`,
247247
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
248-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
249-
* The max file size supported for `.pdf` is 1GB and the max page limit is
248+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
249+
* The max file size to support for `.pdf` is 1GB and the max page limit is
250250
* 1000 pages.
251-
* The max file size supported for all input documents is 1GB.
251+
* The max file size to support for all input documents is 1GB.
252252
* </pre>
253253
*
254254
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
@@ -645,10 +645,10 @@ public Builder clearSource() {
645645
* application/vnd.openxmlformats-officedocument.presentationml.presentation
646646
* - `xlsx`,
647647
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
648-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
649-
* The max file size supported for `.pdf` is 1GB and the max page limit is
648+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
649+
* The max file size to support for `.pdf` is 1GB and the max page limit is
650650
* 1000 pages.
651-
* The max file size supported for all input documents is 1GB.
651+
* The max file size to support for all input documents is 1GB.
652652
* </pre>
653653
*
654654
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
@@ -676,10 +676,10 @@ public boolean hasGcsSource() {
676676
* application/vnd.openxmlformats-officedocument.presentationml.presentation
677677
* - `xlsx`,
678678
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
679-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
680-
* The max file size supported for `.pdf` is 1GB and the max page limit is
679+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
680+
* The max file size to support for `.pdf` is 1GB and the max page limit is
681681
* 1000 pages.
682-
* The max file size supported for all input documents is 1GB.
682+
* The max file size to support for all input documents is 1GB.
683683
* </pre>
684684
*
685685
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
@@ -717,10 +717,10 @@ public com.google.cloud.translate.v3beta1.GcsSource getGcsSource() {
717717
* application/vnd.openxmlformats-officedocument.presentationml.presentation
718718
* - `xlsx`,
719719
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
720-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
721-
* The max file size supported for `.pdf` is 1GB and the max page limit is
720+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
721+
* The max file size to support for `.pdf` is 1GB and the max page limit is
722722
* 1000 pages.
723-
* The max file size supported for all input documents is 1GB.
723+
* The max file size to support for all input documents is 1GB.
724724
* </pre>
725725
*
726726
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
@@ -755,10 +755,10 @@ public Builder setGcsSource(com.google.cloud.translate.v3beta1.GcsSource value)
755755
* application/vnd.openxmlformats-officedocument.presentationml.presentation
756756
* - `xlsx`,
757757
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
758-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
759-
* The max file size supported for `.pdf` is 1GB and the max page limit is
758+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
759+
* The max file size to support for `.pdf` is 1GB and the max page limit is
760760
* 1000 pages.
761-
* The max file size supported for all input documents is 1GB.
761+
* The max file size to support for all input documents is 1GB.
762762
* </pre>
763763
*
764764
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
@@ -791,10 +791,10 @@ public Builder setGcsSource(
791791
* application/vnd.openxmlformats-officedocument.presentationml.presentation
792792
* - `xlsx`,
793793
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
794-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
795-
* The max file size supported for `.pdf` is 1GB and the max page limit is
794+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
795+
* The max file size to support for `.pdf` is 1GB and the max page limit is
796796
* 1000 pages.
797-
* The max file size supported for all input documents is 1GB.
797+
* The max file size to support for all input documents is 1GB.
798798
* </pre>
799799
*
800800
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
@@ -838,10 +838,10 @@ public Builder mergeGcsSource(com.google.cloud.translate.v3beta1.GcsSource value
838838
* application/vnd.openxmlformats-officedocument.presentationml.presentation
839839
* - `xlsx`,
840840
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
841-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
842-
* The max file size supported for `.pdf` is 1GB and the max page limit is
841+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
842+
* The max file size to support for `.pdf` is 1GB and the max page limit is
843843
* 1000 pages.
844-
* The max file size supported for all input documents is 1GB.
844+
* The max file size to support for all input documents is 1GB.
845845
* </pre>
846846
*
847847
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
@@ -879,10 +879,10 @@ public Builder clearGcsSource() {
879879
* application/vnd.openxmlformats-officedocument.presentationml.presentation
880880
* - `xlsx`,
881881
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
882-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
883-
* The max file size supported for `.pdf` is 1GB and the max page limit is
882+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
883+
* The max file size to support for `.pdf` is 1GB and the max page limit is
884884
* 1000 pages.
885-
* The max file size supported for all input documents is 1GB.
885+
* The max file size to support for all input documents is 1GB.
886886
* </pre>
887887
*
888888
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
@@ -907,10 +907,10 @@ public com.google.cloud.translate.v3beta1.GcsSource.Builder getGcsSourceBuilder(
907907
* application/vnd.openxmlformats-officedocument.presentationml.presentation
908908
* - `xlsx`,
909909
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
910-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
911-
* The max file size supported for `.pdf` is 1GB and the max page limit is
910+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
911+
* The max file size to support for `.pdf` is 1GB and the max page limit is
912912
* 1000 pages.
913-
* The max file size supported for all input documents is 1GB.
913+
* The max file size to support for all input documents is 1GB.
914914
* </pre>
915915
*
916916
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
@@ -943,10 +943,10 @@ public com.google.cloud.translate.v3beta1.GcsSourceOrBuilder getGcsSourceOrBuild
943943
* application/vnd.openxmlformats-officedocument.presentationml.presentation
944944
* - `xlsx`,
945945
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
946-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
947-
* The max file size supported for `.pdf` is 1GB and the max page limit is
946+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
947+
* The max file size to support for `.pdf` is 1GB and the max page limit is
948948
* 1000 pages.
949-
* The max file size supported for all input documents is 1GB.
949+
* The max file size to support for all input documents is 1GB.
950950
* </pre>
951951
*
952952
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>

proto-google-cloud-translate-v3beta1/src/main/java/com/google/cloud/translate/v3beta1/BatchDocumentInputConfigOrBuilder.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public interface BatchDocumentInputConfigOrBuilder
4040
* application/vnd.openxmlformats-officedocument.presentationml.presentation
4141
* - `xlsx`,
4242
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
43-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
44-
* The max file size supported for `.pdf` is 1GB and the max page limit is
43+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
44+
* The max file size to support for `.pdf` is 1GB and the max page limit is
4545
* 1000 pages.
46-
* The max file size supported for all input documents is 1GB.
46+
* The max file size to support for all input documents is 1GB.
4747
* </pre>
4848
*
4949
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
@@ -68,10 +68,10 @@ public interface BatchDocumentInputConfigOrBuilder
6868
* application/vnd.openxmlformats-officedocument.presentationml.presentation
6969
* - `xlsx`,
7070
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
71-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
72-
* The max file size supported for `.pdf` is 1GB and the max page limit is
71+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
72+
* The max file size to support for `.pdf` is 1GB and the max page limit is
7373
* 1000 pages.
74-
* The max file size supported for all input documents is 1GB.
74+
* The max file size to support for all input documents is 1GB.
7575
* </pre>
7676
*
7777
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
@@ -96,10 +96,10 @@ public interface BatchDocumentInputConfigOrBuilder
9696
* application/vnd.openxmlformats-officedocument.presentationml.presentation
9797
* - `xlsx`,
9898
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
99-
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
100-
* The max file size supported for `.pdf` is 1GB and the max page limit is
99+
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
100+
* The max file size to support for `.pdf` is 1GB and the max page limit is
101101
* 1000 pages.
102-
* The max file size supported for all input documents is 1GB.
102+
* The max file size to support for all input documents is 1GB.
103103
* </pre>
104104
*
105105
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>

0 commit comments

Comments
 (0)