adh_cache.py
def build_cache (self,access_token, subscription_id,location, resource_group, host_group):
        '''Analyze a Dedicated Host Group.

        Args:
            access_token (str): A valid Azure authentication token.
            subscription_id (str): Azure subscription id.
            resource_group (str): Azure resource group name.
            location (str): Azure region. E.g. westus.
            host_group (str): A specific dedicated host group to analyze (optional)

        Returns:
            Object representation of the dedicated host group.
        '''
        logger.debug ("adh_cache: build_cache")
        if not resource_group:
            dhg_list = list_dhg_sub(access_token, subscription_id)
            #NO-VM vm_list = list_vms_sub(access_token,subscription_id)
        elif resource_group  and not host_group:
            dhg_list = list_dhg(access_token, subscription_id,resource_group)
            #NO-VM vm_list = list_vms(access_token,subscription_id,resource_group)
        else:
            logger.warn ("dhg_mng : analyze_dhg nunsupported parameters")
            return ADH_Return (-1,'analyze_dhg nunsupported parameters')
        if 'error' in dhg_list:
            logger.warn ("dhg_mng : analyze_dhg returned error:"+dhg_list['error']['code'])
            return ADH_Return (-1,'analyze_dhg internal error')
        self.populate_host_groups(dhg_list,access_token, subscription_id, resource_group)
        return ADH_Return (0,'success')

        #NO-VM vm_dictionary={}
        #NO-VM for vm in vm_list['value']:
        #NO-VM     vm_dictionary[vm['id'].upper()]=vm
        
        #NO-VM resource_group(vm_dictionary)
Analyze a Dedicated Host Group.

        Args:
            access_token (str): A valid Azure authentication token.
            subscription_id (str): Azure subscription id.
            resource_group (str): Azure resource group name.
            location (str): Azure region. E.g. westus.
            host_group (str): A specific dedicated host group to analyze (optional)

        Returns:
            Object representation of the dedicated host group.
        
Analyze a Dedicated Host Group.
Analyze a Dedicated Host Group .
def build_cache (self,access_token, subscription_id,location, resource_group, host_group):
        logger.debug ("adh_cache: build_cache")
        if not resource_group:
            dhg_list = list_dhg_sub(access_token, subscription_id)
        elif resource_group  and not host_group:
            dhg_list = list_dhg(access_token, subscription_id,resource_group)
        else:
            logger.warn ("dhg_mng : analyze_dhg nunsupported parameters")
            return ADH_Return (-1,'analyze_dhg nunsupported parameters')
        if 'error' in dhg_list:
            logger.warn ("dhg_mng : analyze_dhg returned error:"+dhg_list['error']['code'])
            return ADH_Return (-1,'analyze_dhg internal error')
        self.populate_host_groups(dhg_list,access_token, subscription_id, resource_group)
        return ADH_Return (0,'success')
def build_cache ( self , access_token , subscription_id , location , resource_group , host_group ) : logger . debug ( "adh_cache: build_cache" ) if not resource_group : dhg_list = list_dhg_sub ( access_token , subscription_id ) elif resource_group and not host_group : dhg_list = list_dhg ( access_token , subscription_id , resource_group ) else : logger . warn ( "dhg_mng : analyze_dhg nunsupported parameters" ) return ADH_Return ( - 1 , 'analyze_dhg nunsupported parameters' ) if 'error' in dhg_list : logger . warn ( "dhg_mng : analyze_dhg returned error:" + dhg_list [ 'error' ] [ 'code' ] ) return ADH_Return ( - 1 , 'analyze_dhg internal error' ) self . populate_host_groups ( dhg_list , access_token , subscription_id , resource_group ) return ADH_Return ( 0 , 'success' )
Analyze a Dedicated Host Group.
Analyze a Dedicated Host Group .
'''Analyze a Dedicated Host Group.

        Args:
            access_token (str): A valid Azure authentication token.
            subscription_id (str): Azure subscription id.
            resource_group (str): Azure resource group name.
            location (str): Azure region. E.g. westus.
            host_group (str): A specific dedicated host group to analyze (optional)

        Returns:
            Object representation of the dedicated host group.
        ''' #NO-VM vm_list = list_vms_sub(access_token,subscription_id) #NO-VM vm_list = list_vms(access_token,subscription_id,resource_group) #NO-VM vm_dictionary={} #NO-VM for vm in vm_list['value']: #NO-VM     vm_dictionary[vm['id'].upper()]=vm #NO-VM resource_group(vm_dictionary)
Object representation of the dedicated host group.
Object representation of the dedicated host group .
self
access_token
A valid Azure authentication token.
A valid Azure authentication token .
subscription_id
Azure subscription id.
Azure subscription id .
location
Azure region. E.g. westus.
Azure region . E . g . westus .
resource_group
Azure resource group name.
Azure resource group name .
host_group
A specific dedicated host group to analyze (optional)
A specific dedicated host group to analyze ( optional )