Skip to content

Commit 182e5df

Browse files
Google APIscopybara-github
authored andcommitted
feat: optional field for specifying a service account to use for the build. This helps navigate the change of historical default on new projects. For more details, see https://cloud.google.com/build/docs/cloud-build-service-account-updates
feat: optional fields for setting up automatic base image updates. feat: optional field for specifying a revision on GetFunction. feat: optional field for binary authorization policy. feat: optional field for deploying a source from a GitHub repository. feat: additional field on the output that specified whether the deployment supports Physical Zone Separation. feat: Generate upload URL now supports for specifying the GCF generation that the generated upload url will be used for. feat: ListRuntimes response now includes deprecation and decommissioning dates. docs: Refined description in several fields. PiperOrigin-RevId: 662275444
1 parent eb87f47 commit 182e5df

4 files changed

Lines changed: 248 additions & 42 deletions

File tree

google/cloud/functions/v2alpha/BUILD.bazel

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
# * extra_protoc_file_parameters
1010
# The complete list of preserved parameters can be found in the source code.
1111

12-
##############################################################################
13-
# Common
14-
##############################################################################
15-
load("@rules_proto//proto:defs.bzl", "proto_library")
1612
load(
1713
"@com_google_googleapis_imports//:imports.bzl",
1814
"cc_grpc_library",
@@ -44,6 +40,11 @@ load(
4440
"ruby_proto_library",
4541
)
4642

43+
##############################################################################
44+
# Common
45+
##############################################################################
46+
load("@rules_proto//proto:defs.bzl", "proto_library")
47+
4748
# This is an API workspace, having public visibility by default makes perfect sense.
4849
package(default_visibility = ["//visibility:public"])
4950

@@ -58,6 +59,7 @@ proto_library(
5859
"//google/api:field_behavior_proto",
5960
"//google/api:resource_proto",
6061
"//google/longrunning:operations_proto",
62+
"//google/type:date_proto",
6163
"@com_google_protobuf//:any_proto",
6264
"@com_google_protobuf//:empty_proto",
6365
"@com_google_protobuf//:field_mask_proto",
@@ -137,6 +139,7 @@ go_proto_library(
137139
deps = [
138140
"//google/api:annotations_go_proto",
139141
"//google/longrunning:longrunning_go_proto",
142+
"//google/type:date_go_proto",
140143
],
141144
)
142145

google/cloud/functions/v2alpha/functions.proto

Lines changed: 117 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import "google/protobuf/any.proto";
2525
import "google/protobuf/empty.proto";
2626
import "google/protobuf/field_mask.proto";
2727
import "google/protobuf/timestamp.proto";
28+
import "google/type/date.proto";
2829

2930
option go_package = "cloud.google.com/go/functions/apiv2alpha/functionspb;functionspb";
3031
option java_multiple_files = true;
@@ -156,11 +157,11 @@ service FunctionService {
156157
// attached, the identity from the credentials would be used, but that
157158
// identity does not have permissions to upload files to the URL.
158159
//
159-
// When making a HTTP PUT request, these two headers need to be specified:
160+
// When making a HTTP PUT request, specify this header:
160161
//
161162
// * `content-type: application/zip`
162163
//
163-
// And this header SHOULD NOT be specified:
164+
// Do not specify this header:
164165
//
165166
// * `Authorization: Bearer YOUR_TOKEN`
166167
rpc GenerateUploadUrl(GenerateUploadUrlRequest)
@@ -193,6 +194,21 @@ service FunctionService {
193194
}
194195
}
195196

197+
// The type of the long running operation.
198+
enum OperationType {
199+
// Unspecified
200+
OPERATIONTYPE_UNSPECIFIED = 0;
201+
202+
// CreateFunction
203+
CREATE_FUNCTION = 1;
204+
205+
// UpdateFunction
206+
UPDATE_FUNCTION = 2;
207+
208+
// DeleteFunction
209+
DELETE_FUNCTION = 3;
210+
}
211+
196212
// The environment the function is hosted on.
197213
enum Environment {
198214
// Unspecified
@@ -284,6 +300,14 @@ message Function {
284300
string kms_key_name = 25 [(google.api.resource_reference) = {
285301
type: "cloudkms.googleapis.com/CryptoKey"
286302
}];
303+
304+
// Output only. Reserved for future use.
305+
bool satisfies_pzs = 27 [(google.api.field_behavior) = OUTPUT_ONLY];
306+
307+
// Output only. The create timestamp of a Cloud Function. This is only
308+
// applicable to 2nd Gen functions.
309+
google.protobuf.Timestamp create_time = 28
310+
[(google.api.field_behavior) = OUTPUT_ONLY];
287311
}
288312

289313
// Informational messages about the state of the Cloud Function or Operation.
@@ -329,6 +353,11 @@ message StorageSource {
329353
// Google Cloud Storage generation for the object. If the generation is
330354
// omitted, the latest generation will be used.
331355
int64 generation = 3;
356+
357+
// When the specified storage bucket is a 1st gen function uploard url bucket,
358+
// this field should be set as the generated upload url for 1st gen
359+
// deployment.
360+
string source_upload_url = 4;
332361
}
333362

334363
// Location of the source in a Google Cloud Source Repository.
@@ -382,6 +411,11 @@ message Source {
382411
// If provided, get the source from this location in a Cloud Source
383412
// Repository.
384413
RepoSource repo_source = 2;
414+
415+
// If provided, get the source from GitHub repository. This option is valid
416+
// only for GCF 1st Gen function.
417+
// Example: https://github.com/<user>/<repo>/blob/<commit>/<path-to-code>
418+
string git_uri = 3;
385419
}
386420
}
387421

@@ -395,6 +429,10 @@ message SourceProvenance {
395429
// A copy of the build's `source.repo_source`, if exists, with any
396430
// revisions resolved.
397431
RepoSource resolved_repo_source = 2;
432+
433+
// A copy of the build's `source.git_uri`, if exists, with any commits
434+
// resolved.
435+
string git_uri = 3;
398436
}
399437

400438
// Describes the Build step of the function that builds a container from the
@@ -417,6 +455,13 @@ message BuildConfig {
417455
ARTIFACT_REGISTRY = 2;
418456
}
419457

458+
// This controls when security patches are applied to the runtime environment.
459+
oneof runtime_update_policy {
460+
AutomaticUpdatePolicy automatic_update_policy = 40;
461+
462+
OnDeployUpdatePolicy on_deploy_update_policy = 41;
463+
}
464+
420465
// Output only. The Cloud Build name of the latest successful deployment of
421466
// the function.
422467
string build = 1 [
@@ -471,16 +516,15 @@ message BuildConfig {
471516
// applicable to 1st Gen functions, 2nd Gen functions can only use Artifact
472517
// Registry.
473518
//
474-
// If `docker_repository` field is specified, this field will be automatically
475-
// set as `ARTIFACT_REGISTRY`.
476-
// If unspecified, it currently defaults to `CONTAINER_REGISTRY`.
477-
// This field may be overridden by the backend for eligible deployments.
519+
// If unspecified, it defaults to `ARTIFACT_REGISTRY`.
520+
// If `docker_repository` field is specified, this field should either be left
521+
// unspecified or set to `ARTIFACT_REGISTRY`.
478522
DockerRegistry docker_registry = 10;
479523

480-
// User managed repository created in Artifact Registry optionally
481-
// with a customer managed encryption key. This is the repository to which the
482-
// function docker image will be pushed after it is built by Cloud Build.
483-
// If unspecified, GCF will create and use a repository named 'gcf-artifacts'
524+
// Repository in Artifact Registry to which the function docker image will be
525+
// pushed after it is built by Cloud Build. If specified by user, it is
526+
// created and managed by user with a customer managed encryption key.
527+
// Otherwise, GCF will create and use a repository named 'gcf-artifacts'
484528
// for every deployed region.
485529
//
486530
// It must match the pattern
@@ -492,6 +536,10 @@ message BuildConfig {
492536
string docker_repository = 7 [(google.api.resource_reference) = {
493537
type: "artifactregistry.googleapis.com/Repository"
494538
}];
539+
540+
// Service account to be used for building the container. The format of this
541+
// field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
542+
string service_account = 27;
495543
}
496544

497545
// Describes the Service being deployed.
@@ -574,7 +622,7 @@ message ServiceConfig {
574622
// a full description.
575623
string available_memory = 13;
576624

577-
// [Preview] The number of CPUs used in a single container instance.
625+
// The number of CPUs used in a single container instance.
578626
// Default value is calculated from available memory.
579627
// Supports the same values as Cloud Run, see
580628
// https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements
@@ -646,7 +694,7 @@ message ServiceConfig {
646694
// Output only. The name of service revision.
647695
string revision = 18 [(google.api.field_behavior) = OUTPUT_ONLY];
648696

649-
// [Preview] Sets the maximum number of concurrent requests that each instance
697+
// Sets the maximum number of concurrent requests that each instance
650698
// can receive. Defaults to 1.
651699
int32 max_instance_request_concurrency = 20;
652700

@@ -655,6 +703,11 @@ message ServiceConfig {
655703
// trigger. By default https is optional for 1st Gen functions; 2nd Gen
656704
// functions are https ONLY.
657705
SecurityLevel security_level = 21;
706+
707+
// Optional. The binary authorization policy to be checked when deploying the
708+
// Cloud Run service.
709+
string binary_authorization_policy = 23
710+
[(google.api.field_behavior) = OPTIONAL];
658711
}
659712

660713
// Configuration for a secret environment variable. It has the information
@@ -790,6 +843,16 @@ message EventTrigger {
790843
type: "eventarc.googleapis.com/Channel"
791844
}
792845
];
846+
847+
// Optional. The hostname of the service that 1st Gen function should be
848+
// observed.
849+
//
850+
// If no string is provided, the default service implementing the API will
851+
// be used. For example, `storage.googleapis.com` is the default for all
852+
// event types in the `google.storage` namespace.
853+
//
854+
// The field is only applicable to 1st Gen functions.
855+
string service = 9 [(google.api.field_behavior) = OPTIONAL];
793856
}
794857

795858
// Filters events based on exact matches on the CloudEvents attributes.
@@ -816,6 +879,14 @@ message GetFunctionRequest {
816879
type: "cloudfunctions.googleapis.com/Function"
817880
}
818881
];
882+
883+
// Optional. The optional version of the 1st gen function whose details should
884+
// be obtained. The version of a 1st gen function is an integer that starts
885+
// from 1 and gets incremented on redeployments. GCF may keep historical
886+
// configs for old versions of 1st gen function. This field can be specified
887+
// to fetch the historical configs. This field is valid only for GCF 1st gen
888+
// function.
889+
string revision = 2 [(google.api.field_behavior) = OPTIONAL];
819890
}
820891

821892
// Request for the `ListFunctions` method.
@@ -897,8 +968,7 @@ message UpdateFunctionRequest {
897968
Function function = 1 [(google.api.field_behavior) = REQUIRED];
898969

899970
// The list of fields to be updated.
900-
// If no field mask is provided, all provided fields in the request will be
901-
// updated.
971+
// If no field mask is provided, all fields will be updated.
902972
google.protobuf.FieldMask update_mask = 2;
903973
}
904974

@@ -942,6 +1012,12 @@ message GenerateUploadUrlRequest {
9421012
string kms_key_name = 2 [(google.api.resource_reference) = {
9431013
type: "cloudkms.googleapis.com/CryptoKey"
9441014
}];
1015+
1016+
// The function environment the generated upload url will be used for.
1017+
// The upload url for 2nd Gen functions can also be used for 1st gen
1018+
// functions, but not vice versa. If not specified, 2nd generation-style
1019+
// upload URLs are generated.
1020+
Environment environment = 3;
9451021
}
9461022

9471023
// Response of `GenerateSourceUploadUrl` method.
@@ -1016,6 +1092,12 @@ message ListRuntimesResponse {
10161092

10171093
// The environment for the runtime.
10181094
Environment environment = 4;
1095+
1096+
// Deprecation date for the runtime.
1097+
google.type.Date deprecation_date = 6;
1098+
1099+
// Decommission date for the runtime.
1100+
google.type.Date decommission_date = 7;
10191101
}
10201102

10211103
// The various stages that a runtime can be in.
@@ -1046,6 +1128,17 @@ message ListRuntimesResponse {
10461128
repeated Runtime runtimes = 1;
10471129
}
10481130

1131+
// Security patches are applied automatically to the runtime without requiring
1132+
// the function to be redeployed.
1133+
message AutomaticUpdatePolicy {}
1134+
1135+
// Security patches are only applied when a function is redeployed.
1136+
message OnDeployUpdatePolicy {
1137+
// Output only. contains the runtime version which was used during latest
1138+
// function deployment.
1139+
string runtime_version = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
1140+
}
1141+
10491142
// Represents the metadata of the long-running operation.
10501143
message OperationMetadata {
10511144
// The time the operation was created.
@@ -1065,9 +1158,10 @@ message OperationMetadata {
10651158

10661159
// Identifies whether the user has requested cancellation
10671160
// of the operation. Operations that have successfully been cancelled
1068-
// have [Operation.error][] value with a
1069-
// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
1070-
// `Code.CANCELLED`.
1161+
// have
1162+
// [google.longrunning.Operation.error][google.longrunning.Operation.error]
1163+
// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
1164+
// corresponding to `Code.CANCELLED`.
10711165
bool cancel_requested = 6;
10721166

10731167
// API version used to start the operation.
@@ -1078,6 +1172,12 @@ message OperationMetadata {
10781172

10791173
// Mechanism for reporting in-progress stages
10801174
repeated Stage stages = 9;
1175+
1176+
// The build name of the function for create and update operations.
1177+
string build_name = 13;
1178+
1179+
// The operation type.
1180+
OperationType operation_type = 11;
10811181
}
10821182

10831183
// Extra GCF specific location information.

google/cloud/functions/v2beta/BUILD.bazel

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
# * extra_protoc_file_parameters
1010
# The complete list of preserved parameters can be found in the source code.
1111

12-
##############################################################################
13-
# Common
14-
##############################################################################
15-
load("@rules_proto//proto:defs.bzl", "proto_library")
1612
load(
1713
"@com_google_googleapis_imports//:imports.bzl",
1814
"cc_grpc_library",
@@ -44,6 +40,11 @@ load(
4440
"ruby_proto_library",
4541
)
4642

43+
##############################################################################
44+
# Common
45+
##############################################################################
46+
load("@rules_proto//proto:defs.bzl", "proto_library")
47+
4748
# This is an API workspace, having public visibility by default makes perfect sense.
4849
package(default_visibility = ["//visibility:public"])
4950

@@ -58,6 +59,7 @@ proto_library(
5859
"//google/api:field_behavior_proto",
5960
"//google/api:resource_proto",
6061
"//google/longrunning:operations_proto",
62+
"//google/type:date_proto",
6163
"@com_google_protobuf//:any_proto",
6264
"@com_google_protobuf//:empty_proto",
6365
"@com_google_protobuf//:field_mask_proto",
@@ -137,6 +139,7 @@ go_proto_library(
137139
deps = [
138140
"//google/api:annotations_go_proto",
139141
"//google/longrunning:longrunning_go_proto",
142+
"//google/type:date_go_proto",
140143
],
141144
)
142145

0 commit comments

Comments
 (0)