Пример #1
0
        products = endpoint.getElementsByTagName('Product')
        for region in regions:
            region_list.append(region.childNodes[0].nodeValue)
        for product in products:
            name_node = product.getElementsByTagName('ProductName')[0]
            name = name_node.childNodes[0].nodeValue
            domain_node = product.getElementsByTagName('DomainName')[0]
            domain = domain_node.childNodes[0].nodeValue
            product_list.append({name: domain})

        __endpoints[endpoint.getAttribute('name')] = dict(
            regions=region_list, products=product_list)

except Exception as ex:
    raise ClientException(error_code.SDK_MISSING_ENDPOINTS_FILER,
                          error_msg.get_msg('SDK_MISSING_ENDPOINTS_FILER'))


def find_product_domain(regionid, prod_name):
    """
        Fetch endpoint url with given region id, product name and endpoint list
        :param regionid: region id
        :param product: product name
        :param endpoints: product list
        :return: endpoint url
        """
    if regionid is not None and product is not None:
        for point in __endpoints:
            point_info = __endpoints.get(point)
            if regionid in point_info.get('regions'):
                prod_info = point_info.get('products')
        product_list = []
        regions = endpoint.getElementsByTagName('RegionId')
        products = endpoint.getElementsByTagName('Product')
        for region in regions:
            region_list.append(region.childNodes[0].nodeValue)
        for product in products:
            name_node = product.getElementsByTagName('ProductName')[0]
            name = name_node.childNodes[0].nodeValue
            domain_node = product.getElementsByTagName('DomainName')[0]
            domain = domain_node.childNodes[0].nodeValue
            product_list.append({name: domain})

        __endpoints[endpoint.getAttribute('name')] = dict(regions=region_list, products=product_list)

except Exception, ex:
    raise ClientException(error_code.SDK_MISSING_ENDPOINTS_FILER, error_msg.get_msg('SDK_MISSING_ENDPOINTS_FILER'))


def find_product_domain(regionid, prod_name):
    """
	Fetch endpoint url with given region id, product name and endpoint list
	:param regionid: region id
	:param product: product name
	:param endpoints: product list
	:return: endpoint url
	"""
    if regionid is not None and product is not None:
        for point in __endpoints:
            point_info = __endpoints.get(point)
            if regionid in point_info.get('regions'):
                prod_info = point_info.get('products')
Пример #3
0
        product_list = []
        regions = endpoint.getElementsByTagName('RegionId')
        products = endpoint.getElementsByTagName('Product')
        for region in regions:
            region_list.append(region.childNodes[0].nodeValue)
        for product in products:
            name_node = product.getElementsByTagName('ProductName')[0]
            name = name_node.childNodes[0].nodeValue
            domain_node = product.getElementsByTagName('DomainName')[0]
            domain = domain_node.childNodes[0].nodeValue
            product_list.append({name: domain})

        __endpoints[endpoint.getAttribute('name')] = dict(regions=region_list, products=product_list)

except Exception as ex:
    raise ClientException(error_code.SDK_MISSING_ENDPOINTS_FILER, error_msg.get_msg('SDK_MISSING_ENDPOINTS_FILER'))


def find_product_domain(regionid, prod_name):
    """
	Fetch endpoint url with given region id, product name and endpoint list
	:param regionid: region id
	:param product: product name
	:param endpoints: product list
	:return: endpoint url
	"""
    if regionid is not None and product is not None:
        for point in __endpoints:
            point_info = __endpoints.get(point)
            if regionid in point_info.get('regions'):
                prod_info = point_info.get('products')