Example #1
0
    def handlerExtensionOperation(self,cmd,operation,version):
        defaultOperations=['configversion','showversions']
        if operation.lower() in defaultOperations:
            import aliyunSdkConfigure
            aliyunSdkConfigure.handleSdkVersion(cmd,operation,version)
        if cmd.lower() == 'ecs':
            import commandConfigure
            import advance.ecsExportHandler
            import advance.ecsImportHandler
            ecsConfigure = commandConfigure.ecs()
            _ecsImportHandler = advance.ecsImportHandler.EcsImportHandler()
            _ecsExportHandler = advance.ecsExportHandler.EcsExportHandler()
            if  operation.lower() == ecsConfigure.importInstance.lower():
                _ecsImportHandler.ImportInstance(cmd,operation,version)
            elif operation.lower() == ecsConfigure.exportInstance.lower():
                _ecsExportHandler.exportInstance(cmd,operation,version)

        if cmd.lower() == 'rds':
            import commandConfigure
            import advance.rdsExportHandler
            import advance.rdsImportHandler
            rdsConfigure = commandConfigure.rds()
            rdsExportDBInstanceHandler = advance.rdsExportHandler.RdsExportDBInstanceHanlder()
            rdsImportDBInstanceHanlder = advance.rdsImportHandler.RdsImportDBInstanceHandler()
            if operation.lower() == rdsConfigure.exportDBInstance.lower():
                rdsExportDBInstanceHandler.exportDBInstance(cmd,operation,version)
            elif operation.lower() == rdsConfigure.importDBInstance.lower():
                rdsImportDBInstanceHanlder.importInstance(cmd, operation, version)
Example #2
0
 def getExtensionOperationsFromCmd(self, cmd):
     if cmd is None:
         return None
     defaultExtensionOpers=set(['ConfigVersion','ShowVersions'])
     if cmd.lower() == "ecs":
         ecsConfigure = commandConfigure.ecs()
         cmdSet = set()
         for item in ecsConfigure.extensionOperations:
             cmdSet.add(item)
         defaultExtensionOpers.update(cmdSet)
     if cmd.lower() == "rds":
         rdsConfigure = commandConfigure.rds()
         cmdSet = set()
         for item in rdsConfigure.extensionOperations:
             cmdSet.add(item)
         defaultExtensionOpers.update(cmdSet)
     return defaultExtensionOpers