@@ -32,6 +32,14 @@ option java_multiple_files = true;
3232option java_outer_classname = "FunctionsProto" ;
3333option java_package = "com.google.cloud.functions.v1" ;
3434option objc_class_prefix = "GCF" ;
35+ option (google.api.resource_definition ) = {
36+ type : "artifactregistry.googleapis.com/Repository"
37+ pattern : "projects/{project}/locations/{location}/repositories/{repository}"
38+ };
39+ option (google.api.resource_definition ) = {
40+ type : "cloudkms.googleapis.com/CryptoKey"
41+ pattern : "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}"
42+ };
3543
3644// A service that application uses to manipulate triggers and functions.
3745service CloudFunctionsService {
@@ -183,6 +191,7 @@ service CloudFunctionsService {
183191
184192// Describes a Cloud Function that contains user computation executed in
185193// response to an event. It encapsulate function and triggers configurations.
194+ // Next tag: 36
186195message CloudFunction {
187196 option (google.api.resource ) = {
188197 type : "cloudfunctions.googleapis.com/CloudFunction"
@@ -304,6 +313,9 @@ message CloudFunction {
304313 // Environment variables that shall be available during function execution.
305314 map <string , string > environment_variables = 17 ;
306315
316+ // Build environment variables that shall be available during build time.
317+ map <string , string > build_environment_variables = 28 ;
318+
307319 // The VPC Network that this cloud function can connect to. It can be
308320 // either the fully-qualified URI, or the short name of the network resource.
309321 // If the short network name is used, the network must belong to the same
@@ -322,8 +334,22 @@ message CloudFunction {
322334
323335 // The limit on the maximum number of function instances that may coexist at a
324336 // given time.
337+ //
338+ // In some cases, such as rapid traffic surges, Cloud Functions may, for a
339+ // short period of time, create more instances than the specified max
340+ // instances limit. If your function cannot tolerate this temporary behavior,
341+ // you may want to factor in a safety margin and set a lower max instances
342+ // value than your function can tolerate.
343+ //
344+ // See the [Max
345+ // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for
346+ // more details.
325347 int32 max_instances = 20 ;
326348
349+ // A lower bound for the number function instances that may coexist at a
350+ // given time.
351+ int32 min_instances = 32 ;
352+
327353 // The VPC Network Connector that this cloud function can connect to. It can
328354 // be either the fully-qualified URI, or the short name of the network
329355 // connector resource. The format of this field is
@@ -344,9 +370,86 @@ message CloudFunction {
344370 // it.
345371 IngressSettings ingress_settings = 24 ;
346372
373+ // Resource name of a KMS crypto key (managed by the user) used to
374+ // encrypt/decrypt function resources.
375+ //
376+ // It must match the pattern
377+ // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
378+ //
379+ // If specified, you must also provide an artifact registry repository using
380+ // the `docker_repository` field that was created with the same KMS crypto
381+ // key.
382+ //
383+ // The following service accounts need to be granted Cloud KMS crypto key
384+ // encrypter/decrypter roles on the key.
385+ //
386+ // 1. Google Cloud Functions service account
387+ // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) -
388+ // Required to protect the function's image.
389+ // 2. Google Storage service account
390+ // (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) -
391+ // Required to protect the function's source code.
392+ // If this service account does not exist, deploying a function without a
393+ // KMS key or retrieving the service agent name provisions it. For more
394+ // information, see
395+ // https://cloud.google.com/storage/docs/projects#service-agents and
396+ // https://cloud.google.com/storage/docs/getting-service-agent#gsutil.
397+ //
398+ // Google Cloud Functions delegates access to service agents to protect
399+ // function resources in internal projects that are not accessible by the
400+ // end user.
401+ string kms_key_name = 25 [(google.api.resource_reference ) = {
402+ type : "cloudkms.googleapis.com/CryptoKey"
403+ }];
404+
405+ // Name of the Cloud Build Custom Worker Pool that should be used to build the
406+ // function. The format of this field is
407+ // `projects/{project}/locations/{region}/workerPools/{workerPool}` where
408+ // `{project}` and `{region}` are the project id and region respectively where
409+ // the worker pool is defined and `{workerPool}` is the short name of the
410+ // worker pool.
411+ //
412+ // If the project id is not the same as the function, then the Cloud
413+ // Functions Service Agent
414+ // (`service-<project_number>@gcf-admin-robot.iam.gserviceaccount.com`) must
415+ // be granted the role Cloud Build Custom Workers Builder
416+ // (`roles/cloudbuild.customworkers.builder`) in the project.
417+ string build_worker_pool = 26 ;
418+
347419 // Output only. The Cloud Build ID of the latest successful deployment of the
348420 // function.
349421 string build_id = 27 [(google.api.field_behavior ) = OUTPUT_ONLY ];
422+
423+ // Output only. The Cloud Build Name of the function deployment.
424+ // `projects/<project-number>/locations/<region>/builds/<build-id>`.
425+ string build_name = 33 [(google.api.field_behavior ) = OUTPUT_ONLY ];
426+
427+ // Secret environment variables configuration.
428+ repeated SecretEnvVar secret_environment_variables = 29 ;
429+
430+ // Secret volumes configuration.
431+ repeated SecretVolume secret_volumes = 30 ;
432+
433+ // Input only. An identifier for Firebase function sources. Disclaimer: This field is only
434+ // supported for Firebase function deployments.
435+ string source_token = 31 [(google.api.field_behavior ) = INPUT_ONLY ];
436+
437+ // User managed repository created in Artifact Registry optionally with a
438+ // customer managed encryption key. If specified, deployments will use
439+ // Artifact Registry. If unspecified and the deployment is eligible to use
440+ // Artifact Registry, GCF will create and use a repository named
441+ // 'gcf-artifacts' for every deployed region. This is the repository to which
442+ // the function docker image will be pushed after it is built by Cloud Build.
443+ //
444+ // It must match the pattern
445+ // `projects/{project}/locations/{location}/repositories/{repository}`.
446+ //
447+ // Cross-project repositories are not supported.
448+ // Cross-location repositories are not supported.
449+ // Repository format must be 'DOCKER'.
450+ string docker_repository = 34 [(google.api.resource_reference ) = {
451+ type : "artifactregistry.googleapis.com/Repository"
452+ }];
350453}
351454
352455// Describes SourceRepository, used to represent parameters related to
@@ -472,6 +575,73 @@ message FailurePolicy {
472575 }
473576}
474577
578+ // Configuration for a secret environment variable. It has the information
579+ // necessary to fetch the secret value from secret manager and expose it as an
580+ // environment variable. Secret value is not a part of the configuration. Secret
581+ // values are only fetched when a new clone starts.
582+ message SecretEnvVar {
583+ // Name of the environment variable.
584+ string key = 1 ;
585+
586+ // Project identifier (preferrably project number but can also be the project
587+ // ID) of the project that contains the secret. If not set, it will be
588+ // populated with the function's project assuming that the secret exists in
589+ // the same project as of the function.
590+ string project_id = 2 ;
591+
592+ // Name of the secret in secret manager (not the full resource name).
593+ string secret = 3 ;
594+
595+ // Version of the secret (version number or the string 'latest'). It is
596+ // recommended to use a numeric version for secret environment variables as
597+ // any updates to the secret value is not reflected until new clones start.
598+ string version = 4 ;
599+ }
600+
601+ // Configuration for a secret volume. It has the information necessary to fetch
602+ // the secret value from secret manager and make it available as files mounted
603+ // at the requested paths within the application container. Secret value is not
604+ // a part of the configuration. Every filesystem read operation performs a
605+ // lookup in secret manager to retrieve the secret value.
606+ message SecretVolume {
607+ // Configuration for a single version.
608+ message SecretVersion {
609+ // Version of the secret (version number or the string 'latest'). It is
610+ // preferrable to use `latest` version with secret volumes as secret value
611+ // changes are reflected immediately.
612+ string version = 1 ;
613+
614+ // Relative path of the file under the mount path where the secret value for
615+ // this version will be fetched and made available. For example, setting the
616+ // mount_path as '/etc/secrets' and path as `/secret_foo` would mount the
617+ // secret value file at `/etc/secrets/secret_foo`.
618+ string path = 2 ;
619+ }
620+
621+ // The path within the container to mount the secret volume. For example,
622+ // setting the mount_path as `/etc/secrets` would mount the secret value files
623+ // under the `/etc/secrets` directory. This directory will also be completely
624+ // shadowed and unavailable to mount any other secrets.
625+ //
626+ // Recommended mount paths: /etc/secrets
627+ // Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log
628+ string mount_path = 1 ;
629+
630+ // Project identifier (preferrably project number but can also be the project
631+ // ID) of the project that contains the secret. If not set, it will be
632+ // populated with the function's project assuming that the secret exists in
633+ // the same project as of the function.
634+ string project_id = 2 ;
635+
636+ // Name of the secret in secret manager (not the full resource name).
637+ string secret = 3 ;
638+
639+ // List of secret versions to mount for this secret. If empty, the `latest`
640+ // version of the secret will be made available in a file named after the
641+ // secret under the mount point.
642+ repeated SecretVersion versions = 4 ;
643+ }
644+
475645// Request for the `CreateFunction` method.
476646message CreateFunctionRequest {
477647 // Required. The project and location in which the function should be created, specified
@@ -490,25 +660,12 @@ message CreateFunctionRequest {
490660// Request for the `UpdateFunction` method.
491661message UpdateFunctionRequest {
492662 // Required. New version of the function.
493- CloudFunction function = 1 [
494- (google.api.field_behavior ) = REQUIRED
495- ];
663+ CloudFunction function = 1 [(google.api.field_behavior ) = REQUIRED ];
496664
497665 // Required list of fields to be updated in this request.
498666 google.protobuf.FieldMask update_mask = 2 ;
499667}
500668
501- // Request for the `GetFunction` method.
502- message GetFunctionRequest {
503- // Required. The name of the function which details should be obtained.
504- string name = 1 [
505- (google.api.field_behavior ) = REQUIRED ,
506- (google.api.resource_reference ) = {
507- type : "cloudfunctions.googleapis.com/CloudFunction"
508- }
509- ];
510- }
511-
512669// Describes the current stage of a deployment.
513670enum CloudFunctionStatus {
514671 // Not specified. Invalid state.
@@ -531,6 +688,17 @@ enum CloudFunctionStatus {
531688 UNKNOWN = 5 ;
532689}
533690
691+ // Request for the `GetFunction` method.
692+ message GetFunctionRequest {
693+ // Required. The name of the function which details should be obtained.
694+ string name = 1 [
695+ (google.api.field_behavior ) = REQUIRED ,
696+ (google.api.resource_reference ) = {
697+ type : "cloudfunctions.googleapis.com/CloudFunction"
698+ }
699+ ];
700+ }
701+
534702// Request for the `ListFunctions` method.
535703message ListFunctionsRequest {
536704 // The project and location from which the function should be listed,
0 commit comments