def query(path, method='GET', data=None, params=None, header_dict=None, decode=True):
    '''
    Perform a query directly against the Azure REST API
    '''
    certificate_path = config.get_cloud_config_value(
        'certificate_path',
        get_configured_provider(), __opts__, search_global=False
    )
    subscription_id = salt.utils.stringutils.to_str(
        config.get_cloud_config_value(
            'subscription_id',
            get_configured_provider(), __opts__, search_global=False
        )
    )
    management_host = config.get_cloud_config_value(
        'management_host',
        get_configured_provider(),
        __opts__,
        search_global=False,
        default='management.core.windows.net'
    )
    backend = config.get_cloud_config_value(
        'backend',
        get_configured_provider(), __opts__, search_global=False
    )
    url = 'https://{management_host}/{subscription_id}/{path}'.format(
        management_host=management_host,
        subscription_id=subscription_id,
        path=path,
    )

    if header_dict is None:
        header_dict = {}

    header_dict['x-ms-version'] = '2014-06-01'

    result = salt.utils.http.query(
        url,
        method=method,
        params=params,
        data=data,
        header_dict=header_dict,
        port=443,
        text=True,
        cert=certificate_path,
        backend=backend,
        decode=decode,
        decode_type='xml',
    )
    if 'dict' in result:
        return result['dict']
    return
def query ( path , method = 'GET' , data = None , params = None , header_dict = None , decode = True ) : certificate_path = config . get_cloud_config_value ( 'certificate_path' , get_configured_provider ( ) , __opts__ , search_global = False ) subscription_id = salt . utils . stringutils . to_str ( config . get_cloud_config_value ( 'subscription_id' , get_configured_provider ( ) , __opts__ , search_global = False ) ) management_host = config . get_cloud_config_value ( 'management_host' , get_configured_provider ( ) , __opts__ , search_global = False , default = 'management.core.windows.net' ) backend = config . get_cloud_config_value ( 'backend' , get_configured_provider ( ) , __opts__ , search_global = False ) url = 'https://{management_host}/{subscription_id}/{path}' . format ( management_host = management_host , subscription_id = subscription_id , path = path , ) if header_dict is None : header_dict = { } header_dict [ 'x-ms-version' ] = '2014-06-01' result = salt . utils . http . query ( url , method = method , params = params , data = data , header_dict = header_dict , port = 443 , text = True , cert = certificate_path , backend = backend , decode = decode , decode_type = 'xml' , ) if 'dict' in result : return result [ 'dict' ] return
Perform a query directly against the Azure REST API