1 // Copyright 2017 Google Inc.
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 package google.cloud.functions.v1beta2;
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";
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";
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"
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/*}"
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"
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/*}"
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/*}"
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"
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/*`
95 // The location of the function source code.
97 // The URL, starting with gs://, pointing to the zip archive which contains
99 string source_archive_url = 14;
101 // The hosted repository where the function is defined.
102 SourceRepository source_repository = 3;
105 // An event that triggers the function.
107 // An HTTPS endpoint type of source that can be triggered via URL.
108 HTTPSTrigger https_trigger = 6;
110 // A source that fires events in response to a condition in another service.
111 EventTrigger event_trigger = 12;
114 // Output only. Status of the function deployment.
115 CloudFunctionStatus status = 7;
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
120 string latest_operation = 8;
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;
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;
135 // The amount of memory in MB available for a function.
136 // Defaults to 256MB.
137 int32 available_memory_mb = 11;
139 // Output only. The service account of the function.
140 string service_account = 13;
142 // Output only. The last update timestamp of a Cloud Function.
143 google.protobuf.Timestamp update_time = 15;
146 // Describes HTTPSTrigger, could be used to connect web hooks to function.
147 message HTTPSTrigger {
148 // Output only. The deployed url for the function.
152 // Describes EventTrigger, used to request events be sent from another
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`
160 // Handle an object changing in Google Cloud Storage
161 // `providers/cloud.storage/eventTypes/object.change`
163 // Handle a write to the Firebase Realtime Database
164 // `providers/firebase.database/eventTypes/data.write`
165 string event_type = 1;
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/*`)
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;
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
186 string source_path = 2;
188 // The version of a function. Defaults to the latest version of the master
191 // The name of the branch from which the function should be fetched.
194 // The name of the tag that captures the state of the repository from
195 // which the function should be fetched.
198 // The id of the revision that captures the state of the repository from
199 // which the function should be fetched.
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;
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/*`
217 // Function to be created.
218 CloudFunction function = 2;
221 // Request for the `UpdateFunction` method.
222 message UpdateFunctionRequest {
223 // The name of the function to be updated.
226 // New version of the function.
227 CloudFunction function = 2;
230 // Request for the `GetFunction` method.
231 message GetFunctionRequest {
232 // The name of the function which details should be obtained.
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
244 // Maximum number of functions to return per call.
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;
254 // Response for the `ListFunctions` method.
255 message ListFunctionsResponse {
256 // The functions that match the request.
257 repeated CloudFunction functions = 1;
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;
266 // Request for the `DeleteFunction` method.
267 message DeleteFunctionRequest {
268 // The name of the function which should be deleted.
272 // Request for the `CallFunction` method.
273 message CallFunctionRequest {
274 // The name of the function to be called.
277 // Input to be passed to the function.
281 // Response of `CallFunction` method.
282 message CallFunctionResponse {
283 // Execution id of function invocation.
284 string execution_id = 1;
286 // Result populated for successful execution of synchronous function. Will
287 // not be populated if function does not return a result through context.
290 // Either system or user-function generated error. Set if execution
291 // was not successful.
295 // Describes the current stage of a deployment.
296 enum CloudFunctionStatus {
297 // Status not specified.
298 STATUS_UNSPECIFIED = 0;
300 // Successfully deployed.
303 // Not deployed correctly - behavior is undefined. The item should be updated
304 // or deleted to move it out of this state.
307 // Creation or update in progress.
310 // Deletion in progress.