1// Copyright 2021 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.cloud.automl.v1; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/cloud/automl/v1/annotation_payload.proto"; 24import "google/cloud/automl/v1/annotation_spec.proto"; 25import "google/cloud/automl/v1/dataset.proto"; 26import "google/cloud/automl/v1/image.proto"; 27import "google/cloud/automl/v1/io.proto"; 28import "google/cloud/automl/v1/model.proto"; 29import "google/cloud/automl/v1/model_evaluation.proto"; 30import "google/longrunning/operations.proto"; 31import "google/protobuf/field_mask.proto"; 32 33option csharp_namespace = "Google.Cloud.AutoML.V1"; 34option go_package = "cloud.google.com/go/automl/apiv1/automlpb;automlpb"; 35option java_multiple_files = true; 36option java_outer_classname = "AutoMlProto"; 37option java_package = "com.google.cloud.automl.v1"; 38option php_namespace = "Google\\Cloud\\AutoMl\\V1"; 39option ruby_package = "Google::Cloud::AutoML::V1"; 40 41// AutoML Server API. 42// 43// The resource names are assigned by the server. 44// The server never reuses names that it has created after the resources with 45// those names are deleted. 46// 47// An ID of a resource is the last element of the item's resource name. For 48// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then 49// the id for the item is `{dataset_id}`. 50// 51// Currently the only supported `location_id` is "us-central1". 52// 53// On any input that is documented to expect a string parameter in 54// snake_case or dash-case, either of those cases is accepted. 55service AutoMl { 56 option (google.api.default_host) = "automl.googleapis.com"; 57 option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; 58 59 // Creates a dataset. 60 rpc CreateDataset(CreateDatasetRequest) returns (google.longrunning.Operation) { 61 option (google.api.http) = { 62 post: "/v1/{parent=projects/*/locations/*}/datasets" 63 body: "dataset" 64 }; 65 option (google.api.method_signature) = "parent,dataset"; 66 option (google.longrunning.operation_info) = { 67 response_type: "Dataset" 68 metadata_type: "OperationMetadata" 69 }; 70 } 71 72 // Gets a dataset. 73 rpc GetDataset(GetDatasetRequest) returns (Dataset) { 74 option (google.api.http) = { 75 get: "/v1/{name=projects/*/locations/*/datasets/*}" 76 }; 77 option (google.api.method_signature) = "name"; 78 } 79 80 // Lists datasets in a project. 81 rpc ListDatasets(ListDatasetsRequest) returns (ListDatasetsResponse) { 82 option (google.api.http) = { 83 get: "/v1/{parent=projects/*/locations/*}/datasets" 84 }; 85 option (google.api.method_signature) = "parent"; 86 } 87 88 // Updates a dataset. 89 rpc UpdateDataset(UpdateDatasetRequest) returns (Dataset) { 90 option (google.api.http) = { 91 patch: "/v1/{dataset.name=projects/*/locations/*/datasets/*}" 92 body: "dataset" 93 }; 94 option (google.api.method_signature) = "dataset,update_mask"; 95 } 96 97 // Deletes a dataset and all of its contents. 98 // Returns empty response in the 99 // [response][google.longrunning.Operation.response] field when it completes, 100 // and `delete_details` in the 101 // [metadata][google.longrunning.Operation.metadata] field. 102 rpc DeleteDataset(DeleteDatasetRequest) returns (google.longrunning.Operation) { 103 option (google.api.http) = { 104 delete: "/v1/{name=projects/*/locations/*/datasets/*}" 105 }; 106 option (google.api.method_signature) = "name"; 107 option (google.longrunning.operation_info) = { 108 response_type: "google.protobuf.Empty" 109 metadata_type: "OperationMetadata" 110 }; 111 } 112 113 // Imports data into a dataset. 114 // For Tables this method can only be called on an empty Dataset. 115 // 116 // For Tables: 117 // * A 118 // [schema_inference_version][google.cloud.automl.v1.InputConfig.params] 119 // parameter must be explicitly set. 120 // Returns an empty response in the 121 // [response][google.longrunning.Operation.response] field when it completes. 122 rpc ImportData(ImportDataRequest) returns (google.longrunning.Operation) { 123 option (google.api.http) = { 124 post: "/v1/{name=projects/*/locations/*/datasets/*}:importData" 125 body: "*" 126 }; 127 option (google.api.method_signature) = "name,input_config"; 128 option (google.longrunning.operation_info) = { 129 response_type: "google.protobuf.Empty" 130 metadata_type: "OperationMetadata" 131 }; 132 } 133 134 // Exports dataset's data to the provided output location. 135 // Returns an empty response in the 136 // [response][google.longrunning.Operation.response] field when it completes. 137 rpc ExportData(ExportDataRequest) returns (google.longrunning.Operation) { 138 option (google.api.http) = { 139 post: "/v1/{name=projects/*/locations/*/datasets/*}:exportData" 140 body: "*" 141 }; 142 option (google.api.method_signature) = "name,output_config"; 143 option (google.longrunning.operation_info) = { 144 response_type: "google.protobuf.Empty" 145 metadata_type: "OperationMetadata" 146 }; 147 } 148 149 // Gets an annotation spec. 150 rpc GetAnnotationSpec(GetAnnotationSpecRequest) returns (AnnotationSpec) { 151 option (google.api.http) = { 152 get: "/v1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*}" 153 }; 154 option (google.api.method_signature) = "name"; 155 } 156 157 // Creates a model. 158 // Returns a Model in the [response][google.longrunning.Operation.response] 159 // field when it completes. 160 // When you create a model, several model evaluations are created for it: 161 // a global evaluation, and one evaluation for each annotation spec. 162 rpc CreateModel(CreateModelRequest) returns (google.longrunning.Operation) { 163 option (google.api.http) = { 164 post: "/v1/{parent=projects/*/locations/*}/models" 165 body: "model" 166 }; 167 option (google.api.method_signature) = "parent,model"; 168 option (google.longrunning.operation_info) = { 169 response_type: "Model" 170 metadata_type: "OperationMetadata" 171 }; 172 } 173 174 // Gets a model. 175 rpc GetModel(GetModelRequest) returns (Model) { 176 option (google.api.http) = { 177 get: "/v1/{name=projects/*/locations/*/models/*}" 178 }; 179 option (google.api.method_signature) = "name"; 180 } 181 182 // Lists models. 183 rpc ListModels(ListModelsRequest) returns (ListModelsResponse) { 184 option (google.api.http) = { 185 get: "/v1/{parent=projects/*/locations/*}/models" 186 }; 187 option (google.api.method_signature) = "parent"; 188 } 189 190 // Deletes a model. 191 // Returns `google.protobuf.Empty` in the 192 // [response][google.longrunning.Operation.response] field when it completes, 193 // and `delete_details` in the 194 // [metadata][google.longrunning.Operation.metadata] field. 195 rpc DeleteModel(DeleteModelRequest) returns (google.longrunning.Operation) { 196 option (google.api.http) = { 197 delete: "/v1/{name=projects/*/locations/*/models/*}" 198 }; 199 option (google.api.method_signature) = "name"; 200 option (google.longrunning.operation_info) = { 201 response_type: "google.protobuf.Empty" 202 metadata_type: "OperationMetadata" 203 }; 204 } 205 206 // Updates a model. 207 rpc UpdateModel(UpdateModelRequest) returns (Model) { 208 option (google.api.http) = { 209 patch: "/v1/{model.name=projects/*/locations/*/models/*}" 210 body: "model" 211 }; 212 option (google.api.method_signature) = "model,update_mask"; 213 } 214 215 // Deploys a model. If a model is already deployed, deploying it with the 216 // same parameters has no effect. Deploying with different parametrs 217 // (as e.g. changing 218 // [node_number][google.cloud.automl.v1p1beta.ImageObjectDetectionModelDeploymentMetadata.node_number]) 219 // will reset the deployment state without pausing the model's availability. 220 // 221 // Only applicable for Text Classification, Image Object Detection , Tables, and Image Segmentation; all other domains manage 222 // deployment automatically. 223 // 224 // Returns an empty response in the 225 // [response][google.longrunning.Operation.response] field when it completes. 226 rpc DeployModel(DeployModelRequest) returns (google.longrunning.Operation) { 227 option (google.api.http) = { 228 post: "/v1/{name=projects/*/locations/*/models/*}:deploy" 229 body: "*" 230 }; 231 option (google.api.method_signature) = "name"; 232 option (google.longrunning.operation_info) = { 233 response_type: "google.protobuf.Empty" 234 metadata_type: "OperationMetadata" 235 }; 236 } 237 238 // Undeploys a model. If the model is not deployed this method has no effect. 239 // 240 // Only applicable for Text Classification, Image Object Detection and Tables; 241 // all other domains manage deployment automatically. 242 // 243 // Returns an empty response in the 244 // [response][google.longrunning.Operation.response] field when it completes. 245 rpc UndeployModel(UndeployModelRequest) returns (google.longrunning.Operation) { 246 option (google.api.http) = { 247 post: "/v1/{name=projects/*/locations/*/models/*}:undeploy" 248 body: "*" 249 }; 250 option (google.api.method_signature) = "name"; 251 option (google.longrunning.operation_info) = { 252 response_type: "google.protobuf.Empty" 253 metadata_type: "OperationMetadata" 254 }; 255 } 256 257 // Exports a trained, "export-able", model to a user specified Google Cloud 258 // Storage location. A model is considered export-able if and only if it has 259 // an export format defined for it in 260 // [ModelExportOutputConfig][google.cloud.automl.v1.ModelExportOutputConfig]. 261 // 262 // Returns an empty response in the 263 // [response][google.longrunning.Operation.response] field when it completes. 264 rpc ExportModel(ExportModelRequest) returns (google.longrunning.Operation) { 265 option (google.api.http) = { 266 post: "/v1/{name=projects/*/locations/*/models/*}:export" 267 body: "*" 268 }; 269 option (google.api.method_signature) = "name,output_config"; 270 option (google.longrunning.operation_info) = { 271 response_type: "google.protobuf.Empty" 272 metadata_type: "OperationMetadata" 273 }; 274 } 275 276 // Gets a model evaluation. 277 rpc GetModelEvaluation(GetModelEvaluationRequest) returns (ModelEvaluation) { 278 option (google.api.http) = { 279 get: "/v1/{name=projects/*/locations/*/models/*/modelEvaluations/*}" 280 }; 281 option (google.api.method_signature) = "name"; 282 } 283 284 // Lists model evaluations. 285 rpc ListModelEvaluations(ListModelEvaluationsRequest) returns (ListModelEvaluationsResponse) { 286 option (google.api.http) = { 287 get: "/v1/{parent=projects/*/locations/*/models/*}/modelEvaluations" 288 }; 289 option (google.api.method_signature) = "parent,filter"; 290 } 291} 292 293// Request message for [AutoMl.CreateDataset][google.cloud.automl.v1.AutoMl.CreateDataset]. 294message CreateDatasetRequest { 295 // Required. The resource name of the project to create the dataset for. 296 string parent = 1 [ 297 (google.api.field_behavior) = REQUIRED, 298 (google.api.resource_reference) = { 299 type: "locations.googleapis.com/Location" 300 } 301 ]; 302 303 // Required. The dataset to create. 304 Dataset dataset = 2 [(google.api.field_behavior) = REQUIRED]; 305} 306 307// Request message for [AutoMl.GetDataset][google.cloud.automl.v1.AutoMl.GetDataset]. 308message GetDatasetRequest { 309 // Required. The resource name of the dataset to retrieve. 310 string name = 1 [ 311 (google.api.field_behavior) = REQUIRED, 312 (google.api.resource_reference) = { 313 type: "automl.googleapis.com/Dataset" 314 } 315 ]; 316} 317 318// Request message for [AutoMl.ListDatasets][google.cloud.automl.v1.AutoMl.ListDatasets]. 319message ListDatasetsRequest { 320 // Required. The resource name of the project from which to list datasets. 321 string parent = 1 [ 322 (google.api.field_behavior) = REQUIRED, 323 (google.api.resource_reference) = { 324 type: "locations.googleapis.com/Location" 325 } 326 ]; 327 328 // An expression for filtering the results of the request. 329 // 330 // * `dataset_metadata` - for existence of the case (e.g. 331 // `image_classification_dataset_metadata:*`). Some examples of using the filter are: 332 // 333 // * `translation_dataset_metadata:*` --> The dataset has 334 // `translation_dataset_metadata`. 335 string filter = 3; 336 337 // Requested page size. Server may return fewer results than requested. 338 // If unspecified, server will pick a default size. 339 int32 page_size = 4; 340 341 // A token identifying a page of results for the server to return 342 // Typically obtained via 343 // [ListDatasetsResponse.next_page_token][google.cloud.automl.v1.ListDatasetsResponse.next_page_token] of the previous 344 // [AutoMl.ListDatasets][google.cloud.automl.v1.AutoMl.ListDatasets] call. 345 string page_token = 6; 346} 347 348// Response message for [AutoMl.ListDatasets][google.cloud.automl.v1.AutoMl.ListDatasets]. 349message ListDatasetsResponse { 350 // The datasets read. 351 repeated Dataset datasets = 1; 352 353 // A token to retrieve next page of results. 354 // Pass to [ListDatasetsRequest.page_token][google.cloud.automl.v1.ListDatasetsRequest.page_token] to obtain that page. 355 string next_page_token = 2; 356} 357 358// Request message for [AutoMl.UpdateDataset][google.cloud.automl.v1.AutoMl.UpdateDataset] 359message UpdateDatasetRequest { 360 // Required. The dataset which replaces the resource on the server. 361 Dataset dataset = 1 [(google.api.field_behavior) = REQUIRED]; 362 363 // Required. The update mask applies to the resource. 364 google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; 365} 366 367// Request message for [AutoMl.DeleteDataset][google.cloud.automl.v1.AutoMl.DeleteDataset]. 368message DeleteDatasetRequest { 369 // Required. The resource name of the dataset to delete. 370 string name = 1 [ 371 (google.api.field_behavior) = REQUIRED, 372 (google.api.resource_reference) = { 373 type: "automl.googleapis.com/Dataset" 374 } 375 ]; 376} 377 378// Request message for [AutoMl.ImportData][google.cloud.automl.v1.AutoMl.ImportData]. 379message ImportDataRequest { 380 // Required. Dataset name. Dataset must already exist. All imported 381 // annotations and examples will be added. 382 string name = 1 [ 383 (google.api.field_behavior) = REQUIRED, 384 (google.api.resource_reference) = { 385 type: "automl.googleapis.com/Dataset" 386 } 387 ]; 388 389 // Required. The desired input location and its domain specific semantics, 390 // if any. 391 InputConfig input_config = 3 [(google.api.field_behavior) = REQUIRED]; 392} 393 394// Request message for [AutoMl.ExportData][google.cloud.automl.v1.AutoMl.ExportData]. 395message ExportDataRequest { 396 // Required. The resource name of the dataset. 397 string name = 1 [ 398 (google.api.field_behavior) = REQUIRED, 399 (google.api.resource_reference) = { 400 type: "automl.googleapis.com/Dataset" 401 } 402 ]; 403 404 // Required. The desired output location. 405 OutputConfig output_config = 3 [(google.api.field_behavior) = REQUIRED]; 406} 407 408// Request message for [AutoMl.GetAnnotationSpec][google.cloud.automl.v1.AutoMl.GetAnnotationSpec]. 409message GetAnnotationSpecRequest { 410 // Required. The resource name of the annotation spec to retrieve. 411 string name = 1 [ 412 (google.api.field_behavior) = REQUIRED, 413 (google.api.resource_reference) = { 414 type: "automl.googleapis.com/AnnotationSpec" 415 } 416 ]; 417} 418 419// Request message for [AutoMl.CreateModel][google.cloud.automl.v1.AutoMl.CreateModel]. 420message CreateModelRequest { 421 // Required. Resource name of the parent project where the model is being created. 422 string parent = 1 [ 423 (google.api.field_behavior) = REQUIRED, 424 (google.api.resource_reference) = { 425 type: "locations.googleapis.com/Location" 426 } 427 ]; 428 429 // Required. The model to create. 430 Model model = 4 [(google.api.field_behavior) = REQUIRED]; 431} 432 433// Request message for [AutoMl.GetModel][google.cloud.automl.v1.AutoMl.GetModel]. 434message GetModelRequest { 435 // Required. Resource name of the model. 436 string name = 1 [ 437 (google.api.field_behavior) = REQUIRED, 438 (google.api.resource_reference) = { 439 type: "automl.googleapis.com/Model" 440 } 441 ]; 442} 443 444// Request message for [AutoMl.ListModels][google.cloud.automl.v1.AutoMl.ListModels]. 445message ListModelsRequest { 446 // Required. Resource name of the project, from which to list the models. 447 string parent = 1 [ 448 (google.api.field_behavior) = REQUIRED, 449 (google.api.resource_reference) = { 450 type: "locations.googleapis.com/Location" 451 } 452 ]; 453 454 // An expression for filtering the results of the request. 455 // 456 // * `model_metadata` - for existence of the case (e.g. 457 // `video_classification_model_metadata:*`). 458 // * `dataset_id` - for = or !=. Some examples of using the filter are: 459 // 460 // * `image_classification_model_metadata:*` --> The model has 461 // `image_classification_model_metadata`. 462 // * `dataset_id=5` --> The model was created from a dataset with ID 5. 463 string filter = 3; 464 465 // Requested page size. 466 int32 page_size = 4; 467 468 // A token identifying a page of results for the server to return 469 // Typically obtained via 470 // [ListModelsResponse.next_page_token][google.cloud.automl.v1.ListModelsResponse.next_page_token] of the previous 471 // [AutoMl.ListModels][google.cloud.automl.v1.AutoMl.ListModels] call. 472 string page_token = 6; 473} 474 475// Response message for [AutoMl.ListModels][google.cloud.automl.v1.AutoMl.ListModels]. 476message ListModelsResponse { 477 // List of models in the requested page. 478 repeated Model model = 1; 479 480 // A token to retrieve next page of results. 481 // Pass to [ListModelsRequest.page_token][google.cloud.automl.v1.ListModelsRequest.page_token] to obtain that page. 482 string next_page_token = 2; 483} 484 485// Request message for [AutoMl.DeleteModel][google.cloud.automl.v1.AutoMl.DeleteModel]. 486message DeleteModelRequest { 487 // Required. Resource name of the model being deleted. 488 string name = 1 [ 489 (google.api.field_behavior) = REQUIRED, 490 (google.api.resource_reference) = { 491 type: "automl.googleapis.com/Model" 492 } 493 ]; 494} 495 496// Request message for [AutoMl.UpdateModel][google.cloud.automl.v1.AutoMl.UpdateModel] 497message UpdateModelRequest { 498 // Required. The model which replaces the resource on the server. 499 Model model = 1 [(google.api.field_behavior) = REQUIRED]; 500 501 // Required. The update mask applies to the resource. 502 google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; 503} 504 505// Request message for [AutoMl.DeployModel][google.cloud.automl.v1.AutoMl.DeployModel]. 506message DeployModelRequest { 507 // The per-domain specific deployment parameters. 508 oneof model_deployment_metadata { 509 // Model deployment metadata specific to Image Object Detection. 510 ImageObjectDetectionModelDeploymentMetadata image_object_detection_model_deployment_metadata = 2; 511 512 // Model deployment metadata specific to Image Classification. 513 ImageClassificationModelDeploymentMetadata image_classification_model_deployment_metadata = 4; 514 } 515 516 // Required. Resource name of the model to deploy. 517 string name = 1 [ 518 (google.api.field_behavior) = REQUIRED, 519 (google.api.resource_reference) = { 520 type: "automl.googleapis.com/Model" 521 } 522 ]; 523} 524 525// Request message for [AutoMl.UndeployModel][google.cloud.automl.v1.AutoMl.UndeployModel]. 526message UndeployModelRequest { 527 // Required. Resource name of the model to undeploy. 528 string name = 1 [ 529 (google.api.field_behavior) = REQUIRED, 530 (google.api.resource_reference) = { 531 type: "automl.googleapis.com/Model" 532 } 533 ]; 534} 535 536// Request message for [AutoMl.ExportModel][google.cloud.automl.v1.AutoMl.ExportModel]. 537// Models need to be enabled for exporting, otherwise an error code will be 538// returned. 539message ExportModelRequest { 540 // Required. The resource name of the model to export. 541 string name = 1 [ 542 (google.api.field_behavior) = REQUIRED, 543 (google.api.resource_reference) = { 544 type: "automl.googleapis.com/Model" 545 } 546 ]; 547 548 // Required. The desired output location and configuration. 549 ModelExportOutputConfig output_config = 3 [(google.api.field_behavior) = REQUIRED]; 550} 551 552// Request message for [AutoMl.GetModelEvaluation][google.cloud.automl.v1.AutoMl.GetModelEvaluation]. 553message GetModelEvaluationRequest { 554 // Required. Resource name for the model evaluation. 555 string name = 1 [ 556 (google.api.field_behavior) = REQUIRED, 557 (google.api.resource_reference) = { 558 type: "automl.googleapis.com/ModelEvaluation" 559 } 560 ]; 561} 562 563// Request message for [AutoMl.ListModelEvaluations][google.cloud.automl.v1.AutoMl.ListModelEvaluations]. 564message ListModelEvaluationsRequest { 565 // Required. Resource name of the model to list the model evaluations for. 566 // If modelId is set as "-", this will list model evaluations from across all 567 // models of the parent location. 568 string parent = 1 [ 569 (google.api.field_behavior) = REQUIRED, 570 (google.api.resource_reference) = { 571 type: "automl.googleapis.com/Model" 572 } 573 ]; 574 575 // Required. An expression for filtering the results of the request. 576 // 577 // * `annotation_spec_id` - for =, != or existence. See example below for 578 // the last. 579 // 580 // Some examples of using the filter are: 581 // 582 // * `annotation_spec_id!=4` --> The model evaluation was done for 583 // annotation spec with ID different than 4. 584 // * `NOT annotation_spec_id:*` --> The model evaluation was done for 585 // aggregate of all annotation specs. 586 string filter = 3 [(google.api.field_behavior) = REQUIRED]; 587 588 // Requested page size. 589 int32 page_size = 4; 590 591 // A token identifying a page of results for the server to return. 592 // Typically obtained via 593 // [ListModelEvaluationsResponse.next_page_token][google.cloud.automl.v1.ListModelEvaluationsResponse.next_page_token] of the previous 594 // [AutoMl.ListModelEvaluations][google.cloud.automl.v1.AutoMl.ListModelEvaluations] call. 595 string page_token = 6; 596} 597 598// Response message for [AutoMl.ListModelEvaluations][google.cloud.automl.v1.AutoMl.ListModelEvaluations]. 599message ListModelEvaluationsResponse { 600 // List of model evaluations in the requested page. 601 repeated ModelEvaluation model_evaluation = 1; 602 603 // A token to retrieve next page of results. 604 // Pass to the [ListModelEvaluationsRequest.page_token][google.cloud.automl.v1.ListModelEvaluationsRequest.page_token] field of a new 605 // [AutoMl.ListModelEvaluations][google.cloud.automl.v1.AutoMl.ListModelEvaluations] request to obtain that page. 606 string next_page_token = 2; 607} 608