How to use update_function_url_config method in localstack

Best Python code snippet using localstack_python

client.pyi

Source:client.pyi Github

copy

Full Screen

...884 or alias.885 [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/1.24.58/reference/services/lambda.html#Lambda.Client.update_function_event_invoke_config)886 [Show boto3-stubs documentation](https://vemel.github.io/boto3_stubs_docs/mypy_boto3_lambda/client.html#update_function_event_invoke_config)887 """888 def update_function_url_config(889 self,890 *,891 FunctionName: str,892 Qualifier: str = None,893 AuthType: FunctionUrlAuthTypeType = None,894 Cors: "CorsTypeDef" = None895 ) -> UpdateFunctionUrlConfigResponseTypeDef:896 """897 Updates the configuration for a Lambda function URL.898 [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/1.24.58/reference/services/lambda.html#Lambda.Client.update_function_url_config)899 [Show boto3-stubs documentation](https://vemel.github.io/boto3_stubs_docs/mypy_boto3_lambda/client.html#update_function_url_config)900 """901 @overload902 def get_paginator(self, operation_name: Literal["list_aliases"]) -> ListAliasesPaginator:...

Full Screen

Full Screen

responses.py

Source:responses.py Github

copy

Full Screen

...169 return self._get_function_url_config()170 elif http_method == "POST":171 return self._create_function_url_config()172 elif http_method == "PUT":173 return self._update_function_url_config()174 def _add_policy(self, request):175 path = request.path if hasattr(request, "path") else path_url(request.url)176 function_name = unquote(path.split("/")[-2])177 qualifier = self.querystring.get("Qualifier", [None])[0]178 statement = self.body179 self.backend.add_permission(function_name, qualifier, statement)180 return 200, {}, json.dumps({"Statement": statement})181 def _get_policy(self, request):182 path = request.path if hasattr(request, "path") else path_url(request.url)183 function_name = unquote(path.split("/")[-2])184 out = self.backend.get_policy(function_name)185 return 200, {}, out186 def _del_policy(self, request, querystring):187 path = request.path if hasattr(request, "path") else path_url(request.url)188 function_name = unquote(path.split("/")[-3])189 statement_id = path.split("/")[-1].split("?")[0]190 revision = querystring.get("RevisionId", "")191 if self.backend.get_function(function_name):192 self.backend.remove_permission(function_name, statement_id, revision)193 return 204, {}, "{}"194 else:195 return 404, {}, "{}"196 def _invoke(self, request):197 response_headers = {}198 # URL Decode in case it's a ARN:199 function_name = unquote(self.path.rsplit("/", 2)[-2])200 qualifier = self._get_param("qualifier")201 payload = self.backend.invoke(202 function_name, qualifier, self.body, self.headers, response_headers203 )204 if payload:205 if request.headers.get("X-Amz-Invocation-Type") != "Event":206 if sys.getsizeof(payload) > 6000000:207 response_headers["Content-Length"] = "142"208 response_headers["x-amz-function-error"] = "Unhandled"209 error_dict = {210 "errorMessage": "Response payload size exceeded maximum allowed payload size (6291556 bytes).",211 "errorType": "Function.ResponseSizeTooLarge",212 }213 payload = json.dumps(error_dict).encode("utf-8")214 response_headers["content-type"] = "application/json"215 if request.headers.get("X-Amz-Invocation-Type") == "Event":216 status_code = 202217 elif request.headers.get("X-Amz-Invocation-Type") == "DryRun":218 status_code = 204219 else:220 if request.headers.get("X-Amz-Log-Type") != "Tail":221 del response_headers["x-amz-log-result"]222 status_code = 200223 return status_code, response_headers, payload224 else:225 return 404, response_headers, "{}"226 def _invoke_async(self):227 response_headers = {}228 function_name = unquote(self.path.rsplit("/", 3)[-3])229 fn = self.backend.get_function(function_name, None)230 payload = fn.invoke(self.body, self.headers, response_headers)231 response_headers["Content-Length"] = str(len(payload))232 return 202, response_headers, payload233 def _list_functions(self):234 querystring = self.querystring235 func_version = querystring.get("FunctionVersion", [None])[0]236 result = {"Functions": []}237 for fn in self.backend.list_functions(func_version):238 json_data = fn.get_configuration()239 result["Functions"].append(json_data)240 return 200, {}, json.dumps(result)241 def _list_versions_by_function(self, function_name):242 result = {"Versions": []}243 functions = self.backend.list_versions_by_function(function_name)244 if functions:245 for fn in functions:246 json_data = fn.get_configuration()247 result["Versions"].append(json_data)248 return 200, {}, json.dumps(result)249 def _create_function(self):250 fn = self.backend.create_function(self.json_body)251 config = fn.get_configuration(on_create=True)252 return 201, {}, json.dumps(config)253 def _create_function_url_config(self):254 function_name = unquote(self.path.split("/")[-2])255 config = self.backend.create_function_url_config(function_name, self.json_body)256 return 201, {}, json.dumps(config.to_dict())257 def _delete_function_url_config(self):258 function_name = unquote(self.path.split("/")[-2])259 self.backend.delete_function_url_config(function_name)260 return 204, {}, "{}"261 def _get_function_url_config(self):262 function_name = unquote(self.path.split("/")[-2])263 config = self.backend.get_function_url_config(function_name)264 return 201, {}, json.dumps(config.to_dict())265 def _update_function_url_config(self):266 function_name = unquote(self.path.split("/")[-2])267 config = self.backend.update_function_url_config(function_name, self.json_body)268 return 200, {}, json.dumps(config.to_dict())269 def _create_event_source_mapping(self):270 fn = self.backend.create_event_source_mapping(self.json_body)271 config = fn.get_configuration()272 return 201, {}, json.dumps(config)273 def _list_event_source_mappings(self, event_source_arn, function_name):274 esms = self.backend.list_event_source_mappings(event_source_arn, function_name)275 result = {"EventSourceMappings": [esm.get_configuration() for esm in esms]}276 return 200, {}, json.dumps(result)277 def _get_event_source_mapping(self, uuid):278 result = self.backend.get_event_source_mapping(uuid)279 if result:280 return 200, {}, json.dumps(result.get_configuration())281 else:...

Full Screen

Full Screen

test_lambda_function_urls.py

Source:test_lambda_function_urls.py Github

copy

Full Screen

...84 "ExposeHeaders": ["date", "keep-alive"],85 "MaxAge": 86400,86 },87 )88 resp = client.update_function_url_config(89 FunctionName=name_or_arn, AuthType="NONE", Cors={"AllowCredentials": False}90 )91 resp.should.have.key("Cors").equals({"AllowCredentials": False})92@mock_lambda93@pytest.mark.parametrize("key", ["FunctionName", "FunctionArn"])94def test_delete_function_url_config(key):95 client = boto3.client("lambda", "us-east-2")96 function_name = str(uuid4())[0:6]97 fxn = client.create_function(98 FunctionName=function_name,99 Runtime="python3.7",100 Role=get_role_name(),101 Handler="lambda_function.lambda_handler",102 Code={"ZipFile": get_test_zip_file1()},...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful