Lambda¶
Utilities for working with AWS Lambda.
call_lambda_function_url ¶
call_lambda_function_url(
function_name,
payload=None,
region=None,
headers=None,
auth=None,
**request_kwargs
)
Call a Lambda function via its function URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
function_name
|
Union[LambdaFunctionName, LambdaFunctionUrl, str]
|
The function name, ARN, or URL to call. |
required |
payload
|
Optional[Union[ModelProtocol, dict, str, bytes]]
|
Request payload. |
None
|
region
|
Optional[AWSRegion]
|
AWS region. Defaults to None. |
None
|
headers
|
Optional[dict]
|
Optional HTTP headers. |
None
|
auth
|
Optional[AuthBase]
|
Authentication handler. Defaults to IAM auth. |
None
|
**request_kwargs
|
Additional arguments passed to the requests library. |
{}
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the function name/URL is invalid or function not found. |
Returns:
| Type | Description |
|---|---|
Union[dict, str, None]
|
The response as dict (if JSON) or str, or None on error. |
Source code in src/aibs_informatics_aws_utils/lambda_.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
get_lambda_function_file_systems ¶
get_lambda_function_file_systems(
function_name, region=None
)
Get the file system configurations for a Lambda function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
function_name
|
Union[LambdaFunctionName, str]
|
The name or ARN of the function. |
required |
region
|
Optional[AWSRegion]
|
AWS region. Defaults to None (uses default region). |
None
|
Returns:
| Type | Description |
|---|---|
List[FileSystemConfigTypeDef]
|
List of file system configurations (EFS mount points). |
Source code in src/aibs_informatics_aws_utils/lambda_.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
get_lambda_function_url ¶
get_lambda_function_url(function_name, region=None)
Get the function URL for a Lambda function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
function_name
|
Union[LambdaFunctionName, str]
|
The name or ARN of the Lambda function. |
required |
region
|
Optional[AWSRegion]
|
AWS region. Defaults to None (uses default region). |
None
|
Returns:
| Type | Description |
|---|---|
Optional[LambdaFunctionUrl]
|
The function URL if configured, otherwise None. |
Source code in src/aibs_informatics_aws_utils/lambda_.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |