1010from osbot_utils .decorators .methods .cache_on_self import cache_on_self
1111from osbot_utils .helpers .Safe_Id import Safe_Id
1212from osbot_utils .type_safe .Type_Safe import Type_Safe
13- from osbot_fast_api_serverless .fast_api .lambda_handler import run , LAMBDA_DEPENDENCIES
1413from osbot_fast_api_serverless .deploy .Schema__AWS_Setup__Serverless__Fast_API import Schema__AWS_Setup__Serverless__Fast_API
1514
1615BASE__LAMBDA_NAME__FAST_API__SERVERLESS = 'fast-api__serverless' # make this a Safe_Str__Lambda_Name
@@ -43,7 +42,7 @@ def deploy_lambda(self):
4342 stage = self .stage ,
4443 ephemeral_storage = self .ephemeral_storage ,
4544 memory_size = self .memory_size )
46- with Deploy_Lambda (run , ** kwargs ) as _ :
45+ with Deploy_Lambda (self . handler () , ** kwargs ) as _ :
4746 _ .add_file__boto3__lambda () # this file allows the dynamically load of dependencies
4847 _ .set_env_variable (ENV_VAR__FAST_API__AUTH__API_KEY__NAME , self .api_key__name ())
4948 _ .set_env_variable (ENV_VAR__FAST_API__AUTH__API_KEY__VALUE , self .api_key__value ())
@@ -87,17 +86,23 @@ def invoke__function_url(self, path=''):
8786 headers = { self .api_key__name (): self .api_key__value ()}
8887 return GET_json (url , headers = headers )
8988
89+ def handler (self ): # override to control target
90+ from osbot_fast_api_serverless .fast_api .lambda_handler import run
91+ return run
92+
9093 def lambda_configuration (self ):
9194 return obj (self .lambda_function ().info ().get ('Configuration' ))
9295
96+ def lambda_dependencies (self ): # override to control lambdas dependencies to install, upload and use
97+ from osbot_fast_api_serverless .fast_api .lambda_handler import LAMBDA_DEPENDENCIES
98+ return LAMBDA_DEPENDENCIES
99+
93100 def lambda_name (self ):
94101 return BASE__LAMBDA_NAME__FAST_API__SERVERLESS
95102
96103 def lambda_function (self ):
97104 return self .deploy_lambda ().lambda_function ()
98105
99-
100-
101106 def lambda_files_bucket_name (self ):
102107 return self .lambda_function ().s3_bucket
103108
@@ -120,7 +125,7 @@ def setup_aws_environment(self):
120125
121126 def upload_lambda_dependencies_to_s3 (self ):
122127 upload_results = {}
123- for package_name in LAMBDA_DEPENDENCIES :
128+ for package_name in self . lambda_dependencies () :
124129 with Lambda__Dependency (package_name = package_name ) as _ :
125130 upload_results [package_name ] = _ .install_and_upload ()
126131 return upload_results
0 commit comments