Beispiel #1
0
def list_vms_sub(access_token, subscription_id):
    '''List VMs in a subscription.

    Args:
        access_token (str): A valid Azure authentication token.
        subscription_id (str): Azure subscription id.

    Returns:
        HTTP response. JSON body of a list of VM model views.
    '''
    endpoint = ''.join([get_rm_endpoint(),
                        '/subscriptions/', subscription_id,
                        '/providers/Microsoft.Compute/virtualMachines',
                        '?api-version=', COMP_API])
    return do_get_next(endpoint, access_token)
Beispiel #2
0
def list_dhg_sub(access_token, subscription_id):
    '''List dedicated host groups in a subscription.

    Args:
        access_token (str): A valid Azure authentication token.
        subscription_id (str): Azure subscription id.

    Returns:
        HTTP response. JSON body of the list of dedicated hostsproperties.
    '''
    endpoint = ''.join([get_rm_endpoint(),
                        '/subscriptions/', subscription_id,
                        '/providers/Microsoft.Compute/hostgroups',
                        '?api-version=', COMP_API])
    return do_get_next(endpoint, access_token)
Beispiel #3
0
def list_dhg(access_token, subscription_id, resource_group):
    '''List availability sets in a resource_group.

    Args:
        access_token (str): A valid Azure authentication token.
        subscription_id (str): Azure subscription id.
        resource_group (str): Azure resource group name.

    Returns:
        HTTP response. JSON body of the list of availability set properties.
    '''
    endpoint = ''.join([get_rm_endpoint(),
                        '/subscriptions/', subscription_id,
                        '/resourceGroups/', resource_group,
                        '/providers/Microsoft.Compute/hostgroups',
                        '?api-version=', COMP_API])
    return do_get_next(endpoint, access_token)
Beispiel #4
0
def get_dh(access_token, subscription_id, resource_group,dhg_name, dh_name):
    '''Get a dedicated host and its instance view.

    Args:
        access_token (str): A valid Azure authentication token.
        subscription_id (str): Azure subscription id.
        resource_group (str): Azure resource group name.
        dhg_name (str): Dedicated host group name.

    Returns:
        HTTP response. JSON body of the list of dedicated hosts properties.
    '''
    endpoint = ''.join([get_rm_endpoint(),
                        '/subscriptions/', subscription_id,
                        '/resourceGroups/', resource_group,
                        '/providers/Microsoft.Compute/hostgroups/', dhg_name,
                        '/hosts/',dh_name,
                        '?$expand=instanceView&api-version=', COMP_API])
    return do_get_next(endpoint, access_token)