<s> from st2actions . runners . pythonrunner import Action <EOL> from libcloud . compute . providers import Provider as ComputeProvider <EOL> from libcloud . compute . providers import get_driver as get_compute_driver <EOL> from libcloud . storage . providers import Provider as StorageProvider <EOL> from libcloud . storage . providers import get_driver as get_storage_driver <EOL> from msrestazure . azure_active_directory import ServicePrincipalCredentials <EOL> __all__ = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> class AzureBaseComputeAction ( Action ) : <EOL> def __init__ ( self , config ) : <EOL> super ( AzureBaseComputeAction , self ) . __init__ ( config = config ) <EOL> config = self . config [ '<STR_LIT>' ] <EOL> subscription_id = config [ '<STR_LIT>' ] <EOL> key_file = config [ '<STR_LIT>' ] <EOL> self . _driver = self . _get_driver ( subscription_id = subscription_id , <EOL> key_file = key_file ) <EOL> def _get_driver ( self , subscription_id , key_file ) : <EOL> cls = get_compute_driver ( ComputeProvider . AZURE ) <EOL> driver = cls ( subscription_id = subscription_id , key_file = key_file ) <EOL> return driver <EOL> class AzureBaseStorageAction ( Action ) : <EOL> def __init__ ( self , config ) : <EOL> super ( AzureBaseStorageAction , self ) . __init__ ( config = config ) <EOL> config = self . config [ '<STR_LIT>' ] <EOL> name = config [ '<STR_LIT:name>' ] <EOL> access_key = config [ '<STR_LIT>' ] <EOL> self . _driver = self . _get_driver ( name = name , access_key = access_key ) <EOL> def _get_driver ( self , name , access_key ) : <EOL> cls = get_storage_driver ( StorageProvider . AZURE_BLOBS ) <EOL> driver = cls ( key = name , secret = access_key ) <EOL> return driver <EOL> class AzureBaseResourceManagerAction ( Action ) : <EOL> def __init__ ( self , config ) : <EOL> super ( AzureBaseResourceManagerAction , self ) . __init__ ( config = config ) <EOL> resource_config = self . config [ '<STR_LIT>' ] <EOL> self . credentials = ServicePrincipalCredentials ( <EOL> client_id = resource_config [ '<STR_LIT>' ] , <EOL> secret = resource_config [ '<STR_LIT>' ] , <EOL> tenant = resource_config [ '<STR_LIT>' ] <EOL> ) </s>
