prediction_apikey_registry_service.proto 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. // Copyright 2020 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. syntax = "proto3";
  15. package google.cloud.recommendationengine.v1beta1;
  16. import "google/api/annotations.proto";
  17. import "google/api/field_behavior.proto";
  18. import "google/api/resource.proto";
  19. import "google/protobuf/empty.proto";
  20. import "google/api/client.proto";
  21. import "google/cloud/recommendationengine/v1beta1/recommendationengine_resources.proto";
  22. option csharp_namespace = "Google.Cloud.RecommendationEngine.V1Beta1";
  23. option go_package = "google.golang.org/genproto/googleapis/cloud/recommendationengine/v1beta1;recommendationengine";
  24. option java_multiple_files = true;
  25. option java_package = "com.google.cloud.recommendationengine.v1beta1";
  26. option objc_class_prefix = "RECAI";
  27. option php_namespace = "Google\\Cloud\\RecommendationEngine\\V1beta1";
  28. option ruby_package = "Google::Cloud::RecommendationEngine::V1beta1";
  29. // Service for registering API keys for use with the `predict` method. If you
  30. // use an API key to request predictions, you must first register the API key.
  31. // Otherwise, your prediction request is rejected. If you use OAuth to
  32. // authenticate your `predict` method call, you do not need to register an API
  33. // key. You can register up to 20 API keys per project.
  34. service PredictionApiKeyRegistry {
  35. option (google.api.default_host) = "recommendationengine.googleapis.com";
  36. option (google.api.oauth_scopes) =
  37. "https://www.googleapis.com/auth/cloud-platform";
  38. // Register an API key for use with predict method.
  39. rpc CreatePredictionApiKeyRegistration(
  40. CreatePredictionApiKeyRegistrationRequest)
  41. returns (PredictionApiKeyRegistration) {
  42. option (google.api.http) = {
  43. post: "/v1beta1/{parent=projects/*/locations/*/catalogs/*/eventStores/*}/predictionApiKeyRegistrations"
  44. body: "*"
  45. };
  46. option (google.api.method_signature) =
  47. "parent,prediction_api_key_registration";
  48. }
  49. // List the registered apiKeys for use with predict method.
  50. rpc ListPredictionApiKeyRegistrations(
  51. ListPredictionApiKeyRegistrationsRequest)
  52. returns (ListPredictionApiKeyRegistrationsResponse) {
  53. option (google.api.http) = {
  54. get: "/v1beta1/{parent=projects/*/locations/*/catalogs/*/eventStores/*}/predictionApiKeyRegistrations"
  55. };
  56. option (google.api.method_signature) = "parent";
  57. }
  58. // Unregister an apiKey from using for predict method.
  59. rpc DeletePredictionApiKeyRegistration(
  60. DeletePredictionApiKeyRegistrationRequest)
  61. returns (google.protobuf.Empty) {
  62. option (google.api.http) = {
  63. delete: "/v1beta1/{name=projects/*/locations/*/catalogs/*/eventStores/*/predictionApiKeyRegistrations/*}"
  64. };
  65. option (google.api.method_signature) = "name";
  66. }
  67. }
  68. // Registered Api Key.
  69. message PredictionApiKeyRegistration {
  70. // The API key.
  71. string api_key = 1;
  72. }
  73. // Request message for the `CreatePredictionApiKeyRegistration` method.
  74. message CreatePredictionApiKeyRegistrationRequest {
  75. // Required. The parent resource path.
  76. // `projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store`.
  77. string parent = 1 [
  78. (google.api.field_behavior) = REQUIRED,
  79. (google.api.resource_reference) = {
  80. type: "recommendationengine.googleapis.com/EventStore"
  81. }
  82. ];
  83. // Required. The prediction API key registration.
  84. PredictionApiKeyRegistration prediction_api_key_registration = 2
  85. [(google.api.field_behavior) = REQUIRED];
  86. }
  87. // Request message for the `ListPredictionApiKeyRegistrations`.
  88. message ListPredictionApiKeyRegistrationsRequest {
  89. // Required. The parent placement resource name such as
  90. // `projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store`
  91. string parent = 1 [
  92. (google.api.field_behavior) = REQUIRED,
  93. (google.api.resource_reference) = {
  94. type: "recommendationengine.googleapis.com/EventStore"
  95. }
  96. ];
  97. // Optional. Maximum number of results to return per page. If unset, the
  98. // service will choose a reasonable default.
  99. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  100. // Optional. The previous `ListPredictionApiKeyRegistration.nextPageToken`.
  101. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  102. }
  103. // Response message for the `ListPredictionApiKeyRegistrations`.
  104. message ListPredictionApiKeyRegistrationsResponse {
  105. // The list of registered API keys.
  106. repeated PredictionApiKeyRegistration prediction_api_key_registrations = 1;
  107. // If empty, the list is complete. If nonempty, pass the token to the next
  108. // request's `ListPredictionApiKeysRegistrationsRequest.pageToken`.
  109. string next_page_token = 2;
  110. }
  111. // Request message for `DeletePredictionApiKeyRegistration` method.
  112. message DeletePredictionApiKeyRegistrationRequest {
  113. // Required. The API key to unregister including full resource path.
  114. // `projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/predictionApiKeyRegistrations/<YOUR_API_KEY>`
  115. string name = 1 [
  116. (google.api.field_behavior) = REQUIRED,
  117. (google.api.resource_reference) = {
  118. type: "recommendationengine.googleapis.com/PredictionApiKeyRegistration"
  119. }
  120. ];
  121. }