def do_generate_test_enclave_info_command(args): client = PdoCliClient(url=DEFAULT_URL if args.url is None else args.url, verbose=args.verbose > 0, keyfile=_get_keyfile(args)) response = client.generate_test_enclave_info_request() print(response)
def do_ping_command(args): wait = args.wait client = PdoCliClient(url=DEFAULT_URL if args.url is None else args.url, verbose=args.verbose > 0) client.execute_ping(wait)
def do_show_command(args): type, value, wait = args.type, args.value, args.wait client = PdoCliClient(url=DEFAULT_URL if args.url is None else args.url, verbose=args.verbose > 0, keyfile=_get_keyfile(args)) response = client.execute_show_request(type, value, wait) print(response)
def do_set_setting_command(args): key, value, wait = args.key, args.value, args.wait client = PdoCliClient(url=DEFAULT_URL if args.url is None else args.url, verbose=args.verbose > 0, keyfile=_get_keyfile(args)) response = client.execute_set_setting(key, value, wait) print(response)
def do_list_command(args): namespace, wait, details = args.namespace, args.wait, args.details page_size, max_entries = args.page_size, args.max_entries print("url:", args.url) client = PdoCliClient( url=DEFAULT_URL if args.url is None else args.url, verbose=args.verbose > 0, keyfile=_get_keyfile(args)) response = client.execute_list_request(namespace, details, page_size, max_entries, wait) print(response)
def do_delete_command(args): namespace, wait = args.namespace, args.wait client = PdoCliClient(url=DEFAULT_URL if args.url is None else args.url, verbose=args.verbose > 0, keyfile=_get_keyfile(args)) if namespace == 'pdo-all': for ns in ['enclave', 'contract', 'ccl-info', 'ccl-state']: response = client.execute_delete_request(ns, wait) print(response) else: response = client.execute_delete_request(namespace, wait) print(response)
def do_json_command(args): json_file_name, wait = args.json_file, args.wait try: with open(json_file_name) as json_file: json_input = json_file.read().strip() json_file.close() except OSError as err: raise PdoCliException('Failed to read json inout file: {}'.format(str(err))) address_family = "" if args.enclave: address_family = PdoAddressHelper().get_enclave_registry_family_name() elif args.contract: address_family = PdoAddressHelper().get_contract_registry_family_name() elif args.ccl: address_family = PdoAddressHelper().get_ccl_family_name() print(address_family) enclave_private_key = "" if args.enclave_keyfile: try: with open(args.enclave_keyfile) as fd: enclave_private_key = fd.read().strip() fd.close() except OSError as err: raise PdoCliException( 'Failed to read private key: {}'.format(str(err))) client = PdoCliClient( url=DEFAULT_URL if args.url is None else args.url, verbose=args.verbose > 0, keyfile=_get_keyfile(args), enclave_signing_private_key=enclave_private_key) client.execute_json_transaction(json_input, address_family, wait)
def do_generate_signing_key_command(args): client = PdoCliClient(url=DEFAULT_URL, verbose=args.verbose > 0) response = client.generate_signing_key_request() print(response)