@@ -23,6 +23,8 @@ import "google/api/resource.proto";
2323import "google/cloud/documentai/v1beta3/document.proto" ;
2424import "google/cloud/documentai/v1beta3/document_io.proto" ;
2525import "google/cloud/documentai/v1beta3/operation_metadata.proto" ;
26+ import "google/cloud/documentai/v1beta3/processor.proto" ;
27+ import "google/cloud/documentai/v1beta3/processor_type.proto" ;
2628import "google/longrunning/operations.proto" ;
2729import "google/protobuf/field_mask.proto" ;
2830import "google/protobuf/timestamp.proto" ;
@@ -44,10 +46,6 @@ option (google.api.resource_definition) = {
4446 type : "documentai.googleapis.com/Location"
4547 pattern : "projects/{project}/locations/{location}"
4648};
47- option (google.api.resource_definition ) = {
48- type : "documentai.googleapis.com/Processor"
49- pattern : "projects/{project}/locations/{location}/processors/{processor}"
50- };
5149option (google.api.resource_definition ) = {
5250 type : "documentai.googleapis.com/HumanReviewConfig"
5351 pattern : "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig"
@@ -84,6 +82,69 @@ service DocumentProcessorService {
8482 };
8583 }
8684
85+ // Fetches processor types.
86+ rpc FetchProcessorTypes (FetchProcessorTypesRequest ) returns (FetchProcessorTypesResponse ) {
87+ option (google.api.http ) = {
88+ get : "/v1beta3/{parent=projects/*/locations/*}:fetchProcessorTypes"
89+ };
90+ option (google.api.method_signature ) = "parent" ;
91+ }
92+
93+ // Lists all processors which belong to this project.
94+ rpc ListProcessors (ListProcessorsRequest ) returns (ListProcessorsResponse ) {
95+ option (google.api.http ) = {
96+ get : "/v1beta3/{parent=projects/*/locations/*}/processors"
97+ };
98+ option (google.api.method_signature ) = "parent" ;
99+ }
100+
101+ // Creates a processor from the type processor that the user chose.
102+ // The processor will be at "ENABLED" state by default after its creation.
103+ rpc CreateProcessor (CreateProcessorRequest ) returns (Processor ) {
104+ option (google.api.http ) = {
105+ post : "/v1beta3/{parent=projects/*/locations/*}/processors"
106+ body : "processor"
107+ };
108+ option (google.api.method_signature ) = "parent,processor" ;
109+ }
110+
111+ // Deletes the processor, unloads all deployed model artifacts if it was
112+ // enabled and then deletes all artifacts associated with this processor.
113+ rpc DeleteProcessor (DeleteProcessorRequest ) returns (google.longrunning.Operation ) {
114+ option (google.api.http ) = {
115+ delete : "/v1beta3/{name=projects/*/locations/*/processors/*}"
116+ };
117+ option (google.api.method_signature ) = "name" ;
118+ option (google.longrunning.operation_info ) = {
119+ response_type : "google.protobuf.Empty"
120+ metadata_type : "DeleteProcessorMetadata"
121+ };
122+ }
123+
124+ // Enables a processor
125+ rpc EnableProcessor (EnableProcessorRequest ) returns (google.longrunning.Operation ) {
126+ option (google.api.http ) = {
127+ post : "/v1beta3/{name=projects/*/locations/*/processors/*}:enable"
128+ body : "*"
129+ };
130+ option (google.longrunning.operation_info ) = {
131+ response_type : "EnableProcessorResponse"
132+ metadata_type : "EnableProcessorMetadata"
133+ };
134+ }
135+
136+ // Disables a processor
137+ rpc DisableProcessor (DisableProcessorRequest ) returns (google.longrunning.Operation ) {
138+ option (google.api.http ) = {
139+ post : "/v1beta3/{name=projects/*/locations/*/processors/*}:disable"
140+ body : "*"
141+ };
142+ option (google.longrunning.operation_info ) = {
143+ response_type : "DisableProcessorResponse"
144+ metadata_type : "DisableProcessorMetadata"
145+ };
146+ }
147+
87148 // Send a document for Human Review. The input document should be processed by
88149 // the specified processor.
89150 rpc ReviewDocument (ReviewDocumentRequest ) returns (google.longrunning.Operation ) {
@@ -299,8 +360,146 @@ message BatchProcessMetadata {
299360 repeated IndividualProcessStatus individual_process_statuses = 5 ;
300361}
301362
363+ // Request message for fetch processor types.
364+ message FetchProcessorTypesRequest {
365+ // Required. The project of processor type to list.
366+ // Format: projects/{project}/locations/{location}
367+ string parent = 1 [
368+ (google.api.field_behavior ) = REQUIRED ,
369+ (google.api.resource_reference ) = {
370+ child_type : "documentai.googleapis.com/ProcessorType"
371+ }
372+ ];
373+ }
374+
375+ // Response message for fetch processor types.
376+ message FetchProcessorTypesResponse {
377+ // The list of processor types.
378+ repeated ProcessorType processor_types = 1 ;
379+ }
380+
381+ // Request message for list all processors belongs to a project.
382+ message ListProcessorsRequest {
383+ // Required. The parent (project and location) which owns this collection of Processors.
384+ // Format: projects/{project}/locations/{location}
385+ string parent = 1 [
386+ (google.api.field_behavior ) = REQUIRED ,
387+ (google.api.resource_reference ) = {
388+ child_type : "documentai.googleapis.com/Processor"
389+ }
390+ ];
391+
392+ // The maximum number of processors to return.
393+ // If unspecified, at most 50 processors will be returned.
394+ // The maximum value is 100; values above 100 will be coerced to 100.
395+ int32 page_size = 2 ;
396+
397+ // We will return the processors sorted by creation time. The page token
398+ // will point to the next processor.
399+ string page_token = 3 ;
400+ }
401+
402+ // Response message for list processors.
403+ message ListProcessorsResponse {
404+ // The list of processors.
405+ repeated Processor processors = 1 ;
406+
407+ // Points to the next processor, otherwise empty.
408+ string next_page_token = 2 ;
409+ }
410+
411+ // Request message for create a processor. Notice this request is sent to
412+ // a regionalized backend service, and if the processor type is not available
413+ // on that region, the creation will fail.
414+ message CreateProcessorRequest {
415+ // Required. The parent (project and location) under which to create the processor.
416+ // Format: projects/{project}/locations/{location}
417+ string parent = 1 [
418+ (google.api.field_behavior ) = REQUIRED ,
419+ (google.api.resource_reference ) = {
420+ child_type : "documentai.googleapis.com/Processor"
421+ }
422+ ];
423+
424+ // Required. The processor to be created, requires [processor_type] and [display_name]
425+ // to be set. Also, the processor is under CMEK if CMEK fields are set.
426+ Processor processor = 2 [(google.api.field_behavior ) = REQUIRED ];
427+ }
428+
429+ // Request message for the delete processor method.
430+ message DeleteProcessorRequest {
431+ // Required. The processor resource name to be deleted.
432+ string name = 1 [
433+ (google.api.field_behavior ) = REQUIRED ,
434+ (google.api.resource_reference ) = {
435+ type : "documentai.googleapis.com/Processor"
436+ }
437+ ];
438+ }
439+
440+ // The long running operation metadata for delete processor method.
441+ message DeleteProcessorMetadata {
442+ // The basic metadata of the long running operation.
443+ CommonOperationMetadata common_metadata = 5 ;
444+ }
445+
446+ // Request message for the enable processor method.
447+ message EnableProcessorRequest {
448+ // Required. The processor resource name to be enabled.
449+ string name = 1 [
450+ (google.api.field_behavior ) = REQUIRED ,
451+ (google.api.resource_reference ) = {
452+ type : "documentai.googleapis.com/Processor"
453+ }
454+ ];
455+ }
456+
457+ // Response message for the enable processor method.
458+ message EnableProcessorResponse {
459+
460+ }
461+
462+ // The long running operation metadata for enable processor method.
463+ message EnableProcessorMetadata {
464+ // The basic metadata of the long running operation.
465+ CommonOperationMetadata common_metadata = 5 ;
466+ }
467+
468+ // Request message for the disable processor method.
469+ message DisableProcessorRequest {
470+ // Required. The processor resource name to be disabled.
471+ string name = 1 [
472+ (google.api.field_behavior ) = REQUIRED ,
473+ (google.api.resource_reference ) = {
474+ type : "documentai.googleapis.com/Processor"
475+ }
476+ ];
477+ }
478+
479+ // Response message for the disable processor method.
480+ message DisableProcessorResponse {
481+
482+ }
483+
484+ // The long running operation metadata for disable processor method.
485+ message DisableProcessorMetadata {
486+ // The basic metadata of the long running operation.
487+ CommonOperationMetadata common_metadata = 5 ;
488+ }
489+
302490// Request message for review document method.
491+ // Next Id: 6.
303492message ReviewDocumentRequest {
493+ // The priority level of the human review task.
494+ enum Priority {
495+ // The default priority level.
496+ DEFAULT = 0 ;
497+
498+ // The urgent priority level. The labeling manager should allocate labeler
499+ // resource to the urgent task queue to respect this priority level.
500+ URGENT = 1 ;
501+ }
502+
304503 // The document payload.
305504 oneof source {
306505 // An inline document proto.
@@ -318,6 +517,12 @@ message ReviewDocumentRequest {
318517
319518 // The document that needs human review.
320519 Document document = 2 [deprecated = true ];
520+
521+ // Whether the validation should be performed on the ad-hoc review request.
522+ bool enable_schema_validation = 3 ;
523+
524+ // The priority of the human review task.
525+ Priority priority = 5 ;
321526}
322527
323528// Response message for review document method.
0 commit comments