functions.proto 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  1. // Copyright 2022 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.functions.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/iam/v1/iam_policy.proto";
  21. import "google/iam/v1/policy.proto";
  22. import "google/longrunning/operations.proto";
  23. import "google/protobuf/duration.proto";
  24. import "google/protobuf/field_mask.proto";
  25. import "google/protobuf/timestamp.proto";
  26. option go_package = "google.golang.org/genproto/googleapis/cloud/functions/v1;functions";
  27. option java_multiple_files = true;
  28. option java_outer_classname = "FunctionsProto";
  29. option java_package = "com.google.cloud.functions.v1";
  30. option objc_class_prefix = "GCF";
  31. option (google.api.resource_definition) = {
  32. type: "artifactregistry.googleapis.com/Repository"
  33. pattern: "projects/{project}/locations/{location}/repositories/{repository}"
  34. };
  35. option (google.api.resource_definition) = {
  36. type: "cloudkms.googleapis.com/CryptoKey"
  37. pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}"
  38. };
  39. // A service that application uses to manipulate triggers and functions.
  40. service CloudFunctionsService {
  41. option (google.api.default_host) = "cloudfunctions.googleapis.com";
  42. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  43. // Returns a list of functions that belong to the requested project.
  44. rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) {
  45. option (google.api.http) = {
  46. get: "/v1/{parent=projects/*/locations/*}/functions"
  47. };
  48. }
  49. // Returns a function with the given name from the requested project.
  50. rpc GetFunction(GetFunctionRequest) returns (CloudFunction) {
  51. option (google.api.http) = {
  52. get: "/v1/{name=projects/*/locations/*/functions/*}"
  53. };
  54. option (google.api.method_signature) = "name";
  55. }
  56. // Creates a new function. If a function with the given name already exists in
  57. // the specified project, the long running operation will return
  58. // `ALREADY_EXISTS` error.
  59. rpc CreateFunction(CreateFunctionRequest) returns (google.longrunning.Operation) {
  60. option (google.api.http) = {
  61. post: "/v1/{location=projects/*/locations/*}/functions"
  62. body: "function"
  63. };
  64. option (google.api.method_signature) = "location,function";
  65. option (google.longrunning.operation_info) = {
  66. response_type: "CloudFunction"
  67. metadata_type: "OperationMetadataV1"
  68. };
  69. }
  70. // Updates existing function.
  71. rpc UpdateFunction(UpdateFunctionRequest) returns (google.longrunning.Operation) {
  72. option (google.api.http) = {
  73. patch: "/v1/{function.name=projects/*/locations/*/functions/*}"
  74. body: "function"
  75. };
  76. option (google.api.method_signature) = "function";
  77. option (google.longrunning.operation_info) = {
  78. response_type: "CloudFunction"
  79. metadata_type: "OperationMetadataV1"
  80. };
  81. }
  82. // Deletes a function with the given name from the specified project. If the
  83. // given function is used by some trigger, the trigger will be updated to
  84. // remove this function.
  85. rpc DeleteFunction(DeleteFunctionRequest) returns (google.longrunning.Operation) {
  86. option (google.api.http) = {
  87. delete: "/v1/{name=projects/*/locations/*/functions/*}"
  88. };
  89. option (google.api.method_signature) = "name";
  90. option (google.longrunning.operation_info) = {
  91. response_type: "google.protobuf.Empty"
  92. metadata_type: "OperationMetadataV1"
  93. };
  94. }
  95. // Synchronously invokes a deployed Cloud Function. To be used for testing
  96. // purposes as very limited traffic is allowed. For more information on
  97. // the actual limits, refer to
  98. // [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits).
  99. rpc CallFunction(CallFunctionRequest) returns (CallFunctionResponse) {
  100. option (google.api.http) = {
  101. post: "/v1/{name=projects/*/locations/*/functions/*}:call"
  102. body: "*"
  103. };
  104. option (google.api.method_signature) = "name,data";
  105. }
  106. // Returns a signed URL for uploading a function source code.
  107. // For more information about the signed URL usage see:
  108. // https://cloud.google.com/storage/docs/access-control/signed-urls.
  109. // Once the function source code upload is complete, the used signed
  110. // URL should be provided in CreateFunction or UpdateFunction request
  111. // as a reference to the function source code.
  112. //
  113. // When uploading source code to the generated signed URL, please follow
  114. // these restrictions:
  115. //
  116. // * Source file type should be a zip file.
  117. // * Source file size should not exceed 100MB limit.
  118. // * No credentials should be attached - the signed URLs provide access to the
  119. // target bucket using internal service identity; if credentials were
  120. // attached, the identity from the credentials would be used, but that
  121. // identity does not have permissions to upload files to the URL.
  122. //
  123. // When making a HTTP PUT request, these two headers need to be specified:
  124. //
  125. // * `content-type: application/zip`
  126. // * `x-goog-content-length-range: 0,104857600`
  127. //
  128. // And this header SHOULD NOT be specified:
  129. //
  130. // * `Authorization: Bearer YOUR_TOKEN`
  131. rpc GenerateUploadUrl(GenerateUploadUrlRequest) returns (GenerateUploadUrlResponse) {
  132. option (google.api.http) = {
  133. post: "/v1/{parent=projects/*/locations/*}/functions:generateUploadUrl"
  134. body: "*"
  135. };
  136. }
  137. // Returns a signed URL for downloading deployed function source code.
  138. // The URL is only valid for a limited period and should be used within
  139. // minutes after generation.
  140. // For more information about the signed URL usage see:
  141. // https://cloud.google.com/storage/docs/access-control/signed-urls
  142. rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) returns (GenerateDownloadUrlResponse) {
  143. option (google.api.http) = {
  144. post: "/v1/{name=projects/*/locations/*/functions/*}:generateDownloadUrl"
  145. body: "*"
  146. };
  147. }
  148. // Sets the IAM access control policy on the specified function.
  149. // Replaces any existing policy.
  150. rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) {
  151. option (google.api.http) = {
  152. post: "/v1/{resource=projects/*/locations/*/functions/*}:setIamPolicy"
  153. body: "*"
  154. };
  155. }
  156. // Gets the IAM access control policy for a function.
  157. // Returns an empty policy if the function exists and does not have a policy
  158. // set.
  159. rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) {
  160. option (google.api.http) = {
  161. get: "/v1/{resource=projects/*/locations/*/functions/*}:getIamPolicy"
  162. };
  163. }
  164. // Tests the specified permissions against the IAM access control policy
  165. // for a function.
  166. // If the function does not exist, this will return an empty set of
  167. // permissions, not a NOT_FOUND error.
  168. rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) {
  169. option (google.api.http) = {
  170. post: "/v1/{resource=projects/*/locations/*/functions/*}:testIamPermissions"
  171. body: "*"
  172. };
  173. }
  174. }
  175. // Describes a Cloud Function that contains user computation executed in
  176. // response to an event. It encapsulate function and triggers configurations.
  177. message CloudFunction {
  178. option (google.api.resource) = {
  179. type: "cloudfunctions.googleapis.com/CloudFunction"
  180. pattern: "projects/{project}/locations/{location}/functions/{function}"
  181. };
  182. // Available egress settings.
  183. //
  184. // This controls what traffic is diverted through the VPC Access Connector
  185. // resource. By default PRIVATE_RANGES_ONLY will be used.
  186. enum VpcConnectorEgressSettings {
  187. // Unspecified.
  188. VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0;
  189. // Use the VPC Access Connector only for private IP space from RFC1918.
  190. PRIVATE_RANGES_ONLY = 1;
  191. // Force the use of VPC Access Connector for all egress traffic from the
  192. // function.
  193. ALL_TRAFFIC = 2;
  194. }
  195. // Available ingress settings.
  196. //
  197. // This controls what traffic can reach the function.
  198. //
  199. // If unspecified, ALLOW_ALL will be used.
  200. enum IngressSettings {
  201. // Unspecified.
  202. INGRESS_SETTINGS_UNSPECIFIED = 0;
  203. // Allow HTTP traffic from public and private sources.
  204. ALLOW_ALL = 1;
  205. // Allow HTTP traffic from only private VPC sources.
  206. ALLOW_INTERNAL_ONLY = 2;
  207. // Allow HTTP traffic from private VPC sources and through GCLB.
  208. ALLOW_INTERNAL_AND_GCLB = 3;
  209. }
  210. // Docker Registry to use for storing function Docker images.
  211. enum DockerRegistry {
  212. // Unspecified.
  213. DOCKER_REGISTRY_UNSPECIFIED = 0;
  214. // Docker images will be stored in multi-regional Container Registry
  215. // repositories named `gcf`.
  216. CONTAINER_REGISTRY = 1;
  217. // Docker images will be stored in regional Artifact Registry repositories.
  218. // By default, GCF will create and use repositories named `gcf-artifacts`
  219. // in every region in which a function is deployed. But the repository to
  220. // use can also be specified by the user using the `docker_repository`
  221. // field.
  222. ARTIFACT_REGISTRY = 2;
  223. }
  224. // A user-defined name of the function. Function names must be unique
  225. // globally and match pattern `projects/*/locations/*/functions/*`
  226. string name = 1;
  227. // User-provided description of a function.
  228. string description = 2;
  229. // The location of the function source code.
  230. oneof source_code {
  231. // The Google Cloud Storage URL, starting with `gs://`, pointing to the zip
  232. // archive which contains the function.
  233. string source_archive_url = 3;
  234. // **Beta Feature**
  235. //
  236. // The source repository where a function is hosted.
  237. SourceRepository source_repository = 4;
  238. // The Google Cloud Storage signed URL used for source uploading, generated
  239. // by calling [google.cloud.functions.v1.GenerateUploadUrl].
  240. //
  241. // The signature is validated on write methods (Create, Update)
  242. // The signature is stripped from the Function object on read methods (Get,
  243. // List)
  244. string source_upload_url = 16;
  245. }
  246. // An event that triggers the function.
  247. oneof trigger {
  248. // An HTTPS endpoint type of source that can be triggered via URL.
  249. HttpsTrigger https_trigger = 5;
  250. // A source that fires events in response to a condition in another service.
  251. EventTrigger event_trigger = 6;
  252. }
  253. // Output only. Status of the function deployment.
  254. CloudFunctionStatus status = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  255. // The name of the function (as defined in source code) that will be
  256. // executed. Defaults to the resource name suffix, if not specified. For
  257. // backward compatibility, if function with given name is not found, then the
  258. // system will try to use function named "function".
  259. // For Node.js this is name of a function exported by the module specified
  260. // in `source_location`.
  261. string entry_point = 8;
  262. // The runtime in which to run the function. Required when deploying a new
  263. // function, optional when updating an existing function. For a complete
  264. // list of possible choices, see the
  265. // [`gcloud` command
  266. // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime).
  267. string runtime = 19;
  268. // The function execution timeout. Execution is considered failed and
  269. // can be terminated if the function is not completed at the end of the
  270. // timeout period. Defaults to 60 seconds.
  271. google.protobuf.Duration timeout = 9;
  272. // The amount of memory in MB available for a function.
  273. // Defaults to 256MB.
  274. int32 available_memory_mb = 10;
  275. // The email of the function's service account. If empty, defaults to
  276. // `{project_id}@appspot.gserviceaccount.com`.
  277. string service_account_email = 11;
  278. // Output only. The last update timestamp of a Cloud Function.
  279. google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
  280. // Output only. The version identifier of the Cloud Function. Each deployment attempt
  281. // results in a new version of a function being created.
  282. int64 version_id = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
  283. // Labels associated with this Cloud Function.
  284. map<string, string> labels = 15;
  285. // Environment variables that shall be available during function execution.
  286. map<string, string> environment_variables = 17;
  287. // Build environment variables that shall be available during build time.
  288. map<string, string> build_environment_variables = 28;
  289. // The VPC Network that this cloud function can connect to. It can be
  290. // either the fully-qualified URI, or the short name of the network resource.
  291. // If the short network name is used, the network must belong to the same
  292. // project. Otherwise, it must belong to a project within the same
  293. // organization. The format of this field is either
  294. // `projects/{project}/global/networks/{network}` or `{network}`, where
  295. // `{project}` is a project id where the network is defined, and `{network}`
  296. // is the short name of the network.
  297. //
  298. // This field is mutually exclusive with `vpc_connector` and will be replaced
  299. // by it.
  300. //
  301. // See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for
  302. // more information on connecting Cloud projects.
  303. string network = 18;
  304. // The limit on the maximum number of function instances that may coexist at a
  305. // given time.
  306. //
  307. // In some cases, such as rapid traffic surges, Cloud Functions may, for a
  308. // short period of time, create more instances than the specified max
  309. // instances limit. If your function cannot tolerate this temporary behavior,
  310. // you may want to factor in a safety margin and set a lower max instances
  311. // value than your function can tolerate.
  312. //
  313. // See the [Max
  314. // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for
  315. // more details.
  316. int32 max_instances = 20;
  317. // A lower bound for the number function instances that may coexist at a
  318. // given time.
  319. int32 min_instances = 32;
  320. // The VPC Network Connector that this cloud function can connect to. It can
  321. // be either the fully-qualified URI, or the short name of the network
  322. // connector resource. The format of this field is
  323. // `projects/*/locations/*/connectors/*`
  324. //
  325. // This field is mutually exclusive with `network` field and will eventually
  326. // replace it.
  327. //
  328. // See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for
  329. // more information on connecting Cloud projects.
  330. string vpc_connector = 22;
  331. // The egress settings for the connector, controlling what traffic is diverted
  332. // through it.
  333. VpcConnectorEgressSettings vpc_connector_egress_settings = 23;
  334. // The ingress settings for the function, controlling what traffic can reach
  335. // it.
  336. IngressSettings ingress_settings = 24;
  337. // Resource name of a KMS crypto key (managed by the user) used to
  338. // encrypt/decrypt function resources.
  339. //
  340. // It must match the pattern
  341. // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
  342. //
  343. // If specified, you must also provide an artifact registry repository using
  344. // the `docker_repository` field that was created with the same KMS crypto
  345. // key.
  346. //
  347. // The following service accounts need to be granted the role 'Cloud KMS
  348. // CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)'
  349. // on the Key/KeyRing/Project/Organization (least access preferred).
  350. //
  351. // 1. Google Cloud Functions service account
  352. // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) -
  353. // Required to protect the function's image.
  354. // 2. Google Storage service account
  355. // (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) -
  356. // Required to protect the function's source code.
  357. // If this service account does not exist, deploying a function without a
  358. // KMS key or retrieving the service agent name provisions it. For more
  359. // information, see
  360. // https://cloud.google.com/storage/docs/projects#service-agents and
  361. // https://cloud.google.com/storage/docs/getting-service-agent#gsutil.
  362. //
  363. // Google Cloud Functions delegates access to service agents to protect
  364. // function resources in internal projects that are not accessible by the
  365. // end user.
  366. string kms_key_name = 25 [(google.api.resource_reference) = {
  367. type: "cloudkms.googleapis.com/CryptoKey"
  368. }];
  369. // Name of the Cloud Build Custom Worker Pool that should be used to build the
  370. // function. The format of this field is
  371. // `projects/{project}/locations/{region}/workerPools/{workerPool}` where
  372. // `{project}` and `{region}` are the project id and region respectively where
  373. // the worker pool is defined and `{workerPool}` is the short name of the
  374. // worker pool.
  375. //
  376. // If the project id is not the same as the function, then the Cloud
  377. // Functions Service Agent
  378. // (`service-<project_number>@gcf-admin-robot.iam.gserviceaccount.com`) must
  379. // be granted the role Cloud Build Custom Workers Builder
  380. // (`roles/cloudbuild.customworkers.builder`) in the project.
  381. string build_worker_pool = 26;
  382. // Output only. The Cloud Build ID of the latest successful deployment of the
  383. // function.
  384. string build_id = 27 [(google.api.field_behavior) = OUTPUT_ONLY];
  385. // Output only. The Cloud Build Name of the function deployment.
  386. // `projects/<project-number>/locations/<region>/builds/<build-id>`.
  387. string build_name = 33 [(google.api.field_behavior) = OUTPUT_ONLY];
  388. // Secret environment variables configuration.
  389. repeated SecretEnvVar secret_environment_variables = 29;
  390. // Secret volumes configuration.
  391. repeated SecretVolume secret_volumes = 30;
  392. // Input only. An identifier for Firebase function sources. Disclaimer: This field is only
  393. // supported for Firebase function deployments.
  394. string source_token = 31 [(google.api.field_behavior) = INPUT_ONLY];
  395. // User managed repository created in Artifact Registry optionally with a
  396. // customer managed encryption key. If specified, deployments will use
  397. // Artifact Registry. If unspecified and the deployment is eligible to use
  398. // Artifact Registry, GCF will create and use a repository named
  399. // 'gcf-artifacts' for every deployed region. This is the repository to which
  400. // the function docker image will be pushed after it is built by Cloud Build.
  401. //
  402. // It must match the pattern
  403. // `projects/{project}/locations/{location}/repositories/{repository}`.
  404. //
  405. // Cross-project repositories are not supported.
  406. // Cross-location repositories are not supported.
  407. // Repository format must be 'DOCKER'.
  408. string docker_repository = 34 [(google.api.resource_reference) = {
  409. type: "artifactregistry.googleapis.com/Repository"
  410. }];
  411. // Docker Registry to use for this deployment.
  412. //
  413. // If `docker_repository` field is specified, this field will be automatically
  414. // set as `ARTIFACT_REGISTRY`.
  415. // If unspecified, it currently defaults to `CONTAINER_REGISTRY`.
  416. // This field may be overridden by the backend for eligible deployments.
  417. DockerRegistry docker_registry = 35;
  418. }
  419. // Describes SourceRepository, used to represent parameters related to
  420. // source repository where a function is hosted.
  421. message SourceRepository {
  422. // The URL pointing to the hosted repository where the function is defined.
  423. // There are supported Cloud Source Repository URLs in the following
  424. // formats:
  425. //
  426. // To refer to a specific commit:
  427. // `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*`
  428. // To refer to a moveable alias (branch):
  429. // `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*`
  430. // In particular, to refer to HEAD use `master` moveable alias.
  431. // To refer to a specific fixed alias (tag):
  432. // `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*`
  433. //
  434. // You may omit `paths/*` if you want to use the main directory.
  435. string url = 1;
  436. // Output only. The URL pointing to the hosted repository where the function
  437. // were defined at the time of deployment. It always points to a specific
  438. // commit in the format described above.
  439. string deployed_url = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  440. }
  441. // Describes HttpsTrigger, could be used to connect web hooks to function.
  442. message HttpsTrigger {
  443. // Available security level settings.
  444. //
  445. // This controls the methods to enforce security (HTTPS) on a URL.
  446. //
  447. // If unspecified, SECURE_OPTIONAL will be used.
  448. enum SecurityLevel {
  449. // Unspecified.
  450. SECURITY_LEVEL_UNSPECIFIED = 0;
  451. // Requests for a URL that match this handler that do not use HTTPS are
  452. // automatically redirected to the HTTPS URL with the same path. Query
  453. // parameters are reserved for the redirect.
  454. SECURE_ALWAYS = 1;
  455. // Both HTTP and HTTPS requests with URLs that match the handler succeed
  456. // without redirects. The application can examine the request to determine
  457. // which protocol was used and respond accordingly.
  458. SECURE_OPTIONAL = 2;
  459. }
  460. // Output only. The deployed url for the function.
  461. string url = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  462. // The security level for the function.
  463. SecurityLevel security_level = 2;
  464. }
  465. // Describes EventTrigger, used to request events be sent from another
  466. // service.
  467. message EventTrigger {
  468. // Required. The type of event to observe. For example:
  469. // `providers/cloud.storage/eventTypes/object.change` and
  470. // `providers/cloud.pubsub/eventTypes/topic.publish`.
  471. //
  472. // Event types match pattern `providers/*/eventTypes/*.*`.
  473. // The pattern contains:
  474. //
  475. // 1. namespace: For example, `cloud.storage` and
  476. // `google.firebase.analytics`.
  477. // 2. resource type: The type of resource on which event occurs. For
  478. // example, the Google Cloud Storage API includes the type `object`.
  479. // 3. action: The action that generates the event. For example, action for
  480. // a Google Cloud Storage Object is 'change'.
  481. // These parts are lower case.
  482. string event_type = 1;
  483. // Required. The resource(s) from which to observe events, for example,
  484. // `projects/_/buckets/myBucket`.
  485. //
  486. // Not all syntactically correct values are accepted by all services. For
  487. // example:
  488. //
  489. // 1. The authorization model must support it. Google Cloud Functions
  490. // only allows EventTriggers to be deployed that observe resources in the
  491. // same project as the `CloudFunction`.
  492. // 2. The resource type must match the pattern expected for an
  493. // `event_type`. For example, an `EventTrigger` that has an
  494. // `event_type` of "google.pubsub.topic.publish" should have a resource
  495. // that matches Google Cloud Pub/Sub topics.
  496. //
  497. // Additionally, some services may support short names when creating an
  498. // `EventTrigger`. These will always be returned in the normalized "long"
  499. // format.
  500. //
  501. // See each *service's* documentation for supported formats.
  502. string resource = 2;
  503. // The hostname of the service that should be observed.
  504. //
  505. // If no string is provided, the default service implementing the API will
  506. // be used. For example, `storage.googleapis.com` is the default for all
  507. // event types in the `google.storage` namespace.
  508. string service = 3;
  509. // Specifies policy for failed executions.
  510. FailurePolicy failure_policy = 5;
  511. }
  512. // Describes the policy in case of function's execution failure.
  513. // If empty, then defaults to ignoring failures (i.e. not retrying them).
  514. message FailurePolicy {
  515. // Describes the retry policy in case of function's execution failure.
  516. // A function execution will be retried on any failure.
  517. // A failed execution will be retried up to 7 days with an exponential backoff
  518. // (capped at 10 seconds).
  519. // Retried execution is charged as any other execution.
  520. message Retry {
  521. }
  522. // Defines the action taken in case of a function execution failure.
  523. oneof action {
  524. // If specified, then the function will be retried in case of a failure.
  525. Retry retry = 1;
  526. }
  527. }
  528. // Describes the current stage of a deployment.
  529. enum CloudFunctionStatus {
  530. // Not specified. Invalid state.
  531. CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0;
  532. // Function has been successfully deployed and is serving.
  533. ACTIVE = 1;
  534. // Function deployment failed and the function isn’t serving.
  535. OFFLINE = 2;
  536. // Function is being created or updated.
  537. DEPLOY_IN_PROGRESS = 3;
  538. // Function is being deleted.
  539. DELETE_IN_PROGRESS = 4;
  540. // Function deployment failed and the function serving state is undefined.
  541. // The function should be updated or deleted to move it out of this state.
  542. UNKNOWN = 5;
  543. }
  544. // Configuration for a secret environment variable. It has the information
  545. // necessary to fetch the secret value from secret manager and expose it as an
  546. // environment variable.
  547. message SecretEnvVar {
  548. // Name of the environment variable.
  549. string key = 1;
  550. // Project identifier (preferrably project number but can also be the project
  551. // ID) of the project that contains the secret. If not set, it will be
  552. // populated with the function's project assuming that the secret exists in
  553. // the same project as of the function.
  554. string project_id = 2;
  555. // Name of the secret in secret manager (not the full resource name).
  556. string secret = 3;
  557. // Version of the secret (version number or the string 'latest'). It is
  558. // recommended to use a numeric version for secret environment variables as
  559. // any updates to the secret value is not reflected until new instances start.
  560. string version = 4;
  561. }
  562. // Configuration for a secret volume. It has the information necessary to fetch
  563. // the secret value from secret manager and make it available as files mounted
  564. // at the requested paths within the application container. Secret value is not
  565. // a part of the configuration. Every filesystem read operation performs a
  566. // lookup in secret manager to retrieve the secret value.
  567. message SecretVolume {
  568. // Configuration for a single version.
  569. message SecretVersion {
  570. // Version of the secret (version number or the string 'latest'). It is
  571. // preferrable to use `latest` version with secret volumes as secret value
  572. // changes are reflected immediately.
  573. string version = 1;
  574. // Relative path of the file under the mount path where the secret value for
  575. // this version will be fetched and made available. For example, setting the
  576. // mount_path as '/etc/secrets' and path as `/secret_foo` would mount the
  577. // secret value file at `/etc/secrets/secret_foo`.
  578. string path = 2;
  579. }
  580. // The path within the container to mount the secret volume. For example,
  581. // setting the mount_path as `/etc/secrets` would mount the secret value files
  582. // under the `/etc/secrets` directory. This directory will also be completely
  583. // shadowed and unavailable to mount any other secrets.
  584. //
  585. // Recommended mount paths: /etc/secrets
  586. // Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log
  587. string mount_path = 1;
  588. // Project identifier (preferrably project number but can also be the project
  589. // ID) of the project that contains the secret. If not set, it will be
  590. // populated with the function's project assuming that the secret exists in
  591. // the same project as of the function.
  592. string project_id = 2;
  593. // Name of the secret in secret manager (not the full resource name).
  594. string secret = 3;
  595. // List of secret versions to mount for this secret. If empty, the `latest`
  596. // version of the secret will be made available in a file named after the
  597. // secret under the mount point.
  598. repeated SecretVersion versions = 4;
  599. }
  600. // Request for the `CreateFunction` method.
  601. message CreateFunctionRequest {
  602. // Required. The project and location in which the function should be created, specified
  603. // in the format `projects/*/locations/*`
  604. string location = 1 [
  605. (google.api.field_behavior) = REQUIRED,
  606. (google.api.resource_reference) = {
  607. type: "locations.googleapis.com/Location"
  608. }
  609. ];
  610. // Required. Function to be created.
  611. CloudFunction function = 2 [(google.api.field_behavior) = REQUIRED];
  612. }
  613. // Request for the `UpdateFunction` method.
  614. message UpdateFunctionRequest {
  615. // Required. New version of the function.
  616. CloudFunction function = 1 [(google.api.field_behavior) = REQUIRED];
  617. // Required. The list of fields in `CloudFunction` that have to be updated.
  618. google.protobuf.FieldMask update_mask = 2;
  619. }
  620. // Request for the `GetFunction` method.
  621. message GetFunctionRequest {
  622. // Required. The name of the function which details should be obtained.
  623. string name = 1 [
  624. (google.api.field_behavior) = REQUIRED,
  625. (google.api.resource_reference) = {
  626. type: "cloudfunctions.googleapis.com/CloudFunction"
  627. }
  628. ];
  629. }
  630. // Request for the `ListFunctions` method.
  631. message ListFunctionsRequest {
  632. // The project and location from which the function should be listed,
  633. // specified in the format `projects/*/locations/*`
  634. // If you want to list functions in all locations, use "-" in place of a
  635. // location. When listing functions in all locations, if one or more
  636. // location(s) are unreachable, the response will contain functions from all
  637. // reachable locations along with the names of any unreachable locations.
  638. string parent = 1 [(google.api.resource_reference) = {
  639. type: "locations.googleapis.com/Location"
  640. }];
  641. // Maximum number of functions to return per call.
  642. int32 page_size = 2;
  643. // The value returned by the last
  644. // `ListFunctionsResponse`; indicates that
  645. // this is a continuation of a prior `ListFunctions` call, and that the
  646. // system should return the next page of data.
  647. string page_token = 3;
  648. }
  649. // Response for the `ListFunctions` method.
  650. message ListFunctionsResponse {
  651. // The functions that match the request.
  652. repeated CloudFunction functions = 1;
  653. // If not empty, indicates that there may be more functions that match
  654. // the request; this value should be passed in a new
  655. // [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest]
  656. // to get more functions.
  657. string next_page_token = 2;
  658. // Locations that could not be reached. The response does not include any
  659. // functions from these locations.
  660. repeated string unreachable = 3;
  661. }
  662. // Request for the `DeleteFunction` method.
  663. message DeleteFunctionRequest {
  664. // Required. The name of the function which should be deleted.
  665. string name = 1 [
  666. (google.api.field_behavior) = REQUIRED,
  667. (google.api.resource_reference) = {
  668. type: "cloudfunctions.googleapis.com/CloudFunction"
  669. }
  670. ];
  671. }
  672. // Request for the `CallFunction` method.
  673. message CallFunctionRequest {
  674. // Required. The name of the function to be called.
  675. string name = 1 [
  676. (google.api.field_behavior) = REQUIRED,
  677. (google.api.resource_reference) = {
  678. type: "cloudfunctions.googleapis.com/CloudFunction"
  679. }
  680. ];
  681. // Required. Input to be passed to the function.
  682. string data = 2 [(google.api.field_behavior) = REQUIRED];
  683. }
  684. // Response of `CallFunction` method.
  685. message CallFunctionResponse {
  686. // Execution id of function invocation.
  687. string execution_id = 1;
  688. // Result populated for successful execution of synchronous function. Will
  689. // not be populated if function does not return a result through context.
  690. string result = 2;
  691. // Either system or user-function generated error. Set if execution
  692. // was not successful.
  693. string error = 3;
  694. }
  695. // Request of `GenerateSourceUploadUrl` method.
  696. message GenerateUploadUrlRequest {
  697. // The project and location in which the Google Cloud Storage signed URL
  698. // should be generated, specified in the format `projects/*/locations/*`.
  699. string parent = 1;
  700. // Resource name of a KMS crypto key (managed by the user) used to
  701. // encrypt/decrypt function source code objects in staging Cloud Storage
  702. // buckets. When you generate an upload url and upload your source code, it
  703. // gets copied to a staging Cloud Storage bucket in an internal regional
  704. // project. The source code is then copied to a versioned directory in the
  705. // sources bucket in the consumer project during the function deployment.
  706. //
  707. // It must match the pattern
  708. // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
  709. //
  710. // The Google Cloud Functions service account
  711. // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be
  712. // granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter
  713. // (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the
  714. // Key/KeyRing/Project/Organization (least access preferred). GCF will
  715. // delegate access to the Google Storage service account in the internal
  716. // project.
  717. string kms_key_name = 2 [(google.api.resource_reference) = {
  718. type: "cloudkms.googleapis.com/CryptoKey"
  719. }];
  720. }
  721. // Response of `GenerateSourceUploadUrl` method.
  722. message GenerateUploadUrlResponse {
  723. // The generated Google Cloud Storage signed URL that should be used for a
  724. // function source code upload. The uploaded file should be a zip archive
  725. // which contains a function.
  726. string upload_url = 1;
  727. }
  728. // Request of `GenerateDownloadUrl` method.
  729. message GenerateDownloadUrlRequest {
  730. // The name of function for which source code Google Cloud Storage signed
  731. // URL should be generated.
  732. string name = 1;
  733. // The optional version of function. If not set, default, current version
  734. // is used.
  735. uint64 version_id = 2;
  736. }
  737. // Response of `GenerateDownloadUrl` method.
  738. message GenerateDownloadUrlResponse {
  739. // The generated Google Cloud Storage signed URL that should be used for
  740. // function source code download.
  741. string download_url = 1;
  742. }