-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_apikey.proto
executable file
·148 lines (131 loc) · 4.23 KB
/
admin_apikey.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
syntax = "proto3";
import "status.proto";
option go_package = "vectara.com/public/proto/admin";
option java_package = "com.vectara.admin";
option java_outer_classname = "AdminApiKeyProtos";
package com.vectara.admin;
/******************************************************************************
API Keys
******************************************************************************/
// Types of ApiKey.
enum ApiKeyType {
API_KEY_TYPE__UNDEFINED = 0;
// ApiKey for serving. Only gives access to query data.
API_KEY_TYPE__SERVING = 1;
// ApiKey for serving and indexing. Gives access to both query and index data.
API_KEY_TYPE__SERVING_INDEXING = 2;
// ApiKey for personal access key.
API_KEY_TYPE__PERSONAL = 3;
}
// Status of ApiKey.
enum ApiKeyStatus {
UNKNOWN = 0;
ENABLED = 1;
DISABLED = 2;
DELETED = 3;
}
// Represents an ApiKey.
// An ApiKey provides anonymous access to common tasks such as index data, query data, etc.
message ApiKey {
string id = 1;
// Description of the ApiKey.
string description = 2;
// Type of the ApiKey.
ApiKeyType key_type = 3;
// Whether the ApiKey is enabled.
bool enabled = 4;
// Seconds sinch Epoch when the ApiKey becomes active.
optional int64 ts_start = 5;
// Seconds sinch Epoch when the ApiKey becomes inactive.
optional int64 ts_end = 6;
// Status of the ApiKey.
ApiKeyStatus status = 7;
// An id of the key that is not sensitive.
uint32 public_id = 8;
}
// This request can be used to create one or more ApiKeys.
// Every ApiKey is bound to one or more corpora.
message CreateApiKeyRequest {
// ApiKey data to create the ApiKey bound to one or more corpora.
message ApiKeyCorpus {
// Description of the ApiKey.
string description = 1;
// Type of the ApiKey.
ApiKeyType api_key_type = 3;
// List of corpus ids to bind the ApiKey to.
repeated uint32 corpus_id = 2;
}
// List of ApiKey data to create.
repeated ApiKeyCorpus api_key_data = 1;
}
// Response of the CreateApiKeyRequest.
message CreateApiKeyResponse {
// A valid key or Status of the ApiKey creation (in case of failure).
message ApiKeyOrStatus {
// A valid ApiKey.
string key_id = 1;
// Status of the ApiKey creation.
Status status = 2;
}
// List of ApiKeyOrStatus corresponding to the list of ApiKey data in request.
repeated ApiKeyOrStatus response = 1;
}
message ListApiKeysRequest {
// Max results to return.
uint32 num_results = 1;
// A key that is passed to retrieve a specific page of results.
// Leave empty to retrieve first page. Subsequent page requests should
// use the page key returned in previous response, and all other
// fields are ignored.
bytes page_key = 2;
// [Optional] Get API keys of these types.
// Default: If not set, API_KEY_TYPE__SERVING and API_KEY_TYPE__SERVING_INDEXING are returned.
repeated ApiKeyType api_key_type = 3;
// If set, returns corpus name & id associated with api keys.
bool read_corpora_info = 1000;
}
message ListApiKeysResponse {
// A message containing ApiKey and associated corpora.
message KeyAndCorpora{
// ApiKey data.
ApiKey api_key = 1;
// Message containing corpus name and id.
message CorpusInfo {
// Corpus id.
uint32 id = 1;
// Corpus name.
string name = 2;
}
// List of corpora associated with the ApiKey.
repeated CorpusInfo corpus = 2;
}
// List of ApiKey and associated corpora.
repeated KeyAndCorpora key_data = 1;
// A key that is passed into a subsequent result in order to
// retrieve the next page of results.
bytes page_key = 2;
// Status of the ListApiKeysRequest.
Status status = 1000;
}
message DeleteApiKeyRequest {
// List of ApiKey ids to delete.
repeated string key_id = 1;
}
message DeleteApiKeyResponse {
// Status of the DeleteApiKeyRequest.
repeated Status status = 1000;
}
message EnableApiKeyRequest {
message ApiKeyEnablement {
// ApiKey id to enable or disable.
string key_id = 1;
// Enable or disable using this variable
bool enable = 2;
}
// List of ApiKey ids to enable or disable.
repeated ApiKeyEnablement key_enablement = 1;
}
message EnableApiKeyResponse {
// List of Status such as OK, FAILED corresponding to the EnableApiKeyRequest.
repeated Status status = 1000;
}