feat: implement proxy management for AWS VM provider and enhance task configuration handling
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
from desktop_env.providers.base import VMManager, Provider
|
||||
|
||||
|
||||
def create_vm_manager_and_provider(provider_name: str, region: str):
|
||||
def create_vm_manager_and_provider(provider_name: str, region: str, use_proxy: bool = False):
|
||||
"""
|
||||
Factory function to get the Virtual Machine Manager and Provider instances based on the provided provider name.
|
||||
|
||||
Args:
|
||||
provider_name (str): The name of the provider (e.g., "aws", "vmware", etc.)
|
||||
region (str): The region for the provider
|
||||
use_proxy (bool): Whether to use proxy-enabled providers (currently only supported for AWS)
|
||||
"""
|
||||
provider_name = provider_name.lower().strip()
|
||||
if provider_name == "vmware":
|
||||
@@ -15,9 +20,16 @@ def create_vm_manager_and_provider(provider_name: str, region: str):
|
||||
from desktop_env.providers.virtualbox.provider import VirtualBoxProvider
|
||||
return VirtualBoxVMManager(), VirtualBoxProvider(region)
|
||||
elif provider_name in ["aws", "amazon web services"]:
|
||||
from desktop_env.providers.aws.manager import AWSVMManager
|
||||
from desktop_env.providers.aws.provider import AWSProvider
|
||||
return AWSVMManager(), AWSProvider(region)
|
||||
if use_proxy:
|
||||
# Use proxy-enabled AWS provider
|
||||
from desktop_env.providers.aws.manager_with_proxy import AWSVMManagerWithProxy
|
||||
from desktop_env.providers.aws.provider_with_proxy import AWSProviderWithProxy
|
||||
return AWSVMManagerWithProxy(proxy_config_file="dataimpulse_proxy_config.json"), AWSProviderWithProxy(region, proxy_config_file="dataimpulse_proxy_config.json")
|
||||
else:
|
||||
# Use regular AWS provider
|
||||
from desktop_env.providers.aws.manager import AWSVMManager
|
||||
from desktop_env.providers.aws.provider import AWSProvider
|
||||
return AWSVMManager(), AWSProvider(region)
|
||||
elif provider_name == "azure":
|
||||
from desktop_env.providers.azure.manager import AzureVMManager
|
||||
from desktop_env.providers.azure.provider import AzureProvider
|
||||
|
||||
Reference in New Issue
Block a user