diff --git a/google/cloud/translate/artman_translate_v3.yaml b/google/cloud/translate/artman_translate_v3.yaml index a94d71f2..d55ebb06 100644 --- a/google/cloud/translate/artman_translate_v3.yaml +++ b/google/cloud/translate/artman_translate_v3.yaml @@ -6,7 +6,7 @@ common: - name: google-common-protos src_proto_paths: - v3 - service_yaml: translate_v3.yaml + service_yaml: v3/translate_v3.yaml gapic_yaml: v3/translate_gapic.yaml artifacts: - name: gapic_config diff --git a/google/cloud/translate/translate_v3.yaml b/google/cloud/translate/translate_v3.yaml deleted file mode 100644 index 589b215e..00000000 --- a/google/cloud/translate/translate_v3.yaml +++ /dev/null @@ -1,71 +0,0 @@ -type: google.api.Service -config_version: 3 -name: translate.googleapis.com -title: Cloud Translation API - -apis: -- name: google.cloud.translation.v3.TranslationService - -documentation: - summary: Integrates text translation into your website or application. - -types: -- name: google.cloud.translation.v3.CreateGlossaryMetadata -- name: google.cloud.translation.v3.DeleteGlossaryMetadata -- name: google.cloud.translation.v3.DeleteGlossaryResponse -- name: google.cloud.translation.v3.BatchTranslateResponse -- name: google.cloud.translation.v3.BatchTranslateMetadata - -http: - rules: - - selector: google.longrunning.Operations.CancelOperation - post: '/v3/{name=projects/*/locations/*/operations/*}:cancel' - body: '*' - - selector: google.longrunning.Operations.DeleteOperation - delete: '/v3/{name=projects/*/locations/*/operations/*}' - - selector: google.longrunning.Operations.GetOperation - get: '/v3/{name=projects/*/locations/*/operations/*}' - - selector: google.longrunning.Operations.ListOperations - get: '/v3/{name=projects/*/locations/*/operations}' - - selector: google.longrunning.Operations.WaitOperation - post: '/v3/{name=projects/*/locations/*/operations/*}:wait' - body: '*' - - selector: google.cloud.location.Locations.GetLocation - get: '/v3/{name=projects/*/locations/*}' - - selector: google.cloud.location.Locations.ListLocations - get: '/v3/{name=projects/*}/locations' - -backend: - rules: - - selector: 'google.longrunning.Operations.*' - deadline: 60.0 - - selector: google.longrunning.Operations.WaitOperation - deadline: 120.0 - - selector: 'google.cloud.location.Locations.*' - deadline: 30.0 - -authentication: - rules: - - selector: 'google.cloud.translation.v3.TranslationService.*' - oauth: - canonical_scopes: |- - https://www.googleapis.com/auth/cloud-platform, - https://www.googleapis.com/auth/cloud-translation - - selector: google.cloud.translation.v3.TranslationService.BatchTranslateText - oauth: - canonical_scopes: |- - https://www.googleapis.com/auth/cloud-platform - - selector: google.cloud.translation.v3.TranslationService.CreateGlossary - oauth: - canonical_scopes: |- - https://www.googleapis.com/auth/cloud-platform - - selector: 'google.longrunning.Operations.*' - oauth: - canonical_scopes: |- - https://www.googleapis.com/auth/cloud-platform, - https://www.googleapis.com/auth/cloud-translation - - selector: 'google.cloud.location.Locations.*' - oauth: - canonical_scopes: |- - https://www.googleapis.com/auth/cloud-platform, - https://www.googleapis.com/auth/cloud-translation diff --git a/google/cloud/translate/v3/translate_gapic.legacy.yaml b/google/cloud/translate/v3/translate_gapic.legacy.yaml new file mode 100644 index 00000000..8193ddd2 --- /dev/null +++ b/google/cloud/translate/v3/translate_gapic.legacy.yaml @@ -0,0 +1,232 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +# The settings of generated code in a specific language. +language_settings: + java: + package_name: com.google.cloud.translate.v3 + python: + package_name: google.cloud.translate_v3.gapic + go: + package_name: cloud.google.com/go/translate/apiv3 + csharp: + package_name: Google.Cloud.Translate.V3 + ruby: + package_name: Google::Cloud::Translate::V3 + php: + package_name: Google\Cloud\Translate\V3 + nodejs: + package_name: translate.v3 + domain_layer_location: google-cloud +# A list of API interface configurations. +interfaces: +# The fully qualified name of the API interface. +- name: google.cloud.translation.v3.TranslationService + # A list of resource collection configurations. + # Consists of a name_pattern and an entity_name. + # The name_pattern is a pattern to describe the names of the resources of this + # collection, using the platform's conventions for URI patterns. A generator + # may use this to generate methods to compose and decompose such names. The + # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; + # those will be taken as hints for the parameter names of the generated + # methods. If empty, no name methods are generated. + # The entity_name is the name to be used as a basis for generated methods and + # classes. + collections: + - name_pattern: projects/{project}/locations/{location} + entity_name: location + - name_pattern: projects/{project}/locations/{location}/glossaries/{glossary} + entity_name: glossary + # Definition for retryable codes. + retry_codes_def: + - name: idempotent + retry_codes: + - DEADLINE_EXCEEDED + - UNAVAILABLE + - name: non_idempotent + retry_codes: [] + # Definition for retry/backoff parameters. + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + # A list of method configurations. + # Common properties: + # + # name - The simple name of the method. + # + # flattening - Specifies the configuration for parameter flattening. + # Describes the parameter groups for which a generator should produce method + # overloads which allow a client to directly pass request message fields as + # method parameters. This information may or may not be used, depending on + # the target language. + # Consists of groups, which each represent a list of parameters to be + # flattened. Each parameter listed must be a field of the request message. + # + # required_fields - Fields that are always required for a request to be + # valid. + # + # page_streaming - Specifies the configuration for paging. + # Describes information for generating a method which transforms a paging + # list RPC into a stream of resources. + # Consists of a request and a response. + # The request specifies request information of the list method. It defines + # which fields match the paging pattern in the request. The request consists + # of a page_size_field and a token_field. The page_size_field is the name of + # the optional field specifying the maximum number of elements to be + # returned in the response. The token_field is the name of the field in the + # request containing the page token. + # The response specifies response information of the list method. It defines + # which fields match the paging pattern in the response. The response + # consists of a token_field and a resources_field. The token_field is the + # name of the field in the response containing the next page token. The + # resources_field is the name of the field in the response containing the + # list of resources belonging to the page. + # + # retry_codes_name - Specifies the configuration for retryable codes. The + # name must be defined in interfaces.retry_codes_def. + # + # retry_params_name - Specifies the configuration for retry/backoff + # parameters. The name must be defined in interfaces.retry_params_def. + # + # field_name_patterns - Maps the field name of the request type to + # entity_name of interfaces.collections. + # Specifies the string pattern that the field must follow. + # + # timeout_millis - Specifies the default timeout for a non-retrying call. If + # the call is retrying, refer to retry_params_name instead. + methods: + - name: TranslateText + required_fields: + - contents + - target_language_code + - parent + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + parent: location + timeout_millis: 60000 + - name: DetectLanguage + flattening: + groups: + - parameters: + - parent + - model + - mime_type + - labels + required_fields: + - parent + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + parent: location + timeout_millis: 60000 + - name: GetSupportedLanguages + flattening: + groups: + - parameters: + - parent + - display_language_code + - model + required_fields: + - parent + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + parent: location + timeout_millis: 60000 + - name: BatchTranslateText + required_fields: + - parent + - source_language_code + - target_language_codes + - input_configs + - output_config + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + parent: location + long_running: + return_type: google.cloud.translation.v3.BatchTranslateResponse + metadata_type: google.cloud.translation.v3.BatchTranslateMetadata + initial_poll_delay_millis: 500 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 5000 + total_poll_timeout_millis: 300000 + timeout_millis: 60000 + - name: CreateGlossary + flattening: + groups: + - parameters: + - parent + - glossary + required_fields: + - parent + - glossary + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + parent: location + long_running: + return_type: google.cloud.translation.v3.Glossary + metadata_type: google.cloud.translation.v3.CreateGlossaryMetadata + initial_poll_delay_millis: 500 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 5000 + total_poll_timeout_millis: 300000 + timeout_millis: 60000 + - name: ListGlossaries + flattening: + groups: + - parameters: + - parent + - filter + required_fields: + - parent + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: glossaries + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + parent: location + timeout_millis: 60000 + - name: GetGlossary + flattening: + groups: + - parameters: + - name + required_fields: + - name + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: glossary + timeout_millis: 60000 + - name: DeleteGlossary + flattening: + groups: + - parameters: + - name + required_fields: + - name + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: glossary + long_running: + return_type: google.cloud.translation.v3.DeleteGlossaryResponse + metadata_type: google.cloud.translation.v3.DeleteGlossaryMetadata + initial_poll_delay_millis: 500 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 5000 + total_poll_timeout_millis: 300000 + timeout_millis: 60000 diff --git a/google/cloud/translate/v3/translate_gapic.yaml b/google/cloud/translate/v3/translate_gapic.yaml index 8193ddd2..2676c174 100644 --- a/google/cloud/translate/v3/translate_gapic.yaml +++ b/google/cloud/translate/v3/translate_gapic.yaml @@ -1,5 +1,5 @@ type: com.google.api.codegen.ConfigProto -config_schema_version: 1.0.0 +config_schema_version: 2.0.0 # The settings of generated code in a specific language. language_settings: java: @@ -17,216 +17,3 @@ language_settings: nodejs: package_name: translate.v3 domain_layer_location: google-cloud -# A list of API interface configurations. -interfaces: -# The fully qualified name of the API interface. -- name: google.cloud.translation.v3.TranslationService - # A list of resource collection configurations. - # Consists of a name_pattern and an entity_name. - # The name_pattern is a pattern to describe the names of the resources of this - # collection, using the platform's conventions for URI patterns. A generator - # may use this to generate methods to compose and decompose such names. The - # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; - # those will be taken as hints for the parameter names of the generated - # methods. If empty, no name methods are generated. - # The entity_name is the name to be used as a basis for generated methods and - # classes. - collections: - - name_pattern: projects/{project}/locations/{location} - entity_name: location - - name_pattern: projects/{project}/locations/{location}/glossaries/{glossary} - entity_name: glossary - # Definition for retryable codes. - retry_codes_def: - - name: idempotent - retry_codes: - - DEADLINE_EXCEEDED - - UNAVAILABLE - - name: non_idempotent - retry_codes: [] - # Definition for retry/backoff parameters. - retry_params_def: - - name: default - initial_retry_delay_millis: 100 - retry_delay_multiplier: 1.3 - max_retry_delay_millis: 60000 - initial_rpc_timeout_millis: 20000 - rpc_timeout_multiplier: 1 - max_rpc_timeout_millis: 20000 - total_timeout_millis: 600000 - # A list of method configurations. - # Common properties: - # - # name - The simple name of the method. - # - # flattening - Specifies the configuration for parameter flattening. - # Describes the parameter groups for which a generator should produce method - # overloads which allow a client to directly pass request message fields as - # method parameters. This information may or may not be used, depending on - # the target language. - # Consists of groups, which each represent a list of parameters to be - # flattened. Each parameter listed must be a field of the request message. - # - # required_fields - Fields that are always required for a request to be - # valid. - # - # page_streaming - Specifies the configuration for paging. - # Describes information for generating a method which transforms a paging - # list RPC into a stream of resources. - # Consists of a request and a response. - # The request specifies request information of the list method. It defines - # which fields match the paging pattern in the request. The request consists - # of a page_size_field and a token_field. The page_size_field is the name of - # the optional field specifying the maximum number of elements to be - # returned in the response. The token_field is the name of the field in the - # request containing the page token. - # The response specifies response information of the list method. It defines - # which fields match the paging pattern in the response. The response - # consists of a token_field and a resources_field. The token_field is the - # name of the field in the response containing the next page token. The - # resources_field is the name of the field in the response containing the - # list of resources belonging to the page. - # - # retry_codes_name - Specifies the configuration for retryable codes. The - # name must be defined in interfaces.retry_codes_def. - # - # retry_params_name - Specifies the configuration for retry/backoff - # parameters. The name must be defined in interfaces.retry_params_def. - # - # field_name_patterns - Maps the field name of the request type to - # entity_name of interfaces.collections. - # Specifies the string pattern that the field must follow. - # - # timeout_millis - Specifies the default timeout for a non-retrying call. If - # the call is retrying, refer to retry_params_name instead. - methods: - - name: TranslateText - required_fields: - - contents - - target_language_code - - parent - retry_codes_name: non_idempotent - retry_params_name: default - field_name_patterns: - parent: location - timeout_millis: 60000 - - name: DetectLanguage - flattening: - groups: - - parameters: - - parent - - model - - mime_type - - labels - required_fields: - - parent - retry_codes_name: non_idempotent - retry_params_name: default - field_name_patterns: - parent: location - timeout_millis: 60000 - - name: GetSupportedLanguages - flattening: - groups: - - parameters: - - parent - - display_language_code - - model - required_fields: - - parent - retry_codes_name: idempotent - retry_params_name: default - field_name_patterns: - parent: location - timeout_millis: 60000 - - name: BatchTranslateText - required_fields: - - parent - - source_language_code - - target_language_codes - - input_configs - - output_config - retry_codes_name: non_idempotent - retry_params_name: default - field_name_patterns: - parent: location - long_running: - return_type: google.cloud.translation.v3.BatchTranslateResponse - metadata_type: google.cloud.translation.v3.BatchTranslateMetadata - initial_poll_delay_millis: 500 - poll_delay_multiplier: 1.5 - max_poll_delay_millis: 5000 - total_poll_timeout_millis: 300000 - timeout_millis: 60000 - - name: CreateGlossary - flattening: - groups: - - parameters: - - parent - - glossary - required_fields: - - parent - - glossary - retry_codes_name: non_idempotent - retry_params_name: default - field_name_patterns: - parent: location - long_running: - return_type: google.cloud.translation.v3.Glossary - metadata_type: google.cloud.translation.v3.CreateGlossaryMetadata - initial_poll_delay_millis: 500 - poll_delay_multiplier: 1.5 - max_poll_delay_millis: 5000 - total_poll_timeout_millis: 300000 - timeout_millis: 60000 - - name: ListGlossaries - flattening: - groups: - - parameters: - - parent - - filter - required_fields: - - parent - page_streaming: - request: - page_size_field: page_size - token_field: page_token - response: - token_field: next_page_token - resources_field: glossaries - retry_codes_name: idempotent - retry_params_name: default - field_name_patterns: - parent: location - timeout_millis: 60000 - - name: GetGlossary - flattening: - groups: - - parameters: - - name - required_fields: - - name - retry_codes_name: idempotent - retry_params_name: default - field_name_patterns: - name: glossary - timeout_millis: 60000 - - name: DeleteGlossary - flattening: - groups: - - parameters: - - name - required_fields: - - name - retry_codes_name: idempotent - retry_params_name: default - field_name_patterns: - name: glossary - long_running: - return_type: google.cloud.translation.v3.DeleteGlossaryResponse - metadata_type: google.cloud.translation.v3.DeleteGlossaryMetadata - initial_poll_delay_millis: 500 - poll_delay_multiplier: 1.5 - max_poll_delay_millis: 5000 - total_poll_timeout_millis: 300000 - timeout_millis: 60000 diff --git a/google/cloud/translate/v3/translate_grpc_service_config.json b/google/cloud/translate/v3/translate_grpc_service_config.json new file mode 100755 index 00000000..657011c1 --- /dev/null +++ b/google/cloud/translate/v3/translate_grpc_service_config.json @@ -0,0 +1,55 @@ +{ + "methodConfig": [ + { + "name": [ + { + "service": "google.cloud.translation.v3.TranslationService", + "method": "GetSupportedLanguages" + }, + { + "service": "google.cloud.translation.v3.TranslationService", + "method": "ListGlossaries" + }, + { + "service": "google.cloud.translation.v3.TranslationService", + "method": "GetGlossary" + }, + { + "service": "google.cloud.translation.v3.TranslationService", + "method": "DeleteGlossary" + } + ], + "timeout": "600s", + "retryPolicy": { + "initialBackoff": "0.100s", + "maxBackoff": "60s", + "backoffMultiplier": 1.3, + "retryableStatusCodes": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + } + }, + { + "name": [ + { + "service": "google.cloud.translation.v3.TranslationService", + "method": "TranslateText" + }, + { + "service": "google.cloud.translation.v3.TranslationService", + "method": "DetectLanguage" + }, + { + "service": "google.cloud.translation.v3.TranslationService", + "method": "BatchTranslateText" + }, + { + "service": "google.cloud.translation.v3.TranslationService", + "method": "CreateGlossary" + } + ], + "timeout": "600s" + } + ] +} diff --git a/google/cloud/translate/v3/translate_v3.yaml b/google/cloud/translate/v3/translate_v3.yaml new file mode 100644 index 00000000..dad62621 --- /dev/null +++ b/google/cloud/translate/v3/translate_v3.yaml @@ -0,0 +1,38 @@ +type: google.api.Service +config_version: 3 +name: translate.googleapis.com +title: Cloud Translation API + +apis: +- name: google.cloud.translation.v3.TranslationService + +documentation: + summary: Integrates text translation into your website or application. + +backend: + rules: + - selector: 'google.longrunning.Operations.*' + deadline: 60.0 + - selector: google.longrunning.Operations.WaitOperation + deadline: 120.0 + +authentication: + rules: + - selector: 'google.cloud.translation.v3.TranslationService.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-translation + - selector: google.cloud.translation.v3.TranslationService.BatchTranslateText + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform + - selector: google.cloud.translation.v3.TranslationService.CreateGlossary + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform + - selector: 'google.longrunning.Operations.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-translation diff --git a/google/cloud/translate/v3/translation_service.proto b/google/cloud/translate/v3/translation_service.proto index 91bbd7fb..c62398ec 100644 --- a/google/cloud/translate/v3/translation_service.proto +++ b/google/cloud/translate/v3/translation_service.proto @@ -18,10 +18,11 @@ syntax = "proto3"; package google.cloud.translation.v3; import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/timestamp.proto"; -import "google/api/client.proto"; option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.Translate.V3"; @@ -32,11 +33,11 @@ option java_package = "com.google.cloud.translate.v3"; option php_namespace = "Google\\Cloud\\Translate\\V3"; option ruby_package = "Google::Cloud::Translate::V3"; -// Proto file for the Cloud Translation API (v3). +// Proto file for the Cloud Translation API (v3 GA). // Provides natural language translation operations. service TranslationService { - option (google.api.default_host) = "translation.googleapis.com"; + option (google.api.default_host) = "translate.googleapis.com"; option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform," "https://www.googleapis.com/auth/cloud-translation"; @@ -63,6 +64,7 @@ service TranslationService { body: "*" } }; + option (google.api.method_signature) = "parent,model,mime_type,labels"; } // Returns a list of supported languages for translation. @@ -73,6 +75,7 @@ service TranslationService { get: "/v3/{parent=projects/*}/supportedLanguages" } }; + option (google.api.method_signature) = "parent,display_language_code,model"; } // Translates a large volume of text in asynchronous batch mode. @@ -87,6 +90,10 @@ service TranslationService { post: "/v3/{parent=projects/*/locations/*}:batchTranslateText" body: "*" }; + option (google.longrunning.operation_info) = { + response_type: "BatchTranslateResponse" + metadata_type: "BatchTranslateMetadata" + }; } // Creates a glossary and returns the long-running operation. Returns @@ -96,6 +103,11 @@ service TranslationService { post: "/v3/{parent=projects/*/locations/*}/glossaries" body: "glossary" }; + option (google.api.method_signature) = "parent,glossary"; + option (google.longrunning.operation_info) = { + response_type: "Glossary" + metadata_type: "CreateGlossaryMetadata" + }; } // Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't @@ -104,6 +116,7 @@ service TranslationService { option (google.api.http) = { get: "/v3/{parent=projects/*/locations/*}/glossaries" }; + option (google.api.method_signature) = "parent,filter"; } // Gets a glossary. Returns NOT_FOUND, if the glossary doesn't @@ -112,6 +125,7 @@ service TranslationService { option (google.api.http) = { get: "/v3/{name=projects/*/locations/*/glossaries/*}" }; + option (google.api.method_signature) = "name"; } // Deletes a glossary, or cancels glossary construction @@ -121,6 +135,11 @@ service TranslationService { option (google.api.http) = { delete: "/v3/{name=projects/*/locations/*/glossaries/*}" }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "DeleteGlossaryResponse" + metadata_type: "DeleteGlossaryMetadata" + }; } } @@ -129,11 +148,11 @@ service TranslationService { message TranslateTextGlossaryConfig { // Required. Specifies the glossary used for this translation. Use // this format: projects/*/locations/*/glossaries/* - string glossary = 1; + string glossary = 1 [(google.api.field_behavior) = REQUIRED]; // Optional. Indicates match is case-insensitive. // Default value is false if missing. - bool ignore_case = 2; + bool ignore_case = 2 [(google.api.field_behavior) = OPTIONAL]; } // The request message for synchronous translation. @@ -141,22 +160,22 @@ message TranslateTextRequest { // Required. The content of the input in string format. // We recommend the total content be less than 30k codepoints. // Use BatchTranslateText for larger text. - repeated string contents = 1; + repeated string contents = 1 [(google.api.field_behavior) = REQUIRED]; // Optional. The format of the source text, for example, "text/html", // "text/plain". If left blank, the MIME type defaults to "text/html". - string mime_type = 3; + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. The BCP-47 language code of the input text if // known, for example, "en-US" or "sr-Latn". Supported language codes are // listed in Language Support. If the source language isn't specified, the API // attempts to identify the source language automatically and returns the // source language within the response. - string source_language_code = 4; + string source_language_code = 4 [(google.api.field_behavior) = OPTIONAL]; // Required. The BCP-47 language code to use for translation of the input // text, set to one of the language codes listed in Language Support. - string target_language_code = 5; + string target_language_code = 5 [(google.api.field_behavior) = REQUIRED]; // Required. Project or location to make a call. Must refer to a caller's // project. @@ -172,7 +191,12 @@ message TranslateTextRequest { // // Models and glossaries must be within the same region (have same // location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - string parent = 8; + string parent = 8 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; // Optional. The `model` type requested for this translation. // @@ -191,12 +215,12 @@ message TranslateTextRequest { // `projects/{project-id}/locations/global/models/general/nmt`. // // If missing, the system decides which google base model to use. - string model = 6; + string model = 6 [(google.api.field_behavior) = OPTIONAL]; // Optional. Glossary to be applied. The glossary must be // within the same region (have the same location-id) as the model, otherwise // an INVALID_ARGUMENT (400) error is returned. - TranslateTextGlossaryConfig glossary_config = 7; + TranslateTextGlossaryConfig glossary_config = 7 [(google.api.field_behavior) = OPTIONAL]; // Optional. The labels with user-defined metadata for the request. // @@ -205,8 +229,8 @@ message TranslateTextRequest { // characters, underscores and dashes. International characters are allowed. // Label values are optional. Label keys must start with a letter. // - // See https://goo.gl/xmQnxf for more information on and examples of labels. - map labels = 10; + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 10 [(google.api.field_behavior) = OPTIONAL]; } message TranslateTextResponse { @@ -255,7 +279,12 @@ message DetectLanguageRequest { // // Only models within the same region (has same location-id) can be used. // Otherwise an INVALID_ARGUMENT (400) error is returned. - string parent = 5; + string parent = 5 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; // Optional. The language detection model to be used. // @@ -266,7 +295,7 @@ message DetectLanguageRequest { // `projects/{project-id}/locations/{location-id}/models/language-detection/default`. // // If not specified, the default model is used. - string model = 4; + string model = 4 [(google.api.field_behavior) = OPTIONAL]; // Required. The source of the document from which to detect the language. oneof source { @@ -276,7 +305,7 @@ message DetectLanguageRequest { // Optional. The format of the source text, for example, "text/html", // "text/plain". If left blank, the MIME type defaults to "text/html". - string mime_type = 3; + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. The labels with user-defined metadata for the request. // @@ -285,8 +314,8 @@ message DetectLanguageRequest { // characters, underscores and dashes. International characters are allowed. // Label values are optional. Label keys must start with a letter. // - // See https://goo.gl/xmQnxf for more information on and examples of labels. - map labels = 6; + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 6 [(google.api.field_behavior) = OPTIONAL]; } // The response message for language detection. @@ -321,12 +350,17 @@ message GetSupportedLanguagesRequest { // // Only models within the same region (have same location-id) can be used, // otherwise an INVALID_ARGUMENT (400) error is returned. - string parent = 3; + string parent = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; // Optional. The language to use to return localized, human readable names // of supported languages. If missing, then display names are not returned // in a response. - string display_language_code = 1; + string display_language_code = 1 [(google.api.field_behavior) = OPTIONAL]; // Optional. Get supported languages of this model. // @@ -342,7 +376,7 @@ message GetSupportedLanguagesRequest { // // Returns languages supported by the specified model. // If missing, we get supported languages of Google general base (PBMT) model. - string model = 2; + string model = 2 [(google.api.field_behavior) = OPTIONAL]; } // The response message for discovering supported languages. @@ -384,7 +418,7 @@ message InputConfig { // For `.tsv`, "text/html" is used if mime_type is missing. // For `.html`, this field must be "text/html" or empty. // For `.txt`, this field must be "text/plain" or empty. - string mime_type = 1; + string mime_type = 1 [(google.api.field_behavior) = OPTIONAL]; // Required. Specify the input. oneof source { @@ -503,13 +537,18 @@ message BatchTranslateTextRequest { // Only AutoML Translation models or glossaries within the same region (have // the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) // error is returned. - string parent = 1; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; // Required. Source language code. - string source_language_code = 2; + string source_language_code = 2 [(google.api.field_behavior) = REQUIRED]; // Required. Specify up to 10 language codes here. - repeated string target_language_codes = 3; + repeated string target_language_codes = 3 [(google.api.field_behavior) = REQUIRED]; // Optional. The models to use for translation. Map's key is target language // code. Map's value is model name. Value can be a built-in general model, @@ -527,22 +566,22 @@ message BatchTranslateTextRequest { // // If the map is empty or a specific model is // not requested for a language pair, then default google model (nmt) is used. - map models = 4; + map models = 4 [(google.api.field_behavior) = OPTIONAL]; // Required. Input configurations. // The total number of files matched should be <= 1000. // The total content size should be <= 100M Unicode codepoints. // The files must use UTF-8 encoding. - repeated InputConfig input_configs = 5; + repeated InputConfig input_configs = 5 [(google.api.field_behavior) = REQUIRED]; // Required. Output configuration. // If 2 input configs match to the same file (that is, same input path), // we don't generate output for duplicate inputs. - OutputConfig output_config = 6; + OutputConfig output_config = 6 [(google.api.field_behavior) = REQUIRED]; // Optional. Glossaries to be applied for translation. // It's keyed by target language code. - map glossaries = 7; + map glossaries = 7 [(google.api.field_behavior) = OPTIONAL]; // Optional. The labels with user-defined metadata for the request. // @@ -551,8 +590,8 @@ message BatchTranslateTextRequest { // characters, underscores and dashes. International characters are allowed. // Label values are optional. Label keys must start with a letter. // - // See https://goo.gl/xmQnxf for more information on and examples of labels. - map labels = 9; + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 9 [(google.api.field_behavior) = OPTIONAL]; } // State metadata for the batch translation operation. @@ -653,6 +692,11 @@ message GlossaryInputConfig { // Represents a glossary built from user provided data. message Glossary { + option (google.api.resource) = { + type: "translate.googleapis.com/Glossary" + pattern: "projects/{project}/locations/{location}/glossaries/{glossary}" + }; + // Used with unidirectional glossaries. message LanguageCodePair { // Required. The BCP-47 language code of the input text, for example, @@ -690,55 +734,75 @@ message Glossary { GlossaryInputConfig input_config = 5; // Output only. The number of entries defined in the glossary. - int32 entry_count = 6; + int32 entry_count = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. When CreateGlossary was called. - google.protobuf.Timestamp submit_time = 7; + google.protobuf.Timestamp submit_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. When the glossary creation was finished. - google.protobuf.Timestamp end_time = 8; + google.protobuf.Timestamp end_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; } // Request message for CreateGlossary. message CreateGlossaryRequest { // Required. The project name. - string parent = 1; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; // Required. The glossary to create. - Glossary glossary = 2; + Glossary glossary = 2 [(google.api.field_behavior) = REQUIRED]; } // Request message for GetGlossary. message GetGlossaryRequest { // Required. The name of the glossary to retrieve. - string name = 1; + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "translate.googleapis.com/Glossary" + } + ]; } // Request message for DeleteGlossary. message DeleteGlossaryRequest { // Required. The name of the glossary to delete. - string name = 1; + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "translate.googleapis.com/Glossary" + } + ]; } // Request message for ListGlossaries. message ListGlossariesRequest { // Required. The name of the project from which to list all of the glossaries. - string parent = 1; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; // Optional. Requested page size. The server may return fewer glossaries than // requested. If unspecified, the server picks an appropriate default. - int32 page_size = 2; + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; // Optional. A token identifying a page of results the server should return. // Typically, this is the value of [ListGlossariesResponse.next_page_token] // returned from the previous call to `ListGlossaries` method. // The first page is returned if `page_token`is empty or missing. - string page_token = 3; + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. Filter specifying constraints of a list operation. // Filtering is not supported yet, and the parameter currently has no effect. // If missing, no filtering is performed. - string filter = 4; + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; } // Response message for ListGlossaries.