From 7141d405a8b0a6988dc751a4706f37f3fbe75119 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 20 Sep 2021 10:33:13 -0400 Subject: [PATCH] feat: add SecurityLevel option on HttpsTrigger (#304) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add SecurityLevel option on HttpsTrigger PiperOrigin-RevId: 396889803 Source-Link: https://github.com/googleapis/googleapis/commit/44c497f37f1959360f28ff12d20e3a7c9429378f Source-Link: https://github.com/googleapis/googleapis-gen/commit/79db6277e1ab34845a42ee39d7b4466eef7dd5c0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzlkYjYyNzdlMWFiMzQ4NDVhNDJlZTM5ZDdiNDQ2NmVlZjdkZDVjMCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../cloud/functions/v1/FunctionsProto.java | 202 +++++------ .../cloud/functions/v1/HttpsTrigger.java | 326 ++++++++++++++++++ .../functions/v1/HttpsTriggerOrBuilder.java | 25 ++ .../google/cloud/functions/v1/functions.proto | 23 ++ 4 files changed, 477 insertions(+), 99 deletions(-) diff --git a/proto-google-cloud-functions-v1/src/main/java/com/google/cloud/functions/v1/FunctionsProto.java b/proto-google-cloud-functions-v1/src/main/java/com/google/cloud/functions/v1/FunctionsProto.java index ea84a778..8f80c50d 100644 --- a/proto-google-cloud-functions-v1/src/main/java/com/google/cloud/functions/v1/FunctionsProto.java +++ b/proto-google-cloud-functions-v1/src/main/java/com/google/cloud/functions/v1/FunctionsProto.java @@ -165,104 +165,108 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "jects/{project}/locations/{location}/fun" + "ctions/{function}B\r\n\013source_codeB\t\n\007trig" + "ger\":\n\020SourceRepository\022\013\n\003url\030\001 \001(\t\022\031\n\014" - + "deployed_url\030\002 \001(\tB\003\340A\003\" \n\014HttpsTrigger\022" - + "\020\n\003url\030\001 \001(\tB\003\340A\003\"\207\001\n\014EventTrigger\022\022\n\nev" - + "ent_type\030\001 \001(\t\022\020\n\010resource\030\002 \001(\t\022\017\n\007serv" - + "ice\030\003 \001(\t\022@\n\016failure_policy\030\005 \001(\0132(.goog" - + "le.cloud.functions.v1.FailurePolicy\"c\n\rF" - + "ailurePolicy\022?\n\005retry\030\001 \001(\0132..google.clo" - + "ud.functions.v1.FailurePolicy.RetryH\000\032\007\n" - + "\005RetryB\010\n\006action\"\225\001\n\025CreateFunctionReque" - + "st\022;\n\010location\030\001 \001(\tB)\340A\002\372A#\n!locations." - + "googleapis.com/Location\022?\n\010function\030\002 \001(" - + "\0132(.google.cloud.functions.v1.CloudFunct" - + "ionB\003\340A\002\"\211\001\n\025UpdateFunctionRequest\022?\n\010fu" - + "nction\030\001 \001(\0132(.google.cloud.functions.v1" - + ".CloudFunctionB\003\340A\002\022/\n\013update_mask\030\002 \001(\013" - + "2\032.google.protobuf.FieldMask\"W\n\022GetFunct" - + "ionRequest\022A\n\004name\030\001 \001(\tB3\340A\002\372A-\n+cloudf" - + "unctions.googleapis.com/CloudFunction\"u\n" - + "\024ListFunctionsRequest\0226\n\006parent\030\001 \001(\tB&\372" - + "A#\n!locations.googleapis.com/Location\022\021\n" - + "\tpage_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\"\202\001\n" - + "\025ListFunctionsResponse\022;\n\tfunctions\030\001 \003(" - + "\0132(.google.cloud.functions.v1.CloudFunct" - + "ion\022\027\n\017next_page_token\030\002 \001(\t\022\023\n\013unreacha" - + "ble\030\003 \003(\t\"Z\n\025DeleteFunctionRequest\022A\n\004na" - + "me\030\001 \001(\tB3\340A\002\372A-\n+cloudfunctions.googlea" - + "pis.com/CloudFunction\"k\n\023CallFunctionReq" - + "uest\022A\n\004name\030\001 \001(\tB3\340A\002\372A-\n+cloudfunctio" - + "ns.googleapis.com/CloudFunction\022\021\n\004data\030" - + "\002 \001(\tB\003\340A\002\"K\n\024CallFunctionResponse\022\024\n\014ex" - + "ecution_id\030\001 \001(\t\022\016\n\006result\030\002 \001(\t\022\r\n\005erro" - + "r\030\003 \001(\t\"*\n\030GenerateUploadUrlRequest\022\016\n\006p" - + "arent\030\001 \001(\t\"/\n\031GenerateUploadUrlResponse" - + "\022\022\n\nupload_url\030\001 \001(\t\">\n\032GenerateDownload" - + "UrlRequest\022\014\n\004name\030\001 \001(\t\022\022\n\nversion_id\030\002" - + " \001(\004\"3\n\033GenerateDownloadUrlResponse\022\024\n\014d" - + "ownload_url\030\001 \001(\t*\222\001\n\023CloudFunctionStatu" - + "s\022%\n!CLOUD_FUNCTION_STATUS_UNSPECIFIED\020\000" - + "\022\n\n\006ACTIVE\020\001\022\013\n\007OFFLINE\020\002\022\026\n\022DEPLOY_IN_P" - + "ROGRESS\020\003\022\026\n\022DELETE_IN_PROGRESS\020\004\022\013\n\007UNK" - + "NOWN\020\0052\227\021\n\025CloudFunctionsService\022\251\001\n\rLis" - + "tFunctions\022/.google.cloud.functions.v1.L" - + "istFunctionsRequest\0320.google.cloud.funct" - + "ions.v1.ListFunctionsResponse\"5\202\323\344\223\002/\022-/" - + "v1/{parent=projects/*/locations/*}/funct" - + "ions\022\244\001\n\013GetFunction\022-.google.cloud.func" - + "tions.v1.GetFunctionRequest\032(.google.clo" - + "ud.functions.v1.CloudFunction\"<\202\323\344\223\002/\022-/" - + "v1/{name=projects/*/locations/*/function" - + "s/*}\332A\004name\022\337\001\n\016CreateFunction\0220.google." - + "cloud.functions.v1.CreateFunctionRequest" - + "\032\035.google.longrunning.Operation\"|\202\323\344\223\002;\"" - + "//v1/{location=projects/*/locations/*}/f" - + "unctions:\010function\332A\021location,function\312A" - + "$\n\rCloudFunction\022\023OperationMetadataV1\022\335\001" - + "\n\016UpdateFunction\0220.google.cloud.function" - + "s.v1.UpdateFunctionRequest\032\035.google.long" - + "running.Operation\"z\202\323\344\223\002B26/v1/{function" - + ".name=projects/*/locations/*/functions/*" - + "}:\010function\332A\010function\312A$\n\rCloudFunction" - + "\022\023OperationMetadataV1\022\316\001\n\016DeleteFunction" - + "\0220.google.cloud.functions.v1.DeleteFunct" - + "ionRequest\032\035.google.longrunning.Operatio" - + "n\"k\202\323\344\223\002/*-/v1/{name=projects/*/location" - + "s/*/functions/*}\332A\004name\312A,\n\025google.proto" - + "buf.Empty\022\023OperationMetadataV1\022\272\001\n\014CallF" - + "unction\022..google.cloud.functions.v1.Call" - + "FunctionRequest\032/.google.cloud.functions" - + ".v1.CallFunctionResponse\"I\202\323\344\223\0027\"2/v1/{n" - + "ame=projects/*/locations/*/functions/*}:" - + "call:\001*\332A\tname,data\022\312\001\n\021GenerateUploadUr" - + "l\0223.google.cloud.functions.v1.GenerateUp" - + "loadUrlRequest\0324.google.cloud.functions." - + "v1.GenerateUploadUrlResponse\"J\202\323\344\223\002D\"?/v" - + "1/{parent=projects/*/locations/*}/functi" - + "ons:generateUploadUrl:\001*\022\322\001\n\023GenerateDow" - + "nloadUrl\0225.google.cloud.functions.v1.Gen" - + "erateDownloadUrlRequest\0326.google.cloud.f" - + "unctions.v1.GenerateDownloadUrlResponse\"" - + "L\202\323\344\223\002F\"A/v1/{name=projects/*/locations/" - + "*/functions/*}:generateDownloadUrl:\001*\022\224\001" - + "\n\014SetIamPolicy\022\".google.iam.v1.SetIamPol" - + "icyRequest\032\025.google.iam.v1.Policy\"I\202\323\344\223\002" - + "C\">/v1/{resource=projects/*/locations/*/" - + "functions/*}:setIamPolicy:\001*\022\221\001\n\014GetIamP" - + "olicy\022\".google.iam.v1.GetIamPolicyReques" - + "t\032\025.google.iam.v1.Policy\"F\202\323\344\223\002@\022>/v1/{r" - + "esource=projects/*/locations/*/functions" - + "/*}:getIamPolicy\022\272\001\n\022TestIamPermissions\022" - + "(.google.iam.v1.TestIamPermissionsReques" - + "t\032).google.iam.v1.TestIamPermissionsResp" - + "onse\"O\202\323\344\223\002I\"D/v1/{resource=projects/*/l" - + "ocations/*/functions/*}:testIamPermissio" - + "ns:\001*\032Q\312A\035cloudfunctions.googleapis.com\322" - + "A.https://www.googleapis.com/auth/cloud-" - + "platformB{\n\035com.google.cloud.functions.v" - + "1B\016FunctionsProtoP\001ZBgoogle.golang.org/g" - + "enproto/googleapis/cloud/functions/v1;fu" - + "nctions\242\002\003GCFb\006proto3" + + "deployed_url\030\002 \001(\tB\003\340A\003\"\310\001\n\014HttpsTrigger" + + "\022\020\n\003url\030\001 \001(\tB\003\340A\003\022M\n\016security_level\030\002 \001" + + "(\01625.google.cloud.functions.v1.HttpsTrig" + + "ger.SecurityLevel\"W\n\rSecurityLevel\022\036\n\032SE" + + "CURITY_LEVEL_UNSPECIFIED\020\000\022\021\n\rSECURE_ALW" + + "AYS\020\001\022\023\n\017SECURE_OPTIONAL\020\002\"\207\001\n\014EventTrig" + + "ger\022\022\n\nevent_type\030\001 \001(\t\022\020\n\010resource\030\002 \001(" + + "\t\022\017\n\007service\030\003 \001(\t\022@\n\016failure_policy\030\005 \001" + + "(\0132(.google.cloud.functions.v1.FailurePo" + + "licy\"c\n\rFailurePolicy\022?\n\005retry\030\001 \001(\0132..g" + + "oogle.cloud.functions.v1.FailurePolicy.R" + + "etryH\000\032\007\n\005RetryB\010\n\006action\"\225\001\n\025CreateFunc" + + "tionRequest\022;\n\010location\030\001 \001(\tB)\340A\002\372A#\n!l" + + "ocations.googleapis.com/Location\022?\n\010func" + + "tion\030\002 \001(\0132(.google.cloud.functions.v1.C" + + "loudFunctionB\003\340A\002\"\211\001\n\025UpdateFunctionRequ" + + "est\022?\n\010function\030\001 \001(\0132(.google.cloud.fun" + + "ctions.v1.CloudFunctionB\003\340A\002\022/\n\013update_m" + + "ask\030\002 \001(\0132\032.google.protobuf.FieldMask\"W\n" + + "\022GetFunctionRequest\022A\n\004name\030\001 \001(\tB3\340A\002\372A" + + "-\n+cloudfunctions.googleapis.com/CloudFu" + + "nction\"u\n\024ListFunctionsRequest\0226\n\006parent" + + "\030\001 \001(\tB&\372A#\n!locations.googleapis.com/Lo" + + "cation\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_token\030" + + "\003 \001(\t\"\202\001\n\025ListFunctionsResponse\022;\n\tfunct" + + "ions\030\001 \003(\0132(.google.cloud.functions.v1.C" + + "loudFunction\022\027\n\017next_page_token\030\002 \001(\t\022\023\n" + + "\013unreachable\030\003 \003(\t\"Z\n\025DeleteFunctionRequ" + + "est\022A\n\004name\030\001 \001(\tB3\340A\002\372A-\n+cloudfunction" + + "s.googleapis.com/CloudFunction\"k\n\023CallFu" + + "nctionRequest\022A\n\004name\030\001 \001(\tB3\340A\002\372A-\n+clo" + + "udfunctions.googleapis.com/CloudFunction" + + "\022\021\n\004data\030\002 \001(\tB\003\340A\002\"K\n\024CallFunctionRespo" + + "nse\022\024\n\014execution_id\030\001 \001(\t\022\016\n\006result\030\002 \001(" + + "\t\022\r\n\005error\030\003 \001(\t\"*\n\030GenerateUploadUrlReq" + + "uest\022\016\n\006parent\030\001 \001(\t\"/\n\031GenerateUploadUr" + + "lResponse\022\022\n\nupload_url\030\001 \001(\t\">\n\032Generat" + + "eDownloadUrlRequest\022\014\n\004name\030\001 \001(\t\022\022\n\nver" + + "sion_id\030\002 \001(\004\"3\n\033GenerateDownloadUrlResp" + + "onse\022\024\n\014download_url\030\001 \001(\t*\222\001\n\023CloudFunc" + + "tionStatus\022%\n!CLOUD_FUNCTION_STATUS_UNSP" + + "ECIFIED\020\000\022\n\n\006ACTIVE\020\001\022\013\n\007OFFLINE\020\002\022\026\n\022DE" + + "PLOY_IN_PROGRESS\020\003\022\026\n\022DELETE_IN_PROGRESS" + + "\020\004\022\013\n\007UNKNOWN\020\0052\227\021\n\025CloudFunctionsServic" + + "e\022\251\001\n\rListFunctions\022/.google.cloud.funct" + + "ions.v1.ListFunctionsRequest\0320.google.cl" + + "oud.functions.v1.ListFunctionsResponse\"5" + + "\202\323\344\223\002/\022-/v1/{parent=projects/*/locations" + + "/*}/functions\022\244\001\n\013GetFunction\022-.google.c" + + "loud.functions.v1.GetFunctionRequest\032(.g" + + "oogle.cloud.functions.v1.CloudFunction\"<" + + "\202\323\344\223\002/\022-/v1/{name=projects/*/locations/*" + + "/functions/*}\332A\004name\022\337\001\n\016CreateFunction\022" + + "0.google.cloud.functions.v1.CreateFuncti" + + "onRequest\032\035.google.longrunning.Operation" + + "\"|\202\323\344\223\002;\"//v1/{location=projects/*/locat" + + "ions/*}/functions:\010function\332A\021location,f" + + "unction\312A$\n\rCloudFunction\022\023OperationMeta" + + "dataV1\022\335\001\n\016UpdateFunction\0220.google.cloud" + + ".functions.v1.UpdateFunctionRequest\032\035.go" + + "ogle.longrunning.Operation\"z\202\323\344\223\002B26/v1/" + + "{function.name=projects/*/locations/*/fu" + + "nctions/*}:\010function\332A\010function\312A$\n\rClou" + + "dFunction\022\023OperationMetadataV1\022\316\001\n\016Delet" + + "eFunction\0220.google.cloud.functions.v1.De" + + "leteFunctionRequest\032\035.google.longrunning" + + ".Operation\"k\202\323\344\223\002/*-/v1/{name=projects/*" + + "/locations/*/functions/*}\332A\004name\312A,\n\025goo" + + "gle.protobuf.Empty\022\023OperationMetadataV1\022" + + "\272\001\n\014CallFunction\022..google.cloud.function" + + "s.v1.CallFunctionRequest\032/.google.cloud." + + "functions.v1.CallFunctionResponse\"I\202\323\344\223\002" + + "7\"2/v1/{name=projects/*/locations/*/func" + + "tions/*}:call:\001*\332A\tname,data\022\312\001\n\021Generat" + + "eUploadUrl\0223.google.cloud.functions.v1.G" + + "enerateUploadUrlRequest\0324.google.cloud.f" + + "unctions.v1.GenerateUploadUrlResponse\"J\202" + + "\323\344\223\002D\"?/v1/{parent=projects/*/locations/" + + "*}/functions:generateUploadUrl:\001*\022\322\001\n\023Ge" + + "nerateDownloadUrl\0225.google.cloud.functio" + + "ns.v1.GenerateDownloadUrlRequest\0326.googl" + + "e.cloud.functions.v1.GenerateDownloadUrl" + + "Response\"L\202\323\344\223\002F\"A/v1/{name=projects/*/l" + + "ocations/*/functions/*}:generateDownload" + + "Url:\001*\022\224\001\n\014SetIamPolicy\022\".google.iam.v1." + + "SetIamPolicyRequest\032\025.google.iam.v1.Poli" + + "cy\"I\202\323\344\223\002C\">/v1/{resource=projects/*/loc" + + "ations/*/functions/*}:setIamPolicy:\001*\022\221\001" + + "\n\014GetIamPolicy\022\".google.iam.v1.GetIamPol" + + "icyRequest\032\025.google.iam.v1.Policy\"F\202\323\344\223\002" + + "@\022>/v1/{resource=projects/*/locations/*/" + + "functions/*}:getIamPolicy\022\272\001\n\022TestIamPer" + + "missions\022(.google.iam.v1.TestIamPermissi" + + "onsRequest\032).google.iam.v1.TestIamPermis" + + "sionsResponse\"O\202\323\344\223\002I\"D/v1/{resource=pro" + + "jects/*/locations/*/functions/*}:testIam" + + "Permissions:\001*\032Q\312A\035cloudfunctions.google" + + "apis.com\322A.https://www.googleapis.com/au" + + "th/cloud-platformB{\n\035com.google.cloud.fu" + + "nctions.v1B\016FunctionsProtoP\001ZBgoogle.gol" + + "ang.org/genproto/googleapis/cloud/functi" + + "ons/v1;functions\242\002\003GCFb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -341,7 +345,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_functions_v1_HttpsTrigger_descriptor, new java.lang.String[] { - "Url", + "Url", "SecurityLevel", }); internal_static_google_cloud_functions_v1_EventTrigger_descriptor = getDescriptor().getMessageTypes().get(3); diff --git a/proto-google-cloud-functions-v1/src/main/java/com/google/cloud/functions/v1/HttpsTrigger.java b/proto-google-cloud-functions-v1/src/main/java/com/google/cloud/functions/v1/HttpsTrigger.java index f269fa3c..492fcc76 100644 --- a/proto-google-cloud-functions-v1/src/main/java/com/google/cloud/functions/v1/HttpsTrigger.java +++ b/proto-google-cloud-functions-v1/src/main/java/com/google/cloud/functions/v1/HttpsTrigger.java @@ -39,6 +39,7 @@ private HttpsTrigger(com.google.protobuf.GeneratedMessageV3.Builder builder) private HttpsTrigger() { url_ = ""; + securityLevel_ = 0; } @java.lang.Override @@ -77,6 +78,13 @@ private HttpsTrigger( url_ = s; break; } + case 16: + { + int rawValue = input.readEnum(); + + securityLevel_ = rawValue; + break; + } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { @@ -111,6 +119,173 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.cloud.functions.v1.HttpsTrigger.Builder.class); } + /** + * + * + *
+   * Available security level settings.
+   * This controls the methods to enforce security (HTTPS) on a URL.
+   * If unspecified, SECURE_OPTIONAL will be used.
+   * 
+ * + * Protobuf enum {@code google.cloud.functions.v1.HttpsTrigger.SecurityLevel} + */ + public enum SecurityLevel implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Unspecified.
+     * 
+ * + * SECURITY_LEVEL_UNSPECIFIED = 0; + */ + SECURITY_LEVEL_UNSPECIFIED(0), + /** + * + * + *
+     * Requests for a URL that match this handler that do not use HTTPS are
+     * automatically redirected to the HTTPS URL with the same path. Query
+     * parameters are reserved for the redirect.
+     * 
+ * + * SECURE_ALWAYS = 1; + */ + SECURE_ALWAYS(1), + /** + * + * + *
+     * Both HTTP and HTTPS requests with URLs that match the handler succeed
+     * without redirects. The application can examine the request to determine
+     * which protocol was used and respond accordingly.
+     * 
+ * + * SECURE_OPTIONAL = 2; + */ + SECURE_OPTIONAL(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Unspecified.
+     * 
+ * + * SECURITY_LEVEL_UNSPECIFIED = 0; + */ + public static final int SECURITY_LEVEL_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Requests for a URL that match this handler that do not use HTTPS are
+     * automatically redirected to the HTTPS URL with the same path. Query
+     * parameters are reserved for the redirect.
+     * 
+ * + * SECURE_ALWAYS = 1; + */ + public static final int SECURE_ALWAYS_VALUE = 1; + /** + * + * + *
+     * Both HTTP and HTTPS requests with URLs that match the handler succeed
+     * without redirects. The application can examine the request to determine
+     * which protocol was used and respond accordingly.
+     * 
+ * + * SECURE_OPTIONAL = 2; + */ + public static final int SECURE_OPTIONAL_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static SecurityLevel valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static SecurityLevel forNumber(int value) { + switch (value) { + case 0: + return SECURITY_LEVEL_UNSPECIFIED; + case 1: + return SECURE_ALWAYS; + case 2: + return SECURE_OPTIONAL; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public SecurityLevel findValueByNumber(int number) { + return SecurityLevel.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.functions.v1.HttpsTrigger.getDescriptor().getEnumTypes().get(0); + } + + private static final SecurityLevel[] VALUES = values(); + + public static SecurityLevel valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private SecurityLevel(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.functions.v1.HttpsTrigger.SecurityLevel) + } + public static final int URL_FIELD_NUMBER = 1; private volatile java.lang.Object url_; /** @@ -160,6 +335,44 @@ public com.google.protobuf.ByteString getUrlBytes() { } } + public static final int SECURITY_LEVEL_FIELD_NUMBER = 2; + private int securityLevel_; + /** + * + * + *
+   * The security level for the function.
+   * 
+ * + * .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + * + * @return The enum numeric value on the wire for securityLevel. + */ + @java.lang.Override + public int getSecurityLevelValue() { + return securityLevel_; + } + /** + * + * + *
+   * The security level for the function.
+   * 
+ * + * .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + * + * @return The securityLevel. + */ + @java.lang.Override + public com.google.cloud.functions.v1.HttpsTrigger.SecurityLevel getSecurityLevel() { + @SuppressWarnings("deprecation") + com.google.cloud.functions.v1.HttpsTrigger.SecurityLevel result = + com.google.cloud.functions.v1.HttpsTrigger.SecurityLevel.valueOf(securityLevel_); + return result == null + ? com.google.cloud.functions.v1.HttpsTrigger.SecurityLevel.UNRECOGNIZED + : result; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -177,6 +390,11 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!getUrlBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, url_); } + if (securityLevel_ + != com.google.cloud.functions.v1.HttpsTrigger.SecurityLevel.SECURITY_LEVEL_UNSPECIFIED + .getNumber()) { + output.writeEnum(2, securityLevel_); + } unknownFields.writeTo(output); } @@ -189,6 +407,11 @@ public int getSerializedSize() { if (!getUrlBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, url_); } + if (securityLevel_ + != com.google.cloud.functions.v1.HttpsTrigger.SecurityLevel.SECURITY_LEVEL_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, securityLevel_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -206,6 +429,7 @@ public boolean equals(final java.lang.Object obj) { (com.google.cloud.functions.v1.HttpsTrigger) obj; if (!getUrl().equals(other.getUrl())) return false; + if (securityLevel_ != other.securityLevel_) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -219,6 +443,8 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + URL_FIELD_NUMBER; hash = (53 * hash) + getUrl().hashCode(); + hash = (37 * hash) + SECURITY_LEVEL_FIELD_NUMBER; + hash = (53 * hash) + securityLevel_; hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -366,6 +592,8 @@ public Builder clear() { super.clear(); url_ = ""; + securityLevel_ = 0; + return this; } @@ -394,6 +622,7 @@ public com.google.cloud.functions.v1.HttpsTrigger buildPartial() { com.google.cloud.functions.v1.HttpsTrigger result = new com.google.cloud.functions.v1.HttpsTrigger(this); result.url_ = url_; + result.securityLevel_ = securityLevel_; onBuilt(); return result; } @@ -447,6 +676,9 @@ public Builder mergeFrom(com.google.cloud.functions.v1.HttpsTrigger other) { url_ = other.url_; onChanged(); } + if (other.securityLevel_ != 0) { + setSecurityLevelValue(other.getSecurityLevelValue()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -582,6 +814,100 @@ public Builder setUrlBytes(com.google.protobuf.ByteString value) { return this; } + private int securityLevel_ = 0; + /** + * + * + *
+     * The security level for the function.
+     * 
+ * + * .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + * + * @return The enum numeric value on the wire for securityLevel. + */ + @java.lang.Override + public int getSecurityLevelValue() { + return securityLevel_; + } + /** + * + * + *
+     * The security level for the function.
+     * 
+ * + * .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + * + * @param value The enum numeric value on the wire for securityLevel to set. + * @return This builder for chaining. + */ + public Builder setSecurityLevelValue(int value) { + + securityLevel_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The security level for the function.
+     * 
+ * + * .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + * + * @return The securityLevel. + */ + @java.lang.Override + public com.google.cloud.functions.v1.HttpsTrigger.SecurityLevel getSecurityLevel() { + @SuppressWarnings("deprecation") + com.google.cloud.functions.v1.HttpsTrigger.SecurityLevel result = + com.google.cloud.functions.v1.HttpsTrigger.SecurityLevel.valueOf(securityLevel_); + return result == null + ? com.google.cloud.functions.v1.HttpsTrigger.SecurityLevel.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The security level for the function.
+     * 
+ * + * .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + * + * @param value The securityLevel to set. + * @return This builder for chaining. + */ + public Builder setSecurityLevel( + com.google.cloud.functions.v1.HttpsTrigger.SecurityLevel value) { + if (value == null) { + throw new NullPointerException(); + } + + securityLevel_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The security level for the function.
+     * 
+ * + * .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + * + * @return This builder for chaining. + */ + public Builder clearSecurityLevel() { + + securityLevel_ = 0; + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-functions-v1/src/main/java/com/google/cloud/functions/v1/HttpsTriggerOrBuilder.java b/proto-google-cloud-functions-v1/src/main/java/com/google/cloud/functions/v1/HttpsTriggerOrBuilder.java index 4c15fb07..6b44c857 100644 --- a/proto-google-cloud-functions-v1/src/main/java/com/google/cloud/functions/v1/HttpsTriggerOrBuilder.java +++ b/proto-google-cloud-functions-v1/src/main/java/com/google/cloud/functions/v1/HttpsTriggerOrBuilder.java @@ -47,4 +47,29 @@ public interface HttpsTriggerOrBuilder * @return The bytes for url. */ com.google.protobuf.ByteString getUrlBytes(); + + /** + * + * + *
+   * The security level for the function.
+   * 
+ * + * .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + * + * @return The enum numeric value on the wire for securityLevel. + */ + int getSecurityLevelValue(); + /** + * + * + *
+   * The security level for the function.
+   * 
+ * + * .google.cloud.functions.v1.HttpsTrigger.SecurityLevel security_level = 2; + * + * @return The securityLevel. + */ + com.google.cloud.functions.v1.HttpsTrigger.SecurityLevel getSecurityLevel(); } diff --git a/proto-google-cloud-functions-v1/src/main/proto/google/cloud/functions/v1/functions.proto b/proto-google-cloud-functions-v1/src/main/proto/google/cloud/functions/v1/functions.proto index 98a6d536..049378ab 100644 --- a/proto-google-cloud-functions-v1/src/main/proto/google/cloud/functions/v1/functions.proto +++ b/proto-google-cloud-functions-v1/src/main/proto/google/cloud/functions/v1/functions.proto @@ -375,8 +375,31 @@ message SourceRepository { // Describes HttpsTrigger, could be used to connect web hooks to function. message HttpsTrigger { + // Available security level settings. + // + // This controls the methods to enforce security (HTTPS) on a URL. + // + // If unspecified, SECURE_OPTIONAL will be used. + enum SecurityLevel { + // Unspecified. + SECURITY_LEVEL_UNSPECIFIED = 0; + + // Requests for a URL that match this handler that do not use HTTPS are + // automatically redirected to the HTTPS URL with the same path. Query + // parameters are reserved for the redirect. + SECURE_ALWAYS = 1; + + // Both HTTP and HTTPS requests with URLs that match the handler succeed + // without redirects. The application can examine the request to determine + // which protocol was used and respond accordingly. + SECURE_OPTIONAL = 2; + } + // Output only. The deployed url for the function. string url = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The security level for the function. + SecurityLevel security_level = 2; } // Describes EventTrigger, used to request events be sent from another