File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -254,7 +254,7 @@ class RuntimeOptions:
254254 to the value "gcf_gen1"
255255 """
256256
257- vpc_connector : str | _util .Sentinel | None = None
257+ vpc_connector : str | Expression [ str ] | _util .Sentinel | None = None
258258 """
259259 Connect function to specified VPC connector.
260260 A value of ``RESET_VALUE`` removes the VPC connector.
Original file line number Diff line number Diff line change @@ -196,3 +196,22 @@ def test_invoker_with_no_element_throws():
196196 AssertionError , match = "HttpsOptions: Invalid option for invoker - must be a non-empty list."
197197 ):
198198 options .HttpsOptions (invoker = [])._endpoint (func_name = "test" )
199+
200+
201+ def test_vpc_connector_accepts_string_param ():
202+ vpc_param = params .StringParam ("VPC_CONNECTOR" )
203+
204+ https_options = options .HttpsOptions (vpc_connector = vpc_param )
205+ https_options_dict = https_options ._asdict_with_global_options ()
206+
207+ # The options dict should contain the CEL string representation for the param.
208+ assert https_options_dict ["vpc_connector" ] == f"{ vpc_param } " , (
209+ "vpc_connector param was not converted to CEL string"
210+ )
211+
212+ # The generated endpoint should map the resolved vpc_connector into the vpc block.
213+ endpoint = https_options ._endpoint (func_name = "test_vpc" )
214+ assert endpoint .vpc is not None , "vpc block was not set on endpoint"
215+ assert endpoint .vpc ["connector" ] == f"{ vpc_param } " , (
216+ "vpc connector was not set from vpc_connector Expression[str]"
217+ )
You can’t perform that action at this time.
0 commit comments