functions.proto 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037
  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.v2;
  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/longrunning/operations.proto";
  21. import "google/protobuf/any.proto";
  22. import "google/protobuf/field_mask.proto";
  23. import "google/protobuf/timestamp.proto";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/functions/v2;functions";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "FunctionsProto";
  27. option java_package = "com.google.cloud.functions.v2";
  28. option objc_class_prefix = "GCF";
  29. option (google.api.resource_definition) = {
  30. type: "artifactregistry.googleapis.com/Repository"
  31. pattern: "projects/{project}/locations/{location}/repositories/{repository}"
  32. };
  33. option (google.api.resource_definition) = {
  34. type: "cloudbuild.googleapis.com/Build"
  35. pattern: "projects/{project}/locations/{location}/builds/{build}"
  36. };
  37. option (google.api.resource_definition) = {
  38. type: "cloudbuild.googleapis.com/WorkerPool"
  39. pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}"
  40. };
  41. option (google.api.resource_definition) = {
  42. type: "run.googleapis.com/Service"
  43. pattern: "projects/{project}/locations/{location}/services/{service}"
  44. };
  45. option (google.api.resource_definition) = {
  46. type: "vpcaccess.googleapis.com/Connector"
  47. pattern: "projects/{project}/locations/{location}/connectors/{connector}"
  48. };
  49. option (google.api.resource_definition) = {
  50. type: "eventarc.googleapis.com/Trigger"
  51. pattern: "projects/{project}/locations/{location}/triggers/{trigger}"
  52. };
  53. option (google.api.resource_definition) = {
  54. type: "eventarc.googleapis.com/Channel"
  55. pattern: "projects/{project}/locations/{location}/channels/{channel}"
  56. };
  57. option (google.api.resource_definition) = {
  58. type: "pubsub.googleapis.com/Topic"
  59. pattern: "projects/{project}/topics/{topic}"
  60. };
  61. option (google.api.resource_definition) = {
  62. type: "cloudkms.googleapis.com/CryptoKey"
  63. pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}"
  64. };
  65. // Google Cloud Functions is used to deploy functions that are executed by
  66. // Google in response to various events. Data connected with that event is
  67. // passed to a function as the input data.
  68. //
  69. // A **function** is a resource which describes a function that should be
  70. // executed and how it is triggered.
  71. service FunctionService {
  72. option (google.api.default_host) = "cloudfunctions.googleapis.com";
  73. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  74. // Returns a function with the given name from the requested project.
  75. rpc GetFunction(GetFunctionRequest) returns (Function) {
  76. option (google.api.http) = {
  77. get: "/v2/{name=projects/*/locations/*/functions/*}"
  78. };
  79. option (google.api.method_signature) = "name";
  80. }
  81. // Returns a list of functions that belong to the requested project.
  82. rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) {
  83. option (google.api.http) = {
  84. get: "/v2/{parent=projects/*/locations/*}/functions"
  85. };
  86. option (google.api.method_signature) = "parent";
  87. }
  88. // Creates a new function. If a function with the given name already exists in
  89. // the specified project, the long running operation will return
  90. // `ALREADY_EXISTS` error.
  91. rpc CreateFunction(CreateFunctionRequest) returns (google.longrunning.Operation) {
  92. option (google.api.http) = {
  93. post: "/v2/{parent=projects/*/locations/*}/functions"
  94. body: "function"
  95. };
  96. option (google.api.method_signature) = "parent,function,function_id";
  97. option (google.longrunning.operation_info) = {
  98. response_type: "google.cloud.functions.v2.Function"
  99. metadata_type: "google.cloud.functions.v2.OperationMetadata"
  100. };
  101. }
  102. // Updates existing function.
  103. rpc UpdateFunction(UpdateFunctionRequest) returns (google.longrunning.Operation) {
  104. option (google.api.http) = {
  105. patch: "/v2/{function.name=projects/*/locations/*/functions/*}"
  106. body: "function"
  107. };
  108. option (google.api.method_signature) = "function,update_mask";
  109. option (google.longrunning.operation_info) = {
  110. response_type: "google.cloud.functions.v2.Function"
  111. metadata_type: "google.cloud.functions.v2.OperationMetadata"
  112. };
  113. }
  114. // Deletes a function with the given name from the specified project. If the
  115. // given function is used by some trigger, the trigger will be updated to
  116. // remove this function.
  117. rpc DeleteFunction(DeleteFunctionRequest) returns (google.longrunning.Operation) {
  118. option (google.api.http) = {
  119. delete: "/v2/{name=projects/*/locations/*/functions/*}"
  120. };
  121. option (google.api.method_signature) = "name";
  122. option (google.longrunning.operation_info) = {
  123. response_type: "google.protobuf.Empty"
  124. metadata_type: "google.cloud.functions.v2.OperationMetadata"
  125. };
  126. }
  127. // Returns a signed URL for uploading a function source code.
  128. // For more information about the signed URL usage see:
  129. // https://cloud.google.com/storage/docs/access-control/signed-urls.
  130. // Once the function source code upload is complete, the used signed
  131. // URL should be provided in CreateFunction or UpdateFunction request
  132. // as a reference to the function source code.
  133. //
  134. // When uploading source code to the generated signed URL, please follow
  135. // these restrictions:
  136. //
  137. // * Source file type should be a zip file.
  138. // * No credentials should be attached - the signed URLs provide access to the
  139. // target bucket using internal service identity; if credentials were
  140. // attached, the identity from the credentials would be used, but that
  141. // identity does not have permissions to upload files to the URL.
  142. //
  143. // When making a HTTP PUT request, these two headers need to be specified:
  144. //
  145. // * `content-type: application/zip`
  146. //
  147. // And this header SHOULD NOT be specified:
  148. //
  149. // * `Authorization: Bearer YOUR_TOKEN`
  150. rpc GenerateUploadUrl(GenerateUploadUrlRequest) returns (GenerateUploadUrlResponse) {
  151. option (google.api.http) = {
  152. post: "/v2/{parent=projects/*/locations/*}/functions:generateUploadUrl"
  153. body: "*"
  154. };
  155. }
  156. // Returns a signed URL for downloading deployed function source code.
  157. // The URL is only valid for a limited period and should be used within
  158. // 30 minutes of generation.
  159. // For more information about the signed URL usage see:
  160. // https://cloud.google.com/storage/docs/access-control/signed-urls
  161. rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) returns (GenerateDownloadUrlResponse) {
  162. option (google.api.http) = {
  163. post: "/v2/{name=projects/*/locations/*/functions/*}:generateDownloadUrl"
  164. body: "*"
  165. };
  166. }
  167. // Returns a list of runtimes that are supported for the requested project.
  168. rpc ListRuntimes(ListRuntimesRequest) returns (ListRuntimesResponse) {
  169. option (google.api.http) = {
  170. get: "/v2/{parent=projects/*/locations/*}/runtimes"
  171. };
  172. option (google.api.method_signature) = "parent";
  173. }
  174. }
  175. // The environment the function is hosted on.
  176. enum Environment {
  177. // Unspecified
  178. ENVIRONMENT_UNSPECIFIED = 0;
  179. // Gen 1
  180. GEN_1 = 1;
  181. // Gen 2
  182. GEN_2 = 2;
  183. }
  184. // Describes a Cloud Function that contains user computation executed in
  185. // response to an event. It encapsulates function and trigger configurations.
  186. message Function {
  187. option (google.api.resource) = {
  188. type: "cloudfunctions.googleapis.com/Function"
  189. pattern: "projects/{project}/locations/{location}/functions/{function}"
  190. plural: "functions"
  191. singular: "function"
  192. };
  193. // Describes the current state of the function.
  194. enum State {
  195. // Not specified. Invalid state.
  196. STATE_UNSPECIFIED = 0;
  197. // Function has been successfully deployed and is serving.
  198. ACTIVE = 1;
  199. // Function deployment failed and the function is not serving.
  200. FAILED = 2;
  201. // Function is being created or updated.
  202. DEPLOYING = 3;
  203. // Function is being deleted.
  204. DELETING = 4;
  205. // Function deployment failed and the function serving state is undefined.
  206. // The function should be updated or deleted to move it out of this state.
  207. UNKNOWN = 5;
  208. }
  209. // A user-defined name of the function. Function names must be unique
  210. // globally and match pattern `projects/*/locations/*/functions/*`
  211. string name = 1;
  212. // Describe whether the function is gen1 or gen2.
  213. Environment environment = 10;
  214. // User-provided description of a function.
  215. string description = 2;
  216. // Describes the Build step of the function that builds a container from the
  217. // given source.
  218. BuildConfig build_config = 3;
  219. // Describes the Service being deployed. Currently deploys services to Cloud
  220. // Run (fully managed).
  221. ServiceConfig service_config = 4;
  222. // An Eventarc trigger managed by Google Cloud Functions that fires events in
  223. // response to a condition in another service.
  224. EventTrigger event_trigger = 5;
  225. // Output only. State of the function.
  226. State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  227. // Output only. The last update timestamp of a Cloud Function.
  228. google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  229. // Labels associated with this Cloud Function.
  230. map<string, string> labels = 8;
  231. // Output only. State Messages for this Cloud Function.
  232. repeated StateMessage state_messages = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
  233. }
  234. // Informational messages about the state of the Cloud Function or Operation.
  235. message StateMessage {
  236. // Severity of the state message.
  237. enum Severity {
  238. // Not specified. Invalid severity.
  239. SEVERITY_UNSPECIFIED = 0;
  240. // ERROR-level severity.
  241. ERROR = 1;
  242. // WARNING-level severity.
  243. WARNING = 2;
  244. // INFO-level severity.
  245. INFO = 3;
  246. }
  247. // Severity of the state message.
  248. Severity severity = 1;
  249. // One-word CamelCase type of the state message.
  250. string type = 2;
  251. // The message.
  252. string message = 3;
  253. }
  254. // Location of the source in an archive file in Google Cloud Storage.
  255. message StorageSource {
  256. // Google Cloud Storage bucket containing the source (see
  257. // [Bucket Name
  258. // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
  259. string bucket = 1;
  260. // Google Cloud Storage object containing the source.
  261. //
  262. // This object must be a gzipped archive file (`.tar.gz`) containing source to
  263. // build.
  264. string object = 2;
  265. // Google Cloud Storage generation for the object. If the generation is
  266. // omitted, the latest generation will be used.
  267. int64 generation = 3;
  268. }
  269. // Location of the source in a Google Cloud Source Repository.
  270. message RepoSource {
  271. // A revision within the Cloud Source Repository must be specified in
  272. // one of these ways.
  273. oneof revision {
  274. // Regex matching branches to build.
  275. //
  276. // The syntax of the regular expressions accepted is the syntax accepted by
  277. // RE2 and described at https://github.com/google/re2/wiki/Syntax
  278. string branch_name = 3;
  279. // Regex matching tags to build.
  280. //
  281. // The syntax of the regular expressions accepted is the syntax accepted by
  282. // RE2 and described at https://github.com/google/re2/wiki/Syntax
  283. string tag_name = 4;
  284. // Explicit commit SHA to build.
  285. string commit_sha = 5;
  286. }
  287. // ID of the project that owns the Cloud Source Repository. If omitted, the
  288. // project ID requesting the build is assumed.
  289. string project_id = 1;
  290. // Name of the Cloud Source Repository.
  291. string repo_name = 2;
  292. // Directory, relative to the source root, in which to run the build.
  293. //
  294. // This must be a relative path. If a step's `dir` is specified and is an
  295. // absolute path, this value is ignored for that step's execution.
  296. // eg. helloworld (no leading slash allowed)
  297. string dir = 6;
  298. // Only trigger a build if the revision regex does NOT match the revision
  299. // regex.
  300. bool invert_regex = 7;
  301. }
  302. // The location of the function source code.
  303. message Source {
  304. // Location of the source.
  305. // At least one source needs to be provided for the deployment to succeed.
  306. oneof source {
  307. // If provided, get the source from this location in Google Cloud Storage.
  308. StorageSource storage_source = 1;
  309. // If provided, get the source from this location in a Cloud Source
  310. // Repository.
  311. RepoSource repo_source = 2;
  312. }
  313. }
  314. // Provenance of the source. Ways to find the original source, or verify that
  315. // some source was used for this build.
  316. message SourceProvenance {
  317. // A copy of the build's `source.storage_source`, if exists, with any
  318. // generations resolved.
  319. StorageSource resolved_storage_source = 1;
  320. // A copy of the build's `source.repo_source`, if exists, with any
  321. // revisions resolved.
  322. RepoSource resolved_repo_source = 2;
  323. }
  324. // Describes the Build step of the function that builds a container from the
  325. // given source.
  326. message BuildConfig {
  327. // Output only. The Cloud Build name of the latest successful deployment of the
  328. // function.
  329. string build = 1 [
  330. (google.api.field_behavior) = OUTPUT_ONLY,
  331. (google.api.resource_reference) = {
  332. type: "cloudbuild.googleapis.com/Build"
  333. }
  334. ];
  335. // The runtime in which to run the function. Required when deploying a new
  336. // function, optional when updating an existing function. For a complete
  337. // list of possible choices, see the
  338. // [`gcloud` command
  339. // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime).
  340. string runtime = 2;
  341. // The name of the function (as defined in source code) that will be
  342. // executed. Defaults to the resource name suffix, if not specified. For
  343. // backward compatibility, if function with given name is not found, then the
  344. // system will try to use function named "function".
  345. // For Node.js this is name of a function exported by the module specified
  346. // in `source_location`.
  347. string entry_point = 3;
  348. // The location of the function source code.
  349. Source source = 4;
  350. // Output only. A permanent fixed identifier for source.
  351. SourceProvenance source_provenance = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
  352. // Name of the Cloud Build Custom Worker Pool that should be used to build the
  353. // function. The format of this field is
  354. // `projects/{project}/locations/{region}/workerPools/{workerPool}` where
  355. // {project} and {region} are the project id and region respectively where the
  356. // worker pool is defined and {workerPool} is the short name of the worker
  357. // pool.
  358. //
  359. // If the project id is not the same as the function, then the Cloud
  360. // Functions Service Agent
  361. // (service-<project_number>@gcf-admin-robot.iam.gserviceaccount.com) must be
  362. // granted the role Cloud Build Custom Workers Builder
  363. // (roles/cloudbuild.customworkers.builder) in the project.
  364. string worker_pool = 5 [(google.api.resource_reference) = {
  365. type: "cloudbuild.googleapis.com/WorkerPool"
  366. }];
  367. // User-provided build-time environment variables for the function
  368. map<string, string> environment_variables = 6;
  369. // Optional. User managed repository created in Artifact Registry optionally with a
  370. // customer managed encryption key. This is the repository to which the
  371. // function docker image will be pushed after it is built by Cloud Build.
  372. // If unspecified, GCF will create and use a repository named 'gcf-artifacts'
  373. // for every deployed region.
  374. //
  375. // It must match the pattern
  376. // `projects/{project}/locations/{location}/repositories/{repository}`.
  377. //
  378. // Cross-project repositories are not supported.
  379. // Cross-location repositories are not supported.
  380. // Repository format must be 'DOCKER'.
  381. string docker_repository = 7 [
  382. (google.api.field_behavior) = OPTIONAL,
  383. (google.api.resource_reference) = {
  384. type: "artifactregistry.googleapis.com/Repository"
  385. }
  386. ];
  387. }
  388. // Describes the Service being deployed.
  389. // Currently Supported : Cloud Run (fully managed).
  390. message ServiceConfig {
  391. // Available egress settings.
  392. //
  393. // This controls what traffic is diverted through the VPC Access Connector
  394. // resource. By default PRIVATE_RANGES_ONLY will be used.
  395. enum VpcConnectorEgressSettings {
  396. // Unspecified.
  397. VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0;
  398. // Use the VPC Access Connector only for private IP space from RFC1918.
  399. PRIVATE_RANGES_ONLY = 1;
  400. // Force the use of VPC Access Connector for all egress traffic from the
  401. // function.
  402. ALL_TRAFFIC = 2;
  403. }
  404. // Available ingress settings.
  405. //
  406. // This controls what traffic can reach the function.
  407. //
  408. // If unspecified, ALLOW_ALL will be used.
  409. enum IngressSettings {
  410. // Unspecified.
  411. INGRESS_SETTINGS_UNSPECIFIED = 0;
  412. // Allow HTTP traffic from public and private sources.
  413. ALLOW_ALL = 1;
  414. // Allow HTTP traffic from only private VPC sources.
  415. ALLOW_INTERNAL_ONLY = 2;
  416. // Allow HTTP traffic from private VPC sources and through GCLB.
  417. ALLOW_INTERNAL_AND_GCLB = 3;
  418. }
  419. // Output only. Name of the service associated with a Function.
  420. // The format of this field is
  421. // `projects/{project}/locations/{region}/services/{service}`
  422. string service = 1 [
  423. (google.api.field_behavior) = OUTPUT_ONLY,
  424. (google.api.resource_reference) = {
  425. type: "run.googleapis.com/Service"
  426. }
  427. ];
  428. // The function execution timeout. Execution is considered failed and
  429. // can be terminated if the function is not completed at the end of the
  430. // timeout period. Defaults to 60 seconds.
  431. int32 timeout_seconds = 2;
  432. // The amount of memory available for a function.
  433. // Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is
  434. // supplied the value is interpreted as bytes.
  435. // See
  436. // https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go
  437. // a full description.
  438. string available_memory = 13;
  439. // Environment variables that shall be available during function execution.
  440. map<string, string> environment_variables = 4;
  441. // The limit on the maximum number of function instances that may coexist at a
  442. // given time.
  443. //
  444. // In some cases, such as rapid traffic surges, Cloud Functions may, for a
  445. // short period of time, create more instances than the specified max
  446. // instances limit. If your function cannot tolerate this temporary behavior,
  447. // you may want to factor in a safety margin and set a lower max instances
  448. // value than your function can tolerate.
  449. //
  450. // See the [Max
  451. // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for
  452. // more details.
  453. int32 max_instance_count = 5;
  454. // The limit on the minimum number of function instances that may coexist at a
  455. // given time.
  456. //
  457. // Function instances are kept in idle state for a short period after they
  458. // finished executing the request to reduce cold start time for subsequent
  459. // requests. Setting a minimum instance count will ensure that the given
  460. // number of instances are kept running in idle state always. This can help
  461. // with cold start times when jump in incoming request count occurs after the
  462. // idle instance would have been stopped in the default case.
  463. int32 min_instance_count = 12;
  464. // The Serverless VPC Access connector that this cloud function can connect
  465. // to. The format of this field is `projects/*/locations/*/connectors/*`.
  466. string vpc_connector = 6 [(google.api.resource_reference) = {
  467. type: "vpcaccess.googleapis.com/Connector"
  468. }];
  469. // The egress settings for the connector, controlling what traffic is diverted
  470. // through it.
  471. VpcConnectorEgressSettings vpc_connector_egress_settings = 7;
  472. // The ingress settings for the function, controlling what traffic can reach
  473. // it.
  474. IngressSettings ingress_settings = 8;
  475. // Output only. URI of the Service deployed.
  476. string uri = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
  477. // The email of the service's service account. If empty, defaults to
  478. // `{project_number}-compute@developer.gserviceaccount.com`.
  479. string service_account_email = 10;
  480. // Whether 100% of traffic is routed to the latest revision.
  481. // On CreateFunction and UpdateFunction, when set to true, the revision being
  482. // deployed will serve 100% of traffic, ignoring any traffic split settings,
  483. // if any. On GetFunction, true will be returned if the latest revision is
  484. // serving 100% of traffic.
  485. bool all_traffic_on_latest_revision = 16;
  486. // Secret environment variables configuration.
  487. repeated SecretEnvVar secret_environment_variables = 17;
  488. // Secret volumes configuration.
  489. repeated SecretVolume secret_volumes = 19;
  490. // Output only. The name of service revision.
  491. string revision = 18 [(google.api.field_behavior) = OUTPUT_ONLY];
  492. }
  493. // Configuration for a secret environment variable. It has the information
  494. // necessary to fetch the secret value from secret manager and expose it as an
  495. // environment variable.
  496. message SecretEnvVar {
  497. // Name of the environment variable.
  498. string key = 1;
  499. // Project identifier (preferably project number but can also be the
  500. // project ID) of the project that contains the secret. If not set, it is
  501. // assumed that the secret is in the same project as the function.
  502. string project_id = 2;
  503. // Name of the secret in secret manager (not the full resource name).
  504. string secret = 3;
  505. // Version of the secret (version number or the string 'latest'). It is
  506. // recommended to use a numeric version for secret environment variables as
  507. // any updates to the secret value is not reflected until new instances
  508. // start.
  509. string version = 4;
  510. }
  511. // Configuration for a secret volume. It has the information necessary to fetch
  512. // the secret value from secret manager and make it available as files mounted
  513. // at the requested paths within the application container.
  514. message SecretVolume {
  515. // Configuration for a single version.
  516. message SecretVersion {
  517. // Version of the secret (version number or the string 'latest'). It is
  518. // preferable to use `latest` version with secret volumes as secret value
  519. // changes are reflected immediately.
  520. string version = 1;
  521. // Relative path of the file under the mount path where the secret value for
  522. // this version will be fetched and made available. For example, setting the
  523. // mount_path as '/etc/secrets' and path as `secret_foo` would mount the
  524. // secret value file at `/etc/secrets/secret_foo`.
  525. string path = 2;
  526. }
  527. // The path within the container to mount the secret volume. For example,
  528. // setting the mount_path as `/etc/secrets` would mount the secret value files
  529. // under the `/etc/secrets` directory. This directory will also be completely
  530. // shadowed and unavailable to mount any other secrets.
  531. // Recommended mount path: /etc/secrets
  532. string mount_path = 1;
  533. // Project identifier (preferably project number but can also be the project
  534. // ID) of the project that contains the secret. If not set, it is
  535. // assumed that the secret is in the same project as the function.
  536. string project_id = 2;
  537. // Name of the secret in secret manager (not the full resource name).
  538. string secret = 3;
  539. // List of secret versions to mount for this secret. If empty, the `latest`
  540. // version of the secret will be made available in a file named after the
  541. // secret under the mount point.
  542. repeated SecretVersion versions = 4;
  543. }
  544. // Describes EventTrigger, used to request events to be sent from another
  545. // service.
  546. message EventTrigger {
  547. // Describes the retry policy in case of function's execution failure.
  548. // Retried execution is charged as any other execution.
  549. enum RetryPolicy {
  550. // Not specified.
  551. RETRY_POLICY_UNSPECIFIED = 0;
  552. // Do not retry.
  553. RETRY_POLICY_DO_NOT_RETRY = 1;
  554. // Retry on any failure, retry up to 7 days with an exponential backoff
  555. // (capped at 10 seconds).
  556. RETRY_POLICY_RETRY = 2;
  557. }
  558. // Output only. The resource name of the Eventarc trigger. The format of this field is
  559. // `projects/{project}/locations/{region}/triggers/{trigger}`.
  560. string trigger = 1 [
  561. (google.api.field_behavior) = OUTPUT_ONLY,
  562. (google.api.resource_reference) = {
  563. type: "eventarc.googleapis.com/Trigger"
  564. }
  565. ];
  566. // The region that the trigger will be in. The trigger will only receive
  567. // events originating in this region. It can be the same
  568. // region as the function, a different region or multi-region, or the global
  569. // region. If not provided, defaults to the same region as the function.
  570. string trigger_region = 2;
  571. // Required. The type of event to observe. For example:
  572. // `google.cloud.audit.log.v1.written` or
  573. // `google.cloud.pubsub.topic.v1.messagePublished`.
  574. string event_type = 3 [(google.api.field_behavior) = REQUIRED];
  575. // Criteria used to filter events.
  576. repeated EventFilter event_filters = 4;
  577. // Optional. The name of a Pub/Sub topic in the same project that will be used
  578. // as the transport topic for the event delivery. Format:
  579. // `projects/{project}/topics/{topic}`.
  580. //
  581. // This is only valid for events of type
  582. // `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here
  583. // will not be deleted at function deletion.
  584. string pubsub_topic = 5 [
  585. (google.api.field_behavior) = OPTIONAL,
  586. (google.api.resource_reference) = {
  587. type: "pubsub.googleapis.com/Topic"
  588. }
  589. ];
  590. // Optional. The email of the trigger's service account. The service account must have
  591. // permission to invoke Cloud Run services, the permission is
  592. // `run.routes.invoke`.
  593. // If empty, defaults to the Compute Engine default service account:
  594. // `{project_number}-compute@developer.gserviceaccount.com`.
  595. string service_account_email = 6 [(google.api.field_behavior) = OPTIONAL];
  596. // Optional. If unset, then defaults to ignoring failures (i.e. not retrying them).
  597. RetryPolicy retry_policy = 7 [(google.api.field_behavior) = OPTIONAL];
  598. // Optional. The name of the channel associated with the trigger in
  599. // `projects/{project}/locations/{location}/channels/{channel}` format.
  600. // You must provide a channel to receive events from Eventarc SaaS partners.
  601. string channel = 8 [
  602. (google.api.field_behavior) = OPTIONAL,
  603. (google.api.resource_reference) = {
  604. type: "eventarc.googleapis.com/Channel"
  605. }
  606. ];
  607. }
  608. // Filters events based on exact matches on the CloudEvents attributes.
  609. message EventFilter {
  610. // Required. The name of a CloudEvents attribute.
  611. string attribute = 1 [(google.api.field_behavior) = REQUIRED];
  612. // Required. The value for the attribute.
  613. string value = 2 [(google.api.field_behavior) = REQUIRED];
  614. // Optional. The operator used for matching the events with the value of the
  615. // filter. If not specified, only events that have an exact key-value pair
  616. // specified in the filter are matched. The only allowed value is
  617. // `match-path-pattern`.
  618. string operator = 3 [(google.api.field_behavior) = OPTIONAL];
  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/Function"
  627. }
  628. ];
  629. }
  630. // Request for the `ListFunctions` method.
  631. message ListFunctionsRequest {
  632. // Required. 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 [
  639. (google.api.field_behavior) = REQUIRED,
  640. (google.api.resource_reference) = {
  641. child_type: "cloudfunctions.googleapis.com/Function"
  642. }
  643. ];
  644. // Maximum number of functions to return per call.
  645. int32 page_size = 2;
  646. // The value returned by the last
  647. // `ListFunctionsResponse`; indicates that
  648. // this is a continuation of a prior `ListFunctions` call, and that the
  649. // system should return the next page of data.
  650. string page_token = 3;
  651. // The filter for Functions that match the filter expression,
  652. // following the syntax outlined in https://google.aip.dev/160.
  653. string filter = 4;
  654. // The sorting order of the resources returned. Value should be a comma
  655. // separated list of fields. The default sorting oder is ascending.
  656. // See https://google.aip.dev/132#ordering.
  657. string order_by = 5;
  658. }
  659. // Response for the `ListFunctions` method.
  660. message ListFunctionsResponse {
  661. // The functions that match the request.
  662. repeated Function functions = 1;
  663. // A token, which can be sent as `page_token` to retrieve the next page.
  664. // If this field is omitted, there are no subsequent pages.
  665. string next_page_token = 2;
  666. // Locations that could not be reached. The response does not include any
  667. // functions from these locations.
  668. repeated string unreachable = 3;
  669. }
  670. // Request for the `CreateFunction` method.
  671. message CreateFunctionRequest {
  672. // Required. The project and location in which the function should be created, specified
  673. // in the format `projects/*/locations/*`
  674. string parent = 1 [
  675. (google.api.field_behavior) = REQUIRED,
  676. (google.api.resource_reference) = {
  677. type: "locations.googleapis.com/Location"
  678. }
  679. ];
  680. // Required. Function to be created.
  681. Function function = 2 [(google.api.field_behavior) = REQUIRED];
  682. // The ID to use for the function, which will become the final component of
  683. // the function's resource name.
  684. //
  685. // This value should be 4-63 characters, and valid characters
  686. // are /[a-z][0-9]-/.
  687. string function_id = 3;
  688. }
  689. // Request for the `UpdateFunction` method.
  690. message UpdateFunctionRequest {
  691. // Required. New version of the function.
  692. Function function = 1 [(google.api.field_behavior) = REQUIRED];
  693. // The list of fields to be updated.
  694. // If no field mask is provided, all provided fields in the request will be
  695. // updated.
  696. google.protobuf.FieldMask update_mask = 2;
  697. }
  698. // Request for the `DeleteFunction` method.
  699. message DeleteFunctionRequest {
  700. // Required. The name of the function which should be deleted.
  701. string name = 1 [
  702. (google.api.field_behavior) = REQUIRED,
  703. (google.api.resource_reference) = {
  704. type: "cloudfunctions.googleapis.com/Function"
  705. }
  706. ];
  707. }
  708. // Request of `GenerateSourceUploadUrl` method.
  709. message GenerateUploadUrlRequest {
  710. // Required. The project and location in which the Google Cloud Storage signed URL
  711. // should be generated, specified in the format `projects/*/locations/*`.
  712. string parent = 1 [
  713. (google.api.field_behavior) = REQUIRED,
  714. (google.api.resource_reference) = {
  715. type: "locations.googleapis.com/Location"
  716. }
  717. ];
  718. }
  719. // Response of `GenerateSourceUploadUrl` method.
  720. message GenerateUploadUrlResponse {
  721. // The generated Google Cloud Storage signed URL that should be used for a
  722. // function source code upload. The uploaded file should be a zip archive
  723. // which contains a function.
  724. string upload_url = 1;
  725. // The location of the source code in the upload bucket.
  726. //
  727. // Once the archive is uploaded using the `upload_url` use this field to
  728. // set the `function.build_config.source.storage_source`
  729. // during CreateFunction and UpdateFunction.
  730. //
  731. // Generation defaults to 0, as Cloud Storage provides a new generation only
  732. // upon uploading a new object or version of an object.
  733. StorageSource storage_source = 2;
  734. }
  735. // Request of `GenerateDownloadUrl` method.
  736. message GenerateDownloadUrlRequest {
  737. // Required. The name of function for which source code Google Cloud Storage signed
  738. // URL should be generated.
  739. string name = 1 [
  740. (google.api.field_behavior) = REQUIRED,
  741. (google.api.resource_reference) = {
  742. type: "cloudfunctions.googleapis.com/Function"
  743. }
  744. ];
  745. }
  746. // Response of `GenerateDownloadUrl` method.
  747. message GenerateDownloadUrlResponse {
  748. // The generated Google Cloud Storage signed URL that should be used for
  749. // function source code download.
  750. string download_url = 1;
  751. }
  752. // Request for the `ListRuntimes` method.
  753. message ListRuntimesRequest {
  754. // Required. The project and location from which the runtimes should be listed,
  755. // specified in the format `projects/*/locations/*`
  756. string parent = 1 [
  757. (google.api.field_behavior) = REQUIRED,
  758. (google.api.resource_reference) = {
  759. type: "locations.googleapis.com/Location"
  760. }
  761. ];
  762. // The filter for Runtimes that match the filter expression,
  763. // following the syntax outlined in https://google.aip.dev/160.
  764. string filter = 2;
  765. }
  766. // Response for the `ListRuntimes` method.
  767. message ListRuntimesResponse {
  768. // Describes a runtime and any special information (e.g., deprecation status)
  769. // related to it.
  770. message Runtime {
  771. // The name of the runtime, e.g., 'go113', 'nodejs12', etc.
  772. string name = 1;
  773. // The user facing name, eg 'Go 1.13', 'Node.js 12', etc.
  774. string display_name = 5;
  775. // The stage of life this runtime is in, e.g., BETA, GA, etc.
  776. RuntimeStage stage = 2;
  777. // Warning messages, e.g., a deprecation warning.
  778. repeated string warnings = 3;
  779. // The environment for the runtime.
  780. Environment environment = 4;
  781. }
  782. // The various stages that a runtime can be in.
  783. enum RuntimeStage {
  784. // Not specified.
  785. RUNTIME_STAGE_UNSPECIFIED = 0;
  786. // The runtime is in development.
  787. DEVELOPMENT = 1;
  788. // The runtime is in the Alpha stage.
  789. ALPHA = 2;
  790. // The runtime is in the Beta stage.
  791. BETA = 3;
  792. // The runtime is generally available.
  793. GA = 4;
  794. // The runtime is deprecated.
  795. DEPRECATED = 5;
  796. // The runtime is no longer supported.
  797. DECOMMISSIONED = 6;
  798. }
  799. // The runtimes that match the request.
  800. repeated Runtime runtimes = 1;
  801. }
  802. // Represents the metadata of the long-running operation.
  803. message OperationMetadata {
  804. // The time the operation was created.
  805. google.protobuf.Timestamp create_time = 1;
  806. // The time the operation finished running.
  807. google.protobuf.Timestamp end_time = 2;
  808. // Server-defined resource path for the target of the operation.
  809. string target = 3;
  810. // Name of the verb executed by the operation.
  811. string verb = 4;
  812. // Human-readable status of the operation, if any.
  813. string status_detail = 5;
  814. // Identifies whether the user has requested cancellation
  815. // of the operation. Operations that have successfully been cancelled
  816. // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
  817. // corresponding to `Code.CANCELLED`.
  818. bool cancel_requested = 6;
  819. // API version used to start the operation.
  820. string api_version = 7;
  821. // The original request that started the operation.
  822. google.protobuf.Any request_resource = 8;
  823. // Mechanism for reporting in-progress stages
  824. repeated Stage stages = 9;
  825. }
  826. // Each Stage of the deployment process
  827. message Stage {
  828. // Possible names for a Stage
  829. enum Name {
  830. // Not specified. Invalid name.
  831. NAME_UNSPECIFIED = 0;
  832. // Artifact Regsitry Stage
  833. ARTIFACT_REGISTRY = 1;
  834. // Build Stage
  835. BUILD = 2;
  836. // Service Stage
  837. SERVICE = 3;
  838. // Trigger Stage
  839. TRIGGER = 4;
  840. // Service Rollback Stage
  841. SERVICE_ROLLBACK = 5;
  842. // Trigger Rollback Stage
  843. TRIGGER_ROLLBACK = 6;
  844. }
  845. // Possible states for a Stage
  846. enum State {
  847. // Not specified. Invalid state.
  848. STATE_UNSPECIFIED = 0;
  849. // Stage has not started.
  850. NOT_STARTED = 1;
  851. // Stage is in progress.
  852. IN_PROGRESS = 2;
  853. // Stage has completed.
  854. COMPLETE = 3;
  855. }
  856. // Name of the Stage. This will be unique for each Stage.
  857. Name name = 1;
  858. // Message describing the Stage
  859. string message = 2;
  860. // Current state of the Stage
  861. State state = 3;
  862. // Resource of the Stage
  863. string resource = 4;
  864. // Link to the current Stage resource
  865. string resource_uri = 5;
  866. // State messages from the current Stage.
  867. repeated StateMessage state_messages = 6;
  868. }