Built motion from commit 44377920.|2.6.11
[motion2.git] / legacy-libs / google-proto-files / google / cloud / functions / v1beta2 / functions.proto
1 // Copyright 2017 Google Inc.
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
15 syntax = "proto3";
16
17 package google.cloud.functions.v1beta2;
18
19 import "google/api/annotations.proto";
20 import "google/api/auth.proto";
21 import "google/cloud/functions/v1beta2/operations.proto";
22 import "google/longrunning/operations.proto";
23 import "google/protobuf/duration.proto";
24 import "google/protobuf/timestamp.proto";
25
26 option go_package = "google.golang.org/genproto/googleapis/cloud/functions/v1beta2;functions";
27 option java_multiple_files = true;
28 option java_outer_classname = "FunctionsProto";
29 option java_package = "com.google.cloud.functions.v1beta2";
30 option objc_class_prefix = "GCF";
31
32 // A service that application uses to manipulate triggers and functions.
33 service CloudFunctionsService {
34   // Returns a list of functions that belong to the requested project.
35   rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) {
36     option (google.api.http) = {
37       get: "/v1beta2/{location=projects/*/locations/*}/functions"
38     };
39   }
40
41   // Returns a function with the given name from the requested project.
42   rpc GetFunction(GetFunctionRequest) returns (CloudFunction) {
43     option (google.api.http) = {
44       get: "/v1beta2/{name=projects/*/locations/*/functions/*}"
45     };
46   }
47
48   // Creates a new function. If a function with the given name already exists in
49   // the specified project, the long running operation will return
50   // `ALREADY_EXISTS` error.
51   rpc CreateFunction(CreateFunctionRequest)
52       returns (google.longrunning.Operation) {
53     option (google.api.http) = {
54       post: "/v1beta2/{location=projects/*/locations/*}/functions"
55       body: "function"
56     };
57   }
58
59   // Updates existing function.
60   rpc UpdateFunction(UpdateFunctionRequest)
61       returns (google.longrunning.Operation) {
62     option (google.api.http) = {
63       put: "/v1beta2/{name=projects/*/locations/*/functions/*}"
64       body: "function"
65     };
66   }
67
68   // Deletes a function with the given name from the specified project. If the
69   // given function is used by some trigger, the trigger will be updated to
70   // remove this function.
71   rpc DeleteFunction(DeleteFunctionRequest)
72       returns (google.longrunning.Operation) {
73     option (google.api.http) = {
74       delete: "/v1beta2/{name=projects/*/locations/*/functions/*}"
75     };
76   }
77
78   // Invokes synchronously deployed function. To be used for testing, very
79   // limited traffic allowed.
80   rpc CallFunction(CallFunctionRequest) returns (CallFunctionResponse) {
81     option (google.api.http) = {
82       post: "/v1beta2/{name=projects/*/locations/*/functions/*}:call"
83       body: "*"
84     };
85   }
86 }
87
88 // Describes a Cloud Function that contains user computation executed in
89 // response to an event. It encapsulate function and triggers configurations.
90 message CloudFunction {
91   // A user-defined name of the function. Function names must be unique
92   // globally and match pattern `projects/*/locations/*/functions/*`
93   string name = 1;
94
95   // The location of the function source code.
96   oneof source_code {
97     // The URL, starting with gs://, pointing to the zip archive which contains
98     // the function.
99     string source_archive_url = 14;
100
101     // The hosted repository where the function is defined.
102     SourceRepository source_repository = 3;
103   }
104
105   // An event that triggers the function.
106   oneof trigger {
107     // An HTTPS endpoint type of source that can be triggered via URL.
108     HTTPSTrigger https_trigger = 6;
109
110     // A source that fires events in response to a condition in another service.
111     EventTrigger event_trigger = 12;
112   }
113
114   // Output only. Status of the function deployment.
115   CloudFunctionStatus status = 7;
116
117   // Output only. Name of the most recent operation modifying the function. If
118   // the function status is `DEPLOYING` or `DELETING`, then it points to the
119   // active operation.
120   string latest_operation = 8;
121
122   // The name of the function (as defined in source code) that will be
123   // executed. Defaults to the resource name suffix, if not specified. For
124   // backward compatibility, if function with given name is not found, then the
125   // system will try to use function named "function".
126   // For Node.js this is name of a function exported by the module specified
127   // in `source_location`.
128   string entry_point = 9;
129
130   // The function execution timeout. Execution is considered failed and
131   // can be terminated if the function is not completed at the end of the
132   // timeout period. Defaults to 60 seconds.
133   google.protobuf.Duration timeout = 10;
134
135   // The amount of memory in MB available for a function.
136   // Defaults to 256MB.
137   int32 available_memory_mb = 11;
138
139   // Output only. The service account of the function.
140   string service_account = 13;
141
142   // Output only. The last update timestamp of a Cloud Function.
143   google.protobuf.Timestamp update_time = 15;
144 }
145
146 // Describes HTTPSTrigger, could be used to connect web hooks to function.
147 message HTTPSTrigger {
148   // Output only. The deployed url for the function.
149   string url = 1;
150 }
151
152 // Describes EventTrigger, used to request events be sent from another
153 // service.
154 message EventTrigger {
155   // `event_type` names contain the service that is sending an event and the
156   // kind of event that was fired. Must be of the form
157   // `providers/*/eventTypes/*` e.g. Directly handle a Message published to
158   // Google Cloud Pub/Sub `providers/cloud.pubsub/eventTypes/topic.publish`
159   //
160   //      Handle an object changing in Google Cloud Storage
161   //      `providers/cloud.storage/eventTypes/object.change`
162   //
163   //      Handle a write to the Firebase Realtime Database
164   //      `providers/firebase.database/eventTypes/data.write`
165   string event_type = 1;
166
167   // Which instance of the source's service should send events. E.g. for Pub/Sub
168   // this would be a Pub/Sub topic at `projects/*/topics/*`. For Google Cloud
169   // Storage this would be a bucket at `projects/*/buckets/*`. For any source
170   // that only supports one instance per-project, this should be the name of the
171   // project (`projects/*`)
172   string resource = 2;
173 }
174
175 // Describes the location of the function source in a remote repository.
176 message SourceRepository {
177   // URL to the hosted repository where the function is defined. Only paths in
178   // https://source.developers.google.com domain are supported. The path should
179   // contain the name of the repository.
180   string repository_url = 1;
181
182   // The path within the repository where the function is defined. The path
183   // should point to the directory where Cloud Functions files are located. Use
184   // "/" if the function is defined directly in the root directory of a
185   // repository.
186   string source_path = 2;
187
188   // The version of a function. Defaults to the latest version of the master
189   // branch.
190   oneof version {
191     // The name of the branch from which the function should be fetched.
192     string branch = 3;
193
194     // The name of the tag that captures the state of the repository from
195     // which the function should be fetched.
196     string tag = 4;
197
198     // The id of the revision that captures the state of the repository from
199     // which the function should be fetched.
200     string revision = 5;
201   }
202
203   // Output only. The id of the revision that was resolved at the moment of
204   // function creation or update. For example when a user deployed from a
205   // branch, it will be the revision id of the latest change on this branch at
206   // that time. If user deployed from revision then this value will be always
207   // equal to the revision specified by the user.
208   string deployed_revision = 6;
209 }
210
211 // Request for the `CreateFunction` method.
212 message CreateFunctionRequest {
213   // The project and location in which the function should be created, specified
214   // in the format `projects/*/locations/*`
215   string location = 1;
216
217   // Function to be created.
218   CloudFunction function = 2;
219 }
220
221 // Request for the `UpdateFunction` method.
222 message UpdateFunctionRequest {
223   // The name of the function to be updated.
224   string name = 1;
225
226   // New version of the function.
227   CloudFunction function = 2;
228 }
229
230 // Request for the `GetFunction` method.
231 message GetFunctionRequest {
232   // The name of the function which details should be obtained.
233   string name = 1;
234 }
235
236 // Request for the `ListFunctions` method.
237 message ListFunctionsRequest {
238   // The project and location from which the function should be listed,
239   // specified in the format `projects/*/locations/*`
240   // If you want to list functions in all locations, use "-" in place of a
241   // location.
242   string location = 1;
243
244   // Maximum number of functions to return per call.
245   int32 page_size = 2;
246
247   // The value returned by the last
248   // `ListFunctionsResponse`; indicates that
249   // this is a continuation of a prior `ListFunctions` call, and that the
250   // system should return the next page of data.
251   string page_token = 3;
252 }
253
254 // Response for the `ListFunctions` method.
255 message ListFunctionsResponse {
256   // The functions that match the request.
257   repeated CloudFunction functions = 1;
258
259   // If not empty, indicates that there may be more functions that match
260   // the request; this value should be passed in a new
261   // [google.cloud.functions.v1beta2.ListFunctionsRequest][]
262   // to get more functions.
263   string next_page_token = 2;
264 }
265
266 // Request for the `DeleteFunction` method.
267 message DeleteFunctionRequest {
268   // The name of the function which should be deleted.
269   string name = 1;
270 }
271
272 // Request for the `CallFunction` method.
273 message CallFunctionRequest {
274   // The name of the function to be called.
275   string name = 1;
276
277   // Input to be passed to the function.
278   string data = 2;
279 }
280
281 // Response of `CallFunction` method.
282 message CallFunctionResponse {
283   // Execution id of function invocation.
284   string execution_id = 1;
285
286   // Result populated for successful execution of synchronous function. Will
287   // not be populated if function does not return a result through context.
288   string result = 2;
289
290   // Either system or user-function generated error. Set if execution
291   // was not successful.
292   string error = 3;
293 }
294
295 // Describes the current stage of a deployment.
296 enum CloudFunctionStatus {
297   // Status not specified.
298   STATUS_UNSPECIFIED = 0;
299
300   // Successfully deployed.
301   READY = 1;
302
303   // Not deployed correctly - behavior is undefined. The item should be updated
304   // or deleted to move it out of this state.
305   FAILED = 2;
306
307   // Creation or update in progress.
308   DEPLOYING = 3;
309
310   // Deletion in progress.
311   DELETING = 4;
312 }