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