def list_bundles(image_address): """ Build the command for grpCurl call on api.Registry/ListBundles, execute the call. :param str image_address: Image address of the image that will be started and queried :return: Data object which contains json data :rtype: JSON-object """ out = use_container_manager(image_address, "ListBundles") out = f'{{"data":[ {out} ]}}' json_data = [] for part in convert_output(out)["data"]: json_data.append(convert_output(json.dumps(part))) return json_data
def get_package(image_address, package_name): """ Build the command for grpCurl call on api.Registry/GetPackage, execute the call. :param str image_address: Image address of the image that will be started and queried :param str package_name: name of the package in the image, for grpCurl request :return: Data object which contains json data :rtype: JSON-object """ call_argument = f'\'{{"name":"{package_name}"}}\'' out = use_container_manager(image_address, "GetPackage", call_argument=call_argument) return convert_output(out)
def get_bundle_for_channel(image_address, package_name, channel_name): """ Build the command for grpCurl call on api.Registry/GetBundleForChannel, execute the call. :param str image_address: Image address of the image that will be started and queried :param str package_name: name of the package in the image, for grpCurl request :param str channel_name: name of the channel in the image, for grpCurl request :return: Data object which contains json data :rtype: JSON-object """ call_argument = (f'\'{{"pkgName":"{package_name}", ' f'"channelName":"{channel_name}"}}\'') out = use_container_manager(image_address, "GetBundleForChannel", call_argument=call_argument) return convert_output(out)
def get_default_bundle_that_provides(image_address, group, version, kind, plural): """ Build the command for grpCurl call on api.Registry/GetDefaultBundleThatProvides, execute the call. :param str image_address: Image address of the image that will be started and queried :param str group: name of the group in the image, for grpCurl request :param str version: version of the image, for grpCurl request :param str kind: kind of the bundle, for grpCurl request :param str plural: plural name of the image, for grpCurl request :return: Data object which contains json data :rtype: JSON-object """ call_argument = (f'\'{{"group":"{group}",' f' "version":"{version}",' f'"kind":"{kind}",' f'"plural":"{plural}"}}\'') out = use_container_manager(image_address, "GetDefaultBundleThatProvides", call_argument=call_argument) return convert_output(out)
def test_convert_output_empty_input(): with pytest.raises(RuntimeError): convert_output("")
def load_and_convert_file(file_name): test_file_name = input_file_name.format(test_name=file_name) with open(test_file_name, "r") as file: input_data = file.read() return convert_output(input_data)