MCPcopy Create free account
hub / github.com/aws-samples/aws-cdk-examples / main

Function main

python/url-shortener/lambda/handler.py:12–29  ·  view source on GitHub ↗
(event, context)

Source from the content-addressed store, hash-verified

10
11
12def main(event, context):
13 LOG.info("EVENT: " + json.dumps(event))
14
15 query_string_params = event["queryStringParameters"]
16 if query_string_params is not None:
17 target_url = query_string_params['targetUrl']
18 if target_url is not None:
19 return create_short_url(event)
20
21 path_parameters = event['pathParameters']
22 if path_parameters is not None:
23 if path_parameters['proxy'] is not None:
24 return read_short_url(event)
25
26 return {
27 'statusCode': 200,
28 'body': 'usage: ?targetUrl=URL'
29 }
30
31
32def create_short_url(event):

Callers

nothing calls this directly

Calls 2

create_short_urlFunction · 0.85
read_short_urlFunction · 0.85

Tested by

no test coverage detected