diff --git a/portal_client.thrift b/portal_client.thrift index a12dc93..9e4af59 100644 --- a/portal_client.thrift +++ b/portal_client.thrift @@ -391,6 +391,15 @@ service VirtualMachineService { throws (1:DefaultException r,2:ServerNotFoundException s ) + + void add_project_security_group_to_server( + /** OpenStack id of the server*/ + 1:string server_id,2:string project_name, 3:string project_id) + + throws (1:DefaultException r,2:ServerNotFoundException s + + ) + /** * Add metadata to a server. */ @@ -449,6 +458,8 @@ service VirtualMachineService { void delete_security_group_rule(1:string openstack_id) throws (1:SecurityGroupRuleNotFoundException e,2:DefaultException f) + void remove_security_groups_from_server(1:string openstack_id) throws (1:SecurityGroupRuleNotFoundException e,2:OpenStackConflictException f) + /** * Delete server. @@ -496,12 +507,13 @@ service VirtualMachineService { 7:list> volume_ids_path_new, 8:list> volume_ids_path_attach, - 9:list additional_keys, - 10:optional string research_environment - 11:optional list additional_security_group_ids, - 12:optional string slurm_version, - 13:optional string metadata_token, - 14:optional string metadata_endpoint + 9:list additional_owner_keys, + 10:list additional_user_keys, + 11:optional string research_environment + 12:optional list additional_security_group_ids, + 13:optional string slurm_version, + 14:optional string metadata_token, + 15:optional string metadata_endpoint ) @@ -535,9 +547,10 @@ service VirtualMachineService { 7:list> volume_ids_path_new, 8:list> volume_ids_path_attach, 9:optional list additional_security_group_ids, - 10:optional list additional_keys, - 11:optional string metadata_token, - 12:optional string metadata_endpoint, + 10:list additional_owner_keys, + 11:list additional_user_keys, + 12:optional string metadata_token, + 13:optional string metadata_endpoint, @@ -669,14 +682,16 @@ service VirtualMachineService { VM get_server( /** Id of the server.*/ - 1:string openstack_id) + 1:string openstack_id, + 2:optional bool no_connection) throws (1:ServerNotFoundException e), VM get_server_by_unique_name( /** Id of the server.*/ - 1:string unique_name) + 1:string unique_name, + 2:optional bool no_connection) throws (1:ServerNotFoundException e), diff --git a/simple_vm_client/VirtualMachineHandler.py b/simple_vm_client/VirtualMachineHandler.py index 2b93319..30a51bd 100644 --- a/simple_vm_client/VirtualMachineHandler.py +++ b/simple_vm_client/VirtualMachineHandler.py @@ -164,16 +164,20 @@ def set_server_metadata(self, openstack_id: str, metadata: dict[str, str]): openstack_id=openstack_id, metadata=metadata ) - def get_server_by_unique_name(self, unique_name: str) -> VM: + def get_server_by_unique_name( + self, unique_name: str, no_connection: bool = False + ) -> VM: server = self.openstack_connector.get_server_by_unique_name( - unique_name=unique_name + unique_name=unique_name, no_connection=no_connection ) server = self.forc_connector.get_playbook_status(server=server) server = thrift_converter.os_to_thrift_server(openstack_server=server) return server - def get_server(self, openstack_id: str) -> VM: - server = self.openstack_connector.get_server(openstack_id=openstack_id) + def get_server(self, openstack_id: str, no_connection: bool = False) -> VM: + server = self.openstack_connector.get_server( + openstack_id=openstack_id, no_connection=no_connection + ) server = self.forc_connector.get_playbook_status(server=server) server = thrift_converter.os_to_thrift_server(openstack_server=server) return server @@ -346,6 +350,11 @@ def delete_security_group_rule(self, openstack_id): openstack_id=openstack_id ) + def remove_security_groups_from_server(self, openstack_id): + return self.openstack_connector.remove_security_groups_from_server( + openstack_id=openstack_id + ) + def add_default_security_groups_to_server(self, openstack_id): return self.openstack_connector.add_default_security_groups_to_server( openstack_id=openstack_id @@ -374,6 +383,13 @@ def add_research_environment_security_group( server_id=server_id, security_group_name=security_group_name ) + def add_project_security_group_to_server( + self, server_id: str, project_name: str, project_id: str + ) -> None: + return self.openstack_connector.add_project_security_group_to_server( + server_id=server_id, project_name=project_name, project_id=project_id + ) + def add_udp_security_group(self, server_id: str) -> None: return self.openstack_connector.add_udp_security_group(server_id=server_id) @@ -391,7 +407,8 @@ def start_server( metadata: dict[str, str], volume_ids_path_new: list[dict[str, str]], volume_ids_path_attach: list[dict[str, str]], - additional_keys: list[str], + additional_owner_keys: list[str], + additional_user_keys: list[str], research_environment: str, additional_security_group_ids: list[str], slurm_version: str = None, @@ -414,7 +431,8 @@ def start_server( metadata=metadata, volume_ids_path_new=volume_ids_path_new, volume_ids_path_attach=volume_ids_path_attach, - additional_keys=additional_keys, + additional_owner_keys=additional_owner_keys, + additional_user_keys=additional_user_keys, research_environment_metadata=research_environment_metadata, additional_security_group_ids=additional_security_group_ids, slurm_version=slurm_version, @@ -432,7 +450,8 @@ def start_server_with_custom_key( volume_ids_path_new: list[dict[str, str]], volume_ids_path_attach: list[dict[str, str]], additional_security_group_ids: list[str], - additional_keys: list[str], + additional_owner_keys: list[str], + additional_user_keys: list[str], metadata_token: str = None, metadata_endpoint: str = None, ) -> str: @@ -449,7 +468,8 @@ def start_server_with_custom_key( image_name=image_name, servername=servername, metadata=metadata, - additional_keys=additional_keys, + additional_owner_keys=additional_owner_keys, + additional_user_keys=additional_user_keys, research_environment_metadata=research_environment_metadata, volume_ids_path_new=volume_ids_path_new, volume_ids_path_attach=volume_ids_path_attach, diff --git a/simple_vm_client/VirtualMachineService-remote b/simple_vm_client/VirtualMachineService-remote index 1d78df5..e542a37 100755 --- a/simple_vm_client/VirtualMachineService-remote +++ b/simple_vm_client/VirtualMachineService-remote @@ -38,6 +38,9 @@ if len(sys.argv) <= 1 or sys.argv[1] == "--help": print( " void add_research_environment_security_group(string server_id, string security_group_name)" ) + print( + " void add_project_security_group_to_server(string server_id, string project_name, string project_id)" + ) print(" void add_metadata_to_server(string openstack_id, metadata)") print(" get_flavors()") print(" get_images()") @@ -51,18 +54,19 @@ if len(sys.argv) <= 1 or sys.argv[1] == "--help": " string open_port_range_for_vm_in_project(int range_start, int range_stop, string openstack_id, string ethertype, string protocol)" ) print(" void delete_security_group_rule(string openstack_id)") + print(" void remove_security_groups_from_server(string openstack_id)") print(" void delete_server(string openstack_id)") print( " void rescue_server(string openstack_id, string admin_pass, string image_ref)" ) print(" void unrescue_server(string openstack_id)") print( - " string start_server(string flavor_name, string image_name, string public_key, string servername, metadata, volume_ids_path_new, volume_ids_path_attach, additional_keys, string research_environment, additional_security_group_ids, string slurm_version, string metadata_token, string metadata_endpoint)" + " string start_server(string flavor_name, string image_name, string public_key, string servername, metadata, volume_ids_path_new, volume_ids_path_attach, additional_owner_keys, additional_user_keys, string research_environment, additional_security_group_ids, string slurm_version, string metadata_token, string metadata_endpoint)" ) print(" bool is_bibigrid_available()") print(" void detach_ip_from_server(string server_id, string floating_ip)") print( - " string start_server_with_custom_key(string flavor_name, string image_name, string servername, metadata, string research_environment, volume_ids_path_new, volume_ids_path_attach, additional_security_group_ids, additional_keys, string metadata_token, string metadata_endpoint)" + " string start_server_with_custom_key(string flavor_name, string image_name, string servername, metadata, string research_environment, volume_ids_path_new, volume_ids_path_attach, additional_security_group_ids, additional_owner_keys, additional_user_keys, string metadata_token, string metadata_endpoint)" ) print(" bool exist_server(string name)") print( @@ -103,8 +107,8 @@ if len(sys.argv) <= 1 or sys.argv[1] == "--help": print(" string get_keypair_public_key_by_name(string key_name)") print(" void delete_keypair(string key_name)") print(" void add_default_security_groups_to_server(string openstack_id)") - print(" VM get_server(string openstack_id)") - print(" VM get_server_by_unique_name(string unique_name)") + print(" VM get_server(string openstack_id, bool no_connection)") + print(" VM get_server_by_unique_name(string unique_name, bool no_connection)") print(" void stop_server(string openstack_id)") print( " string create_snapshot(string openstack_id, string name, string username, base_tags, string description)" @@ -289,6 +293,18 @@ elif cmd == "add_research_environment_security_group": ) ) +elif cmd == "add_project_security_group_to_server": + if len(args) != 3: + print("add_project_security_group_to_server requires 3 args") + sys.exit(1) + pp.pprint( + client.add_project_security_group_to_server( + args[0], + args[1], + args[2], + ) + ) + elif cmd == "add_metadata_to_server": if len(args) != 2: print("add_metadata_to_server requires 2 args") @@ -390,6 +406,16 @@ elif cmd == "delete_security_group_rule": ) ) +elif cmd == "remove_security_groups_from_server": + if len(args) != 1: + print("remove_security_groups_from_server requires 1 args") + sys.exit(1) + pp.pprint( + client.remove_security_groups_from_server( + args[0], + ) + ) + elif cmd == "delete_server": if len(args) != 1: print("delete_server requires 1 args") @@ -423,8 +449,8 @@ elif cmd == "unrescue_server": ) elif cmd == "start_server": - if len(args) != 13: - print("start_server requires 13 args") + if len(args) != 14: + print("start_server requires 14 args") sys.exit(1) pp.pprint( client.start_server( @@ -436,11 +462,12 @@ elif cmd == "start_server": eval(args[5]), eval(args[6]), eval(args[7]), - args[8], - eval(args[9]), - args[10], + eval(args[8]), + args[9], + eval(args[10]), args[11], args[12], + args[13], ) ) @@ -462,8 +489,8 @@ elif cmd == "detach_ip_from_server": ) elif cmd == "start_server_with_custom_key": - if len(args) != 11: - print("start_server_with_custom_key requires 11 args") + if len(args) != 12: + print("start_server_with_custom_key requires 12 args") sys.exit(1) pp.pprint( client.start_server_with_custom_key( @@ -476,8 +503,9 @@ elif cmd == "start_server_with_custom_key": eval(args[6]), eval(args[7]), eval(args[8]), - args[9], + eval(args[9]), args[10], + args[11], ) ) @@ -774,22 +802,24 @@ elif cmd == "add_default_security_groups_to_server": ) elif cmd == "get_server": - if len(args) != 1: - print("get_server requires 1 args") + if len(args) != 2: + print("get_server requires 2 args") sys.exit(1) pp.pprint( client.get_server( args[0], + eval(args[1]), ) ) elif cmd == "get_server_by_unique_name": - if len(args) != 1: - print("get_server_by_unique_name requires 1 args") + if len(args) != 2: + print("get_server_by_unique_name requires 2 args") sys.exit(1) pp.pprint( client.get_server_by_unique_name( args[0], + eval(args[1]), ) ) diff --git a/simple_vm_client/VirtualMachineService.py b/simple_vm_client/VirtualMachineService.py index e846e4f..b6a5032 100644 --- a/simple_vm_client/VirtualMachineService.py +++ b/simple_vm_client/VirtualMachineService.py @@ -87,6 +87,15 @@ def add_research_environment_security_group(self, server_id, security_group_name """ + def add_project_security_group_to_server(self, server_id, project_name, project_id): + """ + Parameters: + - server_id: OpenStack id of the server + - project_name + - project_id + + """ + def add_metadata_to_server(self, openstack_id, metadata): """ Add metadata to a server. @@ -180,6 +189,13 @@ def delete_security_group_rule(self, openstack_id): """ + def remove_security_groups_from_server(self, openstack_id): + """ + Parameters: + - openstack_id + + """ + def delete_server(self, openstack_id): """ Delete server. @@ -215,7 +231,8 @@ def start_server( metadata, volume_ids_path_new, volume_ids_path_attach, - additional_keys, + additional_owner_keys, + additional_user_keys, research_environment, additional_security_group_ids, slurm_version, @@ -231,7 +248,8 @@ def start_server( - metadata: Metadata for the new instance - volume_ids_path_new - volume_ids_path_attach - - additional_keys + - additional_owner_keys + - additional_user_keys - research_environment - additional_security_group_ids - slurm_version @@ -261,7 +279,8 @@ def start_server_with_custom_key( volume_ids_path_new, volume_ids_path_attach, additional_security_group_ids, - additional_keys, + additional_owner_keys, + additional_user_keys, metadata_token, metadata_endpoint, ): @@ -277,7 +296,8 @@ def start_server_with_custom_key( - volume_ids_path_new - volume_ids_path_attach - additional_security_group_ids - - additional_keys + - additional_owner_keys + - additional_user_keys - metadata_token - metadata_endpoint @@ -548,20 +568,22 @@ def add_default_security_groups_to_server(self, openstack_id): """ - def get_server(self, openstack_id): + def get_server(self, openstack_id, no_connection): """ Get a Server. Returns: A server instance. Parameters: - openstack_id: Id of the server. + - no_connection """ - def get_server_by_unique_name(self, unique_name): + def get_server_by_unique_name(self, unique_name, no_connection): """ Parameters: - unique_name: Id of the server. + - no_connection """ @@ -1055,6 +1077,50 @@ def recv_add_research_environment_security_group(self): raise result.s return + def add_project_security_group_to_server(self, server_id, project_name, project_id): + """ + Parameters: + - server_id: OpenStack id of the server + - project_name + - project_id + + """ + self.send_add_project_security_group_to_server( + server_id, project_name, project_id + ) + self.recv_add_project_security_group_to_server() + + def send_add_project_security_group_to_server( + self, server_id, project_name, project_id + ): + self._oprot.writeMessageBegin( + "add_project_security_group_to_server", TMessageType.CALL, self._seqid + ) + args = add_project_security_group_to_server_args() + args.server_id = server_id + args.project_name = project_name + args.project_id = project_id + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_add_project_security_group_to_server(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = add_project_security_group_to_server_result() + result.read(iprot) + iprot.readMessageEnd() + if result.r is not None: + raise result.r + if result.s is not None: + raise result.s + return + def add_metadata_to_server(self, openstack_id, metadata): """ Add metadata to a server. @@ -1476,6 +1542,42 @@ def recv_delete_security_group_rule(self): raise result.f return + def remove_security_groups_from_server(self, openstack_id): + """ + Parameters: + - openstack_id + + """ + self.send_remove_security_groups_from_server(openstack_id) + self.recv_remove_security_groups_from_server() + + def send_remove_security_groups_from_server(self, openstack_id): + self._oprot.writeMessageBegin( + "remove_security_groups_from_server", TMessageType.CALL, self._seqid + ) + args = remove_security_groups_from_server_args() + args.openstack_id = openstack_id + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_remove_security_groups_from_server(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = remove_security_groups_from_server_result() + result.read(iprot) + iprot.readMessageEnd() + if result.e is not None: + raise result.e + if result.f is not None: + raise result.f + return + def delete_server(self, openstack_id): """ Delete server. @@ -1594,7 +1696,8 @@ def start_server( metadata, volume_ids_path_new, volume_ids_path_attach, - additional_keys, + additional_owner_keys, + additional_user_keys, research_environment, additional_security_group_ids, slurm_version, @@ -1610,7 +1713,8 @@ def start_server( - metadata: Metadata for the new instance - volume_ids_path_new - volume_ids_path_attach - - additional_keys + - additional_owner_keys + - additional_user_keys - research_environment - additional_security_group_ids - slurm_version @@ -1626,7 +1730,8 @@ def start_server( metadata, volume_ids_path_new, volume_ids_path_attach, - additional_keys, + additional_owner_keys, + additional_user_keys, research_environment, additional_security_group_ids, slurm_version, @@ -1644,7 +1749,8 @@ def send_start_server( metadata, volume_ids_path_new, volume_ids_path_attach, - additional_keys, + additional_owner_keys, + additional_user_keys, research_environment, additional_security_group_ids, slurm_version, @@ -1660,7 +1766,8 @@ def send_start_server( args.metadata = metadata args.volume_ids_path_new = volume_ids_path_new args.volume_ids_path_attach = volume_ids_path_attach - args.additional_keys = additional_keys + args.additional_owner_keys = additional_owner_keys + args.additional_user_keys = additional_user_keys args.research_environment = research_environment args.additional_security_group_ids = additional_security_group_ids args.slurm_version = slurm_version @@ -1774,7 +1881,8 @@ def start_server_with_custom_key( volume_ids_path_new, volume_ids_path_attach, additional_security_group_ids, - additional_keys, + additional_owner_keys, + additional_user_keys, metadata_token, metadata_endpoint, ): @@ -1790,7 +1898,8 @@ def start_server_with_custom_key( - volume_ids_path_new - volume_ids_path_attach - additional_security_group_ids - - additional_keys + - additional_owner_keys + - additional_user_keys - metadata_token - metadata_endpoint @@ -1804,7 +1913,8 @@ def start_server_with_custom_key( volume_ids_path_new, volume_ids_path_attach, additional_security_group_ids, - additional_keys, + additional_owner_keys, + additional_user_keys, metadata_token, metadata_endpoint, ) @@ -1820,7 +1930,8 @@ def send_start_server_with_custom_key( volume_ids_path_new, volume_ids_path_attach, additional_security_group_ids, - additional_keys, + additional_owner_keys, + additional_user_keys, metadata_token, metadata_endpoint, ): @@ -1836,7 +1947,8 @@ def send_start_server_with_custom_key( args.volume_ids_path_new = volume_ids_path_new args.volume_ids_path_attach = volume_ids_path_attach args.additional_security_group_ids = additional_security_group_ids - args.additional_keys = additional_keys + args.additional_owner_keys = additional_owner_keys + args.additional_user_keys = additional_user_keys args.metadata_token = metadata_token args.metadata_endpoint = metadata_endpoint args.write(self._oprot) @@ -3063,22 +3175,24 @@ def recv_add_default_security_groups_to_server(self): raise result.e return - def get_server(self, openstack_id): + def get_server(self, openstack_id, no_connection): """ Get a Server. Returns: A server instance. Parameters: - openstack_id: Id of the server. + - no_connection """ - self.send_get_server(openstack_id) + self.send_get_server(openstack_id, no_connection) return self.recv_get_server() - def send_get_server(self, openstack_id): + def send_get_server(self, openstack_id, no_connection): self._oprot.writeMessageBegin("get_server", TMessageType.CALL, self._seqid) args = get_server_args() args.openstack_id = openstack_id + args.no_connection = no_connection args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() @@ -3102,21 +3216,23 @@ def recv_get_server(self): TApplicationException.MISSING_RESULT, "get_server failed: unknown result" ) - def get_server_by_unique_name(self, unique_name): + def get_server_by_unique_name(self, unique_name, no_connection): """ Parameters: - unique_name: Id of the server. + - no_connection """ - self.send_get_server_by_unique_name(unique_name) + self.send_get_server_by_unique_name(unique_name, no_connection) return self.recv_get_server_by_unique_name() - def send_get_server_by_unique_name(self, unique_name): + def send_get_server_by_unique_name(self, unique_name, no_connection): self._oprot.writeMessageBegin( "get_server_by_unique_name", TMessageType.CALL, self._seqid ) args = get_server_by_unique_name_args() args.unique_name = unique_name + args.no_connection = no_connection args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() @@ -3903,6 +4019,9 @@ def __init__(self, handler): self._processMap["add_research_environment_security_group"] = ( Processor.process_add_research_environment_security_group ) + self._processMap["add_project_security_group_to_server"] = ( + Processor.process_add_project_security_group_to_server + ) self._processMap["add_metadata_to_server"] = ( Processor.process_add_metadata_to_server ) @@ -3920,6 +4039,9 @@ def __init__(self, handler): self._processMap["delete_security_group_rule"] = ( Processor.process_delete_security_group_rule ) + self._processMap["remove_security_groups_from_server"] = ( + Processor.process_remove_security_groups_from_server + ) self._processMap["delete_server"] = Processor.process_delete_server self._processMap["rescue_server"] = Processor.process_rescue_server self._processMap["unrescue_server"] = Processor.process_unrescue_server @@ -4263,6 +4385,39 @@ def process_add_research_environment_security_group(self, seqid, iprot, oprot): oprot.writeMessageEnd() oprot.trans.flush() + def process_add_project_security_group_to_server(self, seqid, iprot, oprot): + args = add_project_security_group_to_server_args() + args.read(iprot) + iprot.readMessageEnd() + result = add_project_security_group_to_server_result() + try: + self._handler.add_project_security_group_to_server( + args.server_id, args.project_name, args.project_id + ) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except DefaultException as r: + msg_type = TMessageType.REPLY + result.r = r + except ServerNotFoundException as s: + msg_type = TMessageType.REPLY + result.s = s + except TApplicationException as ex: + logging.exception("TApplication exception in handler") + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception("Unexpected exception in handler") + msg_type = TMessageType.EXCEPTION + result = TApplicationException( + TApplicationException.INTERNAL_ERROR, "Internal error" + ) + oprot.writeMessageBegin("add_project_security_group_to_server", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_add_metadata_to_server(self, seqid, iprot, oprot): args = add_metadata_to_server_args() args.read(iprot) @@ -4576,6 +4731,37 @@ def process_delete_security_group_rule(self, seqid, iprot, oprot): oprot.writeMessageEnd() oprot.trans.flush() + def process_remove_security_groups_from_server(self, seqid, iprot, oprot): + args = remove_security_groups_from_server_args() + args.read(iprot) + iprot.readMessageEnd() + result = remove_security_groups_from_server_result() + try: + self._handler.remove_security_groups_from_server(args.openstack_id) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except SecurityGroupRuleNotFoundException as e: + msg_type = TMessageType.REPLY + result.e = e + except OpenStackConflictException as f: + msg_type = TMessageType.REPLY + result.f = f + except TApplicationException as ex: + logging.exception("TApplication exception in handler") + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception("Unexpected exception in handler") + msg_type = TMessageType.EXCEPTION + result = TApplicationException( + TApplicationException.INTERNAL_ERROR, "Internal error" + ) + oprot.writeMessageBegin("remove_security_groups_from_server", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_delete_server(self, seqid, iprot, oprot): args = delete_server_args() args.read(iprot) @@ -4685,7 +4871,8 @@ def process_start_server(self, seqid, iprot, oprot): args.metadata, args.volume_ids_path_new, args.volume_ids_path_attach, - args.additional_keys, + args.additional_owner_keys, + args.additional_user_keys, args.research_environment, args.additional_security_group_ids, args.slurm_version, @@ -4793,7 +4980,8 @@ def process_start_server_with_custom_key(self, seqid, iprot, oprot): args.volume_ids_path_new, args.volume_ids_path_attach, args.additional_security_group_ids, - args.additional_keys, + args.additional_owner_keys, + args.additional_user_keys, args.metadata_token, args.metadata_endpoint, ) @@ -5664,7 +5852,9 @@ def process_get_server(self, seqid, iprot, oprot): iprot.readMessageEnd() result = get_server_result() try: - result.success = self._handler.get_server(args.openstack_id) + result.success = self._handler.get_server( + args.openstack_id, args.no_connection + ) msg_type = TMessageType.REPLY except TTransport.TTransportException: raise @@ -5692,7 +5882,9 @@ def process_get_server_by_unique_name(self, seqid, iprot, oprot): iprot.readMessageEnd() result = get_server_by_unique_name_result() try: - result.success = self._handler.get_server_by_unique_name(args.unique_name) + result.success = self._handler.get_server_by_unique_name( + args.unique_name, args.no_connection + ) msg_type = TMessageType.REPLY except TTransport.TTransportException: raise @@ -7685,11 +7877,12 @@ def __ne__(self, other): ) -class add_metadata_to_server_args(object): +class add_project_security_group_to_server_args(object): """ Attributes: - - openstack_id - - metadata + - server_id: OpenStack id of the server + - project_name + - project_id """ @@ -7697,11 +7890,13 @@ class add_metadata_to_server_args(object): def __init__( self, - openstack_id=None, - metadata=None, + server_id=None, + project_name=None, + project_id=None, ): - self.openstack_id = openstack_id - self.metadata = metadata + self.server_id = server_id + self.project_name = project_name + self.project_id = project_id def read(self, iprot): if ( @@ -7718,7 +7913,7 @@ def read(self, iprot): break if fid == 1: if ftype == TType.STRING: - self.openstack_id = ( + self.server_id = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() @@ -7726,22 +7921,21 @@ def read(self, iprot): else: iprot.skip(ftype) elif fid == 2: - if ftype == TType.MAP: - self.metadata = {} - (_ktype76, _vtype77, _size75) = iprot.readMapBegin() - for _i79 in range(_size75): - _key80 = ( - iprot.readString().decode("utf-8", errors="replace") - if sys.version_info[0] == 2 - else iprot.readString() - ) - _val81 = ( - iprot.readString().decode("utf-8", errors="replace") - if sys.version_info[0] == 2 - else iprot.readString() - ) - self.metadata[_key80] = _val81 - iprot.readMapEnd() + if ftype == TType.STRING: + self.project_name = ( + iprot.readString().decode("utf-8", errors="replace") + if sys.version_info[0] == 2 + else iprot.readString() + ) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.project_id = ( + iprot.readString().decode("utf-8", errors="replace") + if sys.version_info[0] == 2 + else iprot.readString() + ) else: iprot.skip(ftype) else: @@ -7756,26 +7950,30 @@ def write(self, oprot): oprot._fast_encode(self, [self.__class__, self.thrift_spec]) ) return - oprot.writeStructBegin("add_metadata_to_server_args") - if self.openstack_id is not None: - oprot.writeFieldBegin("openstack_id", TType.STRING, 1) + oprot.writeStructBegin("add_project_security_group_to_server_args") + if self.server_id is not None: + oprot.writeFieldBegin("server_id", TType.STRING, 1) oprot.writeString( - self.openstack_id.encode("utf-8") + self.server_id.encode("utf-8") if sys.version_info[0] == 2 - else self.openstack_id + else self.server_id ) oprot.writeFieldEnd() - if self.metadata is not None: - oprot.writeFieldBegin("metadata", TType.MAP, 2) - oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.metadata)) - for kiter82, viter83 in self.metadata.items(): - oprot.writeString( - kiter82.encode("utf-8") if sys.version_info[0] == 2 else kiter82 - ) - oprot.writeString( - viter83.encode("utf-8") if sys.version_info[0] == 2 else viter83 - ) - oprot.writeMapEnd() + if self.project_name is not None: + oprot.writeFieldBegin("project_name", TType.STRING, 2) + oprot.writeString( + self.project_name.encode("utf-8") + if sys.version_info[0] == 2 + else self.project_name + ) + oprot.writeFieldEnd() + if self.project_id is not None: + oprot.writeFieldBegin("project_id", TType.STRING, 3) + oprot.writeString( + self.project_id.encode("utf-8") + if sys.version_info[0] == 2 + else self.project_id + ) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -7794,27 +7992,34 @@ def __ne__(self, other): return not (self == other) -all_structs.append(add_metadata_to_server_args) -add_metadata_to_server_args.thrift_spec = ( +all_structs.append(add_project_security_group_to_server_args) +add_project_security_group_to_server_args.thrift_spec = ( None, # 0 ( 1, TType.STRING, - "openstack_id", + "server_id", "UTF8", None, ), # 1 ( 2, - TType.MAP, - "metadata", - (TType.STRING, "UTF8", TType.STRING, "UTF8", False), + TType.STRING, + "project_name", + "UTF8", None, ), # 2 + ( + 3, + TType.STRING, + "project_id", + "UTF8", + None, + ), # 3 ) -class add_metadata_to_server_result(object): +class add_project_security_group_to_server_result(object): """ Attributes: - r @@ -7867,7 +8072,7 @@ def write(self, oprot): oprot._fast_encode(self, [self.__class__, self.thrift_spec]) ) return - oprot.writeStructBegin("add_metadata_to_server_result") + oprot.writeStructBegin("add_project_security_group_to_server_result") if self.r is not None: oprot.writeFieldBegin("r", TType.STRUCT, 1) self.r.write(oprot) @@ -7893,8 +8098,8 @@ def __ne__(self, other): return not (self == other) -all_structs.append(add_metadata_to_server_result) -add_metadata_to_server_result.thrift_spec = ( +all_structs.append(add_project_security_group_to_server_result) +add_project_security_group_to_server_result.thrift_spec = ( None, # 0 ( 1, @@ -7913,9 +8118,24 @@ def __ne__(self, other): ) -class get_flavors_args(object): +class add_metadata_to_server_args(object): + """ + Attributes: + - openstack_id + - metadata + + """ + thrift_spec = None + def __init__( + self, + openstack_id=None, + metadata=None, + ): + self.openstack_id = openstack_id + self.metadata = metadata + def read(self, iprot): if ( iprot._fast_decode is not None @@ -7929,32 +8149,245 @@ def read(self, iprot): (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break - else: - iprot.skip(ftype) - iprot.readFieldEnd() - iprot.readStructEnd() - - def write(self, oprot): - self.validate() - if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write( - oprot._fast_encode(self, [self.__class__, self.thrift_spec]) - ) - return - oprot.writeStructBegin("get_flavors_args") - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - def __repr__(self): - L = ["%s=%r" % (key, value) for key, value in self.__dict__.items()] - return "%s(%s)" % (self.__class__.__name__, ", ".join(L)) - - def __eq__(self, other): - return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ - + if fid == 1: + if ftype == TType.STRING: + self.openstack_id = ( + iprot.readString().decode("utf-8", errors="replace") + if sys.version_info[0] == 2 + else iprot.readString() + ) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.MAP: + self.metadata = {} + (_ktype76, _vtype77, _size75) = iprot.readMapBegin() + for _i79 in range(_size75): + _key80 = ( + iprot.readString().decode("utf-8", errors="replace") + if sys.version_info[0] == 2 + else iprot.readString() + ) + _val81 = ( + iprot.readString().decode("utf-8", errors="replace") + if sys.version_info[0] == 2 + else iprot.readString() + ) + self.metadata[_key80] = _val81 + iprot.readMapEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + self.validate() + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write( + oprot._fast_encode(self, [self.__class__, self.thrift_spec]) + ) + return + oprot.writeStructBegin("add_metadata_to_server_args") + if self.openstack_id is not None: + oprot.writeFieldBegin("openstack_id", TType.STRING, 1) + oprot.writeString( + self.openstack_id.encode("utf-8") + if sys.version_info[0] == 2 + else self.openstack_id + ) + oprot.writeFieldEnd() + if self.metadata is not None: + oprot.writeFieldBegin("metadata", TType.MAP, 2) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.metadata)) + for kiter82, viter83 in self.metadata.items(): + oprot.writeString( + kiter82.encode("utf-8") if sys.version_info[0] == 2 else kiter82 + ) + oprot.writeString( + viter83.encode("utf-8") if sys.version_info[0] == 2 else viter83 + ) + oprot.writeMapEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ["%s=%r" % (key, value) for key, value in self.__dict__.items()] + return "%s(%s)" % (self.__class__.__name__, ", ".join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +all_structs.append(add_metadata_to_server_args) +add_metadata_to_server_args.thrift_spec = ( + None, # 0 + ( + 1, + TType.STRING, + "openstack_id", + "UTF8", + None, + ), # 1 + ( + 2, + TType.MAP, + "metadata", + (TType.STRING, "UTF8", TType.STRING, "UTF8", False), + None, + ), # 2 +) + + +class add_metadata_to_server_result(object): + """ + Attributes: + - r + - s + + """ + + thrift_spec = None + + def __init__( + self, + r=None, + s=None, + ): + self.r = r + self.s = s + + def read(self, iprot): + if ( + iprot._fast_decode is not None + and isinstance(iprot.trans, TTransport.CReadableTransport) + and self.thrift_spec is not None + ): + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.r = DefaultException.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.s = ServerNotFoundException.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + self.validate() + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write( + oprot._fast_encode(self, [self.__class__, self.thrift_spec]) + ) + return + oprot.writeStructBegin("add_metadata_to_server_result") + if self.r is not None: + oprot.writeFieldBegin("r", TType.STRUCT, 1) + self.r.write(oprot) + oprot.writeFieldEnd() + if self.s is not None: + oprot.writeFieldBegin("s", TType.STRUCT, 2) + self.s.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ["%s=%r" % (key, value) for key, value in self.__dict__.items()] + return "%s(%s)" % (self.__class__.__name__, ", ".join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +all_structs.append(add_metadata_to_server_result) +add_metadata_to_server_result.thrift_spec = ( + None, # 0 + ( + 1, + TType.STRUCT, + "r", + [DefaultException, None], + None, + ), # 1 + ( + 2, + TType.STRUCT, + "s", + [ServerNotFoundException, None], + None, + ), # 2 +) + + +class get_flavors_args(object): + thrift_spec = None + + def read(self, iprot): + if ( + iprot._fast_decode is not None + and isinstance(iprot.trans, TTransport.CReadableTransport) + and self.thrift_spec is not None + ): + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + self.validate() + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write( + oprot._fast_encode(self, [self.__class__, self.thrift_spec]) + ) + return + oprot.writeStructBegin("get_flavors_args") + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ["%s=%r" % (key, value) for key, value in self.__dict__.items()] + return "%s(%s)" % (self.__class__.__name__, ", ".join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + def __ne__(self, other): return not (self == other) @@ -9398,22 +9831,252 @@ def __ne__(self, other): "IPv4", ), # 4 ( - 5, + 5, + TType.STRING, + "protocol", + "UTF8", + "TCP", + ), # 5 +) + + +class open_port_range_for_vm_in_project_result(object): + """ + Attributes: + - success + - e + - v + - o + + """ + + thrift_spec = None + + def __init__( + self, + success=None, + e=None, + v=None, + o=None, + ): + self.success = success + self.e = e + self.v = v + self.o = o + + def read(self, iprot): + if ( + iprot._fast_decode is not None + and isinstance(iprot.trans, TTransport.CReadableTransport) + and self.thrift_spec is not None + ): + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRING: + self.success = ( + iprot.readString().decode("utf-8", errors="replace") + if sys.version_info[0] == 2 + else iprot.readString() + ) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.e = ServerNotFoundException.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.v = DefaultException.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRUCT: + self.o = OpenStackConflictException.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + self.validate() + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write( + oprot._fast_encode(self, [self.__class__, self.thrift_spec]) + ) + return + oprot.writeStructBegin("open_port_range_for_vm_in_project_result") + if self.success is not None: + oprot.writeFieldBegin("success", TType.STRING, 0) + oprot.writeString( + self.success.encode("utf-8") + if sys.version_info[0] == 2 + else self.success + ) + oprot.writeFieldEnd() + if self.e is not None: + oprot.writeFieldBegin("e", TType.STRUCT, 1) + self.e.write(oprot) + oprot.writeFieldEnd() + if self.v is not None: + oprot.writeFieldBegin("v", TType.STRUCT, 2) + self.v.write(oprot) + oprot.writeFieldEnd() + if self.o is not None: + oprot.writeFieldBegin("o", TType.STRUCT, 3) + self.o.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ["%s=%r" % (key, value) for key, value in self.__dict__.items()] + return "%s(%s)" % (self.__class__.__name__, ", ".join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +all_structs.append(open_port_range_for_vm_in_project_result) +open_port_range_for_vm_in_project_result.thrift_spec = ( + ( + 0, + TType.STRING, + "success", + "UTF8", + None, + ), # 0 + ( + 1, + TType.STRUCT, + "e", + [ServerNotFoundException, None], + None, + ), # 1 + ( + 2, + TType.STRUCT, + "v", + [DefaultException, None], + None, + ), # 2 + ( + 3, + TType.STRUCT, + "o", + [OpenStackConflictException, None], + None, + ), # 3 +) + + +class delete_security_group_rule_args(object): + """ + Attributes: + - openstack_id + + """ + + thrift_spec = None + + def __init__( + self, + openstack_id=None, + ): + self.openstack_id = openstack_id + + def read(self, iprot): + if ( + iprot._fast_decode is not None + and isinstance(iprot.trans, TTransport.CReadableTransport) + and self.thrift_spec is not None + ): + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.openstack_id = ( + iprot.readString().decode("utf-8", errors="replace") + if sys.version_info[0] == 2 + else iprot.readString() + ) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + self.validate() + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write( + oprot._fast_encode(self, [self.__class__, self.thrift_spec]) + ) + return + oprot.writeStructBegin("delete_security_group_rule_args") + if self.openstack_id is not None: + oprot.writeFieldBegin("openstack_id", TType.STRING, 1) + oprot.writeString( + self.openstack_id.encode("utf-8") + if sys.version_info[0] == 2 + else self.openstack_id + ) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ["%s=%r" % (key, value) for key, value in self.__dict__.items()] + return "%s(%s)" % (self.__class__.__name__, ", ".join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +all_structs.append(delete_security_group_rule_args) +delete_security_group_rule_args.thrift_spec = ( + None, # 0 + ( + 1, TType.STRING, - "protocol", + "openstack_id", "UTF8", - "TCP", - ), # 5 + None, + ), # 1 ) -class open_port_range_for_vm_in_project_result(object): +class delete_security_group_rule_result(object): """ Attributes: - - success - e - - v - - o + - f """ @@ -9421,15 +10084,11 @@ class open_port_range_for_vm_in_project_result(object): def __init__( self, - success=None, e=None, - v=None, - o=None, + f=None, ): - self.success = success self.e = e - self.v = v - self.o = o + self.f = f def read(self, iprot): if ( @@ -9444,28 +10103,14 @@ def read(self, iprot): (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break - if fid == 0: - if ftype == TType.STRING: - self.success = ( - iprot.readString().decode("utf-8", errors="replace") - if sys.version_info[0] == 2 - else iprot.readString() - ) - else: - iprot.skip(ftype) - elif fid == 1: + if fid == 1: if ftype == TType.STRUCT: - self.e = ServerNotFoundException.read(iprot) + self.e = SecurityGroupRuleNotFoundException.read(iprot) else: iprot.skip(ftype) elif fid == 2: if ftype == TType.STRUCT: - self.v = DefaultException.read(iprot) - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.STRUCT: - self.o = OpenStackConflictException.read(iprot) + self.f = DefaultException.read(iprot) else: iprot.skip(ftype) else: @@ -9480,26 +10125,14 @@ def write(self, oprot): oprot._fast_encode(self, [self.__class__, self.thrift_spec]) ) return - oprot.writeStructBegin("open_port_range_for_vm_in_project_result") - if self.success is not None: - oprot.writeFieldBegin("success", TType.STRING, 0) - oprot.writeString( - self.success.encode("utf-8") - if sys.version_info[0] == 2 - else self.success - ) - oprot.writeFieldEnd() + oprot.writeStructBegin("delete_security_group_rule_result") if self.e is not None: oprot.writeFieldBegin("e", TType.STRUCT, 1) self.e.write(oprot) oprot.writeFieldEnd() - if self.v is not None: - oprot.writeFieldBegin("v", TType.STRUCT, 2) - self.v.write(oprot) - oprot.writeFieldEnd() - if self.o is not None: - oprot.writeFieldBegin("o", TType.STRUCT, 3) - self.o.write(oprot) + if self.f is not None: + oprot.writeFieldBegin("f", TType.STRUCT, 2) + self.f.write(oprot) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -9518,40 +10151,27 @@ def __ne__(self, other): return not (self == other) -all_structs.append(open_port_range_for_vm_in_project_result) -open_port_range_for_vm_in_project_result.thrift_spec = ( - ( - 0, - TType.STRING, - "success", - "UTF8", - None, - ), # 0 +all_structs.append(delete_security_group_rule_result) +delete_security_group_rule_result.thrift_spec = ( + None, # 0 ( 1, TType.STRUCT, "e", - [ServerNotFoundException, None], + [SecurityGroupRuleNotFoundException, None], None, ), # 1 ( 2, TType.STRUCT, - "v", + "f", [DefaultException, None], None, ), # 2 - ( - 3, - TType.STRUCT, - "o", - [OpenStackConflictException, None], - None, - ), # 3 ) -class delete_security_group_rule_args(object): +class remove_security_groups_from_server_args(object): """ Attributes: - openstack_id @@ -9600,7 +10220,7 @@ def write(self, oprot): oprot._fast_encode(self, [self.__class__, self.thrift_spec]) ) return - oprot.writeStructBegin("delete_security_group_rule_args") + oprot.writeStructBegin("remove_security_groups_from_server_args") if self.openstack_id is not None: oprot.writeFieldBegin("openstack_id", TType.STRING, 1) oprot.writeString( @@ -9626,8 +10246,8 @@ def __ne__(self, other): return not (self == other) -all_structs.append(delete_security_group_rule_args) -delete_security_group_rule_args.thrift_spec = ( +all_structs.append(remove_security_groups_from_server_args) +remove_security_groups_from_server_args.thrift_spec = ( None, # 0 ( 1, @@ -9639,7 +10259,7 @@ def __ne__(self, other): ) -class delete_security_group_rule_result(object): +class remove_security_groups_from_server_result(object): """ Attributes: - e @@ -9677,7 +10297,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 2: if ftype == TType.STRUCT: - self.f = DefaultException.read(iprot) + self.f = OpenStackConflictException.read(iprot) else: iprot.skip(ftype) else: @@ -9692,7 +10312,7 @@ def write(self, oprot): oprot._fast_encode(self, [self.__class__, self.thrift_spec]) ) return - oprot.writeStructBegin("delete_security_group_rule_result") + oprot.writeStructBegin("remove_security_groups_from_server_result") if self.e is not None: oprot.writeFieldBegin("e", TType.STRUCT, 1) self.e.write(oprot) @@ -9718,8 +10338,8 @@ def __ne__(self, other): return not (self == other) -all_structs.append(delete_security_group_rule_result) -delete_security_group_rule_result.thrift_spec = ( +all_structs.append(remove_security_groups_from_server_result) +remove_security_groups_from_server_result.thrift_spec = ( None, # 0 ( 1, @@ -9732,7 +10352,7 @@ def __ne__(self, other): 2, TType.STRUCT, "f", - [DefaultException, None], + [OpenStackConflictException, None], None, ), # 2 ) @@ -10363,7 +10983,8 @@ class start_server_args(object): - metadata: Metadata for the new instance - volume_ids_path_new - volume_ids_path_attach - - additional_keys + - additional_owner_keys + - additional_user_keys - research_environment - additional_security_group_ids - slurm_version @@ -10383,7 +11004,8 @@ def __init__( metadata=None, volume_ids_path_new=None, volume_ids_path_attach=None, - additional_keys=None, + additional_owner_keys=None, + additional_user_keys=None, research_environment=None, additional_security_group_ids=None, slurm_version=None, @@ -10397,7 +11019,8 @@ def __init__( self.metadata = metadata self.volume_ids_path_new = volume_ids_path_new self.volume_ids_path_attach = volume_ids_path_attach - self.additional_keys = additional_keys + self.additional_owner_keys = additional_owner_keys + self.additional_user_keys = additional_user_keys self.research_environment = research_environment self.additional_security_group_ids = additional_security_group_ids self.slurm_version = slurm_version @@ -10522,7 +11145,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 9: if ftype == TType.LIST: - self.additional_keys = [] + self.additional_owner_keys = [] (_etype162, _size159) = iprot.readListBegin() for _i163 in range(_size159): _elem164 = ( @@ -10530,11 +11153,25 @@ def read(self, iprot): if sys.version_info[0] == 2 else iprot.readString() ) - self.additional_keys.append(_elem164) + self.additional_owner_keys.append(_elem164) iprot.readListEnd() else: iprot.skip(ftype) elif fid == 10: + if ftype == TType.LIST: + self.additional_user_keys = [] + (_etype168, _size165) = iprot.readListBegin() + for _i169 in range(_size165): + _elem170 = ( + iprot.readString().decode("utf-8", errors="replace") + if sys.version_info[0] == 2 + else iprot.readString() + ) + self.additional_user_keys.append(_elem170) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 11: if ftype == TType.STRING: self.research_environment = ( iprot.readString().decode("utf-8", errors="replace") @@ -10543,21 +11180,21 @@ def read(self, iprot): ) else: iprot.skip(ftype) - elif fid == 11: + elif fid == 12: if ftype == TType.LIST: self.additional_security_group_ids = [] - (_etype168, _size165) = iprot.readListBegin() - for _i169 in range(_size165): - _elem170 = ( + (_etype174, _size171) = iprot.readListBegin() + for _i175 in range(_size171): + _elem176 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.additional_security_group_ids.append(_elem170) + self.additional_security_group_ids.append(_elem176) iprot.readListEnd() else: iprot.skip(ftype) - elif fid == 12: + elif fid == 13: if ftype == TType.STRING: self.slurm_version = ( iprot.readString().decode("utf-8", errors="replace") @@ -10566,7 +11203,7 @@ def read(self, iprot): ) else: iprot.skip(ftype) - elif fid == 13: + elif fid == 14: if ftype == TType.STRING: self.metadata_token = ( iprot.readString().decode("utf-8", errors="replace") @@ -10575,7 +11212,7 @@ def read(self, iprot): ) else: iprot.skip(ftype) - elif fid == 14: + elif fid == 15: if ftype == TType.STRING: self.metadata_endpoint = ( iprot.readString().decode("utf-8", errors="replace") @@ -10632,30 +11269,30 @@ def write(self, oprot): if self.metadata is not None: oprot.writeFieldBegin("metadata", TType.MAP, 5) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.metadata)) - for kiter171, viter172 in self.metadata.items(): + for kiter177, viter178 in self.metadata.items(): oprot.writeString( - kiter171.encode("utf-8") if sys.version_info[0] == 2 else kiter171 + kiter177.encode("utf-8") if sys.version_info[0] == 2 else kiter177 ) oprot.writeString( - viter172.encode("utf-8") if sys.version_info[0] == 2 else viter172 + viter178.encode("utf-8") if sys.version_info[0] == 2 else viter178 ) oprot.writeMapEnd() oprot.writeFieldEnd() if self.volume_ids_path_new is not None: oprot.writeFieldBegin("volume_ids_path_new", TType.LIST, 7) oprot.writeListBegin(TType.MAP, len(self.volume_ids_path_new)) - for iter173 in self.volume_ids_path_new: - oprot.writeMapBegin(TType.STRING, TType.STRING, len(iter173)) - for kiter174, viter175 in iter173.items(): + for iter179 in self.volume_ids_path_new: + oprot.writeMapBegin(TType.STRING, TType.STRING, len(iter179)) + for kiter180, viter181 in iter179.items(): oprot.writeString( - kiter174.encode("utf-8") + kiter180.encode("utf-8") if sys.version_info[0] == 2 - else kiter174 + else kiter180 ) oprot.writeString( - viter175.encode("utf-8") + viter181.encode("utf-8") if sys.version_info[0] == 2 - else viter175 + else viter181 ) oprot.writeMapEnd() oprot.writeListEnd() @@ -10663,33 +11300,42 @@ def write(self, oprot): if self.volume_ids_path_attach is not None: oprot.writeFieldBegin("volume_ids_path_attach", TType.LIST, 8) oprot.writeListBegin(TType.MAP, len(self.volume_ids_path_attach)) - for iter176 in self.volume_ids_path_attach: - oprot.writeMapBegin(TType.STRING, TType.STRING, len(iter176)) - for kiter177, viter178 in iter176.items(): + for iter182 in self.volume_ids_path_attach: + oprot.writeMapBegin(TType.STRING, TType.STRING, len(iter182)) + for kiter183, viter184 in iter182.items(): oprot.writeString( - kiter177.encode("utf-8") + kiter183.encode("utf-8") if sys.version_info[0] == 2 - else kiter177 + else kiter183 ) oprot.writeString( - viter178.encode("utf-8") + viter184.encode("utf-8") if sys.version_info[0] == 2 - else viter178 + else viter184 ) oprot.writeMapEnd() oprot.writeListEnd() oprot.writeFieldEnd() - if self.additional_keys is not None: - oprot.writeFieldBegin("additional_keys", TType.LIST, 9) - oprot.writeListBegin(TType.STRING, len(self.additional_keys)) - for iter179 in self.additional_keys: + if self.additional_owner_keys is not None: + oprot.writeFieldBegin("additional_owner_keys", TType.LIST, 9) + oprot.writeListBegin(TType.STRING, len(self.additional_owner_keys)) + for iter185 in self.additional_owner_keys: + oprot.writeString( + iter185.encode("utf-8") if sys.version_info[0] == 2 else iter185 + ) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.additional_user_keys is not None: + oprot.writeFieldBegin("additional_user_keys", TType.LIST, 10) + oprot.writeListBegin(TType.STRING, len(self.additional_user_keys)) + for iter186 in self.additional_user_keys: oprot.writeString( - iter179.encode("utf-8") if sys.version_info[0] == 2 else iter179 + iter186.encode("utf-8") if sys.version_info[0] == 2 else iter186 ) oprot.writeListEnd() oprot.writeFieldEnd() if self.research_environment is not None: - oprot.writeFieldBegin("research_environment", TType.STRING, 10) + oprot.writeFieldBegin("research_environment", TType.STRING, 11) oprot.writeString( self.research_environment.encode("utf-8") if sys.version_info[0] == 2 @@ -10697,16 +11343,16 @@ def write(self, oprot): ) oprot.writeFieldEnd() if self.additional_security_group_ids is not None: - oprot.writeFieldBegin("additional_security_group_ids", TType.LIST, 11) + oprot.writeFieldBegin("additional_security_group_ids", TType.LIST, 12) oprot.writeListBegin(TType.STRING, len(self.additional_security_group_ids)) - for iter180 in self.additional_security_group_ids: + for iter187 in self.additional_security_group_ids: oprot.writeString( - iter180.encode("utf-8") if sys.version_info[0] == 2 else iter180 + iter187.encode("utf-8") if sys.version_info[0] == 2 else iter187 ) oprot.writeListEnd() oprot.writeFieldEnd() if self.slurm_version is not None: - oprot.writeFieldBegin("slurm_version", TType.STRING, 12) + oprot.writeFieldBegin("slurm_version", TType.STRING, 13) oprot.writeString( self.slurm_version.encode("utf-8") if sys.version_info[0] == 2 @@ -10714,7 +11360,7 @@ def write(self, oprot): ) oprot.writeFieldEnd() if self.metadata_token is not None: - oprot.writeFieldBegin("metadata_token", TType.STRING, 13) + oprot.writeFieldBegin("metadata_token", TType.STRING, 14) oprot.writeString( self.metadata_token.encode("utf-8") if sys.version_info[0] == 2 @@ -10722,7 +11368,7 @@ def write(self, oprot): ) oprot.writeFieldEnd() if self.metadata_endpoint is not None: - oprot.writeFieldBegin("metadata_endpoint", TType.STRING, 14) + oprot.writeFieldBegin("metadata_endpoint", TType.STRING, 15) oprot.writeString( self.metadata_endpoint.encode("utf-8") if sys.version_info[0] == 2 @@ -10802,45 +11448,52 @@ def __ne__(self, other): ( 9, TType.LIST, - "additional_keys", + "additional_owner_keys", (TType.STRING, "UTF8", False), None, ), # 9 ( 10, + TType.LIST, + "additional_user_keys", + (TType.STRING, "UTF8", False), + None, + ), # 10 + ( + 11, TType.STRING, "research_environment", "UTF8", None, - ), # 10 + ), # 11 ( - 11, + 12, TType.LIST, "additional_security_group_ids", (TType.STRING, "UTF8", False), None, - ), # 11 + ), # 12 ( - 12, + 13, TType.STRING, "slurm_version", "UTF8", None, - ), # 12 + ), # 13 ( - 13, + 14, TType.STRING, "metadata_token", "UTF8", None, - ), # 13 + ), # 14 ( - 14, + 15, TType.STRING, "metadata_endpoint", "UTF8", None, - ), # 14 + ), # 15 ) @@ -11363,7 +12016,8 @@ class start_server_with_custom_key_args(object): - volume_ids_path_new - volume_ids_path_attach - additional_security_group_ids - - additional_keys + - additional_owner_keys + - additional_user_keys - metadata_token - metadata_endpoint @@ -11381,7 +12035,8 @@ def __init__( volume_ids_path_new=None, volume_ids_path_attach=None, additional_security_group_ids=None, - additional_keys=None, + additional_owner_keys=None, + additional_user_keys=None, metadata_token=None, metadata_endpoint=None, ): @@ -11393,7 +12048,8 @@ def __init__( self.volume_ids_path_new = volume_ids_path_new self.volume_ids_path_attach = volume_ids_path_attach self.additional_security_group_ids = additional_security_group_ids - self.additional_keys = additional_keys + self.additional_owner_keys = additional_owner_keys + self.additional_user_keys = additional_user_keys self.metadata_token = metadata_token self.metadata_endpoint = metadata_endpoint @@ -11440,19 +12096,19 @@ def read(self, iprot): elif fid == 4: if ftype == TType.MAP: self.metadata = {} - (_ktype182, _vtype183, _size181) = iprot.readMapBegin() - for _i185 in range(_size181): - _key186 = ( + (_ktype189, _vtype190, _size188) = iprot.readMapBegin() + for _i192 in range(_size188): + _key193 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val187 = ( + _val194 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.metadata[_key186] = _val187 + self.metadata[_key193] = _val194 iprot.readMapEnd() else: iprot.skip(ftype) @@ -11468,80 +12124,94 @@ def read(self, iprot): elif fid == 7: if ftype == TType.LIST: self.volume_ids_path_new = [] - (_etype191, _size188) = iprot.readListBegin() - for _i192 in range(_size188): - _elem193 = {} - (_ktype195, _vtype196, _size194) = iprot.readMapBegin() - for _i198 in range(_size194): - _key199 = ( + (_etype198, _size195) = iprot.readListBegin() + for _i199 in range(_size195): + _elem200 = {} + (_ktype202, _vtype203, _size201) = iprot.readMapBegin() + for _i205 in range(_size201): + _key206 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val200 = ( + _val207 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _elem193[_key199] = _val200 + _elem200[_key206] = _val207 iprot.readMapEnd() - self.volume_ids_path_new.append(_elem193) + self.volume_ids_path_new.append(_elem200) iprot.readListEnd() else: iprot.skip(ftype) elif fid == 8: if ftype == TType.LIST: self.volume_ids_path_attach = [] - (_etype204, _size201) = iprot.readListBegin() - for _i205 in range(_size201): - _elem206 = {} - (_ktype208, _vtype209, _size207) = iprot.readMapBegin() - for _i211 in range(_size207): - _key212 = ( + (_etype211, _size208) = iprot.readListBegin() + for _i212 in range(_size208): + _elem213 = {} + (_ktype215, _vtype216, _size214) = iprot.readMapBegin() + for _i218 in range(_size214): + _key219 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val213 = ( + _val220 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _elem206[_key212] = _val213 + _elem213[_key219] = _val220 iprot.readMapEnd() - self.volume_ids_path_attach.append(_elem206) + self.volume_ids_path_attach.append(_elem213) iprot.readListEnd() else: iprot.skip(ftype) elif fid == 9: if ftype == TType.LIST: self.additional_security_group_ids = [] - (_etype217, _size214) = iprot.readListBegin() - for _i218 in range(_size214): - _elem219 = ( + (_etype224, _size221) = iprot.readListBegin() + for _i225 in range(_size221): + _elem226 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.additional_security_group_ids.append(_elem219) + self.additional_security_group_ids.append(_elem226) iprot.readListEnd() else: iprot.skip(ftype) elif fid == 10: if ftype == TType.LIST: - self.additional_keys = [] - (_etype223, _size220) = iprot.readListBegin() - for _i224 in range(_size220): - _elem225 = ( + self.additional_owner_keys = [] + (_etype230, _size227) = iprot.readListBegin() + for _i231 in range(_size227): + _elem232 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.additional_keys.append(_elem225) + self.additional_owner_keys.append(_elem232) iprot.readListEnd() else: iprot.skip(ftype) elif fid == 11: + if ftype == TType.LIST: + self.additional_user_keys = [] + (_etype236, _size233) = iprot.readListBegin() + for _i237 in range(_size233): + _elem238 = ( + iprot.readString().decode("utf-8", errors="replace") + if sys.version_info[0] == 2 + else iprot.readString() + ) + self.additional_user_keys.append(_elem238) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 12: if ftype == TType.STRING: self.metadata_token = ( iprot.readString().decode("utf-8", errors="replace") @@ -11550,7 +12220,7 @@ def read(self, iprot): ) else: iprot.skip(ftype) - elif fid == 12: + elif fid == 13: if ftype == TType.STRING: self.metadata_endpoint = ( iprot.readString().decode("utf-8", errors="replace") @@ -11599,12 +12269,12 @@ def write(self, oprot): if self.metadata is not None: oprot.writeFieldBegin("metadata", TType.MAP, 4) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.metadata)) - for kiter226, viter227 in self.metadata.items(): + for kiter239, viter240 in self.metadata.items(): oprot.writeString( - kiter226.encode("utf-8") if sys.version_info[0] == 2 else kiter226 + kiter239.encode("utf-8") if sys.version_info[0] == 2 else kiter239 ) oprot.writeString( - viter227.encode("utf-8") if sys.version_info[0] == 2 else viter227 + viter240.encode("utf-8") if sys.version_info[0] == 2 else viter240 ) oprot.writeMapEnd() oprot.writeFieldEnd() @@ -11619,18 +12289,18 @@ def write(self, oprot): if self.volume_ids_path_new is not None: oprot.writeFieldBegin("volume_ids_path_new", TType.LIST, 7) oprot.writeListBegin(TType.MAP, len(self.volume_ids_path_new)) - for iter228 in self.volume_ids_path_new: - oprot.writeMapBegin(TType.STRING, TType.STRING, len(iter228)) - for kiter229, viter230 in iter228.items(): + for iter241 in self.volume_ids_path_new: + oprot.writeMapBegin(TType.STRING, TType.STRING, len(iter241)) + for kiter242, viter243 in iter241.items(): oprot.writeString( - kiter229.encode("utf-8") + kiter242.encode("utf-8") if sys.version_info[0] == 2 - else kiter229 + else kiter242 ) oprot.writeString( - viter230.encode("utf-8") + viter243.encode("utf-8") if sys.version_info[0] == 2 - else viter230 + else viter243 ) oprot.writeMapEnd() oprot.writeListEnd() @@ -11638,18 +12308,18 @@ def write(self, oprot): if self.volume_ids_path_attach is not None: oprot.writeFieldBegin("volume_ids_path_attach", TType.LIST, 8) oprot.writeListBegin(TType.MAP, len(self.volume_ids_path_attach)) - for iter231 in self.volume_ids_path_attach: - oprot.writeMapBegin(TType.STRING, TType.STRING, len(iter231)) - for kiter232, viter233 in iter231.items(): + for iter244 in self.volume_ids_path_attach: + oprot.writeMapBegin(TType.STRING, TType.STRING, len(iter244)) + for kiter245, viter246 in iter244.items(): oprot.writeString( - kiter232.encode("utf-8") + kiter245.encode("utf-8") if sys.version_info[0] == 2 - else kiter232 + else kiter245 ) oprot.writeString( - viter233.encode("utf-8") + viter246.encode("utf-8") if sys.version_info[0] == 2 - else viter233 + else viter246 ) oprot.writeMapEnd() oprot.writeListEnd() @@ -11657,23 +12327,32 @@ def write(self, oprot): if self.additional_security_group_ids is not None: oprot.writeFieldBegin("additional_security_group_ids", TType.LIST, 9) oprot.writeListBegin(TType.STRING, len(self.additional_security_group_ids)) - for iter234 in self.additional_security_group_ids: + for iter247 in self.additional_security_group_ids: + oprot.writeString( + iter247.encode("utf-8") if sys.version_info[0] == 2 else iter247 + ) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.additional_owner_keys is not None: + oprot.writeFieldBegin("additional_owner_keys", TType.LIST, 10) + oprot.writeListBegin(TType.STRING, len(self.additional_owner_keys)) + for iter248 in self.additional_owner_keys: oprot.writeString( - iter234.encode("utf-8") if sys.version_info[0] == 2 else iter234 + iter248.encode("utf-8") if sys.version_info[0] == 2 else iter248 ) oprot.writeListEnd() oprot.writeFieldEnd() - if self.additional_keys is not None: - oprot.writeFieldBegin("additional_keys", TType.LIST, 10) - oprot.writeListBegin(TType.STRING, len(self.additional_keys)) - for iter235 in self.additional_keys: + if self.additional_user_keys is not None: + oprot.writeFieldBegin("additional_user_keys", TType.LIST, 11) + oprot.writeListBegin(TType.STRING, len(self.additional_user_keys)) + for iter249 in self.additional_user_keys: oprot.writeString( - iter235.encode("utf-8") if sys.version_info[0] == 2 else iter235 + iter249.encode("utf-8") if sys.version_info[0] == 2 else iter249 ) oprot.writeListEnd() oprot.writeFieldEnd() if self.metadata_token is not None: - oprot.writeFieldBegin("metadata_token", TType.STRING, 11) + oprot.writeFieldBegin("metadata_token", TType.STRING, 12) oprot.writeString( self.metadata_token.encode("utf-8") if sys.version_info[0] == 2 @@ -11681,7 +12360,7 @@ def write(self, oprot): ) oprot.writeFieldEnd() if self.metadata_endpoint is not None: - oprot.writeFieldBegin("metadata_endpoint", TType.STRING, 12) + oprot.writeFieldBegin("metadata_endpoint", TType.STRING, 13) oprot.writeString( self.metadata_endpoint.encode("utf-8") if sys.version_info[0] == 2 @@ -11768,24 +12447,31 @@ def __ne__(self, other): ( 10, TType.LIST, - "additional_keys", + "additional_owner_keys", (TType.STRING, "UTF8", False), None, ), # 10 ( 11, + TType.LIST, + "additional_user_keys", + (TType.STRING, "UTF8", False), + None, + ), # 11 + ( + 12, TType.STRING, "metadata_token", "UTF8", None, - ), # 11 + ), # 12 ( - 12, + 13, TType.STRING, "metadata_endpoint", "UTF8", None, - ), # 12 + ), # 13 ) @@ -12203,11 +12889,11 @@ def read(self, iprot): elif fid == 3: if ftype == TType.LIST: self.conda_packages = [] - (_etype239, _size236) = iprot.readListBegin() - for _i240 in range(_size236): - _elem241 = CondaPackage() - _elem241.read(iprot) - self.conda_packages.append(_elem241) + (_etype253, _size250) = iprot.readListBegin() + for _i254 in range(_size250): + _elem255 = CondaPackage() + _elem255.read(iprot) + self.conda_packages.append(_elem255) iprot.readListEnd() else: iprot.skip(ftype) @@ -12223,14 +12909,14 @@ def read(self, iprot): elif fid == 5: if ftype == TType.LIST: self.apt_packages = [] - (_etype245, _size242) = iprot.readListBegin() - for _i246 in range(_size242): - _elem247 = ( + (_etype259, _size256) = iprot.readListBegin() + for _i260 in range(_size256): + _elem261 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.apt_packages.append(_elem247) + self.apt_packages.append(_elem261) iprot.readListEnd() else: iprot.skip(ftype) @@ -12280,8 +12966,8 @@ def write(self, oprot): if self.conda_packages is not None: oprot.writeFieldBegin("conda_packages", TType.LIST, 3) oprot.writeListBegin(TType.STRUCT, len(self.conda_packages)) - for iter248 in self.conda_packages: - iter248.write(oprot) + for iter262 in self.conda_packages: + iter262.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() if self.research_environment_template is not None: @@ -12295,9 +12981,9 @@ def write(self, oprot): if self.apt_packages is not None: oprot.writeFieldBegin("apt_packages", TType.LIST, 5) oprot.writeListBegin(TType.STRING, len(self.apt_packages)) - for iter249 in self.apt_packages: + for iter263 in self.apt_packages: oprot.writeString( - iter249.encode("utf-8") if sys.version_info[0] == 2 else iter249 + iter263.encode("utf-8") if sys.version_info[0] == 2 else iter263 ) oprot.writeListEnd() oprot.writeFieldEnd() @@ -13305,11 +13991,11 @@ def read(self, iprot): if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype253, _size250) = iprot.readListBegin() - for _i254 in range(_size250): - _elem255 = Backend() - _elem255.read(iprot) - self.success.append(_elem255) + (_etype267, _size264) = iprot.readListBegin() + for _i268 in range(_size264): + _elem269 = Backend() + _elem269.read(iprot) + self.success.append(_elem269) iprot.readListEnd() else: iprot.skip(ftype) @@ -13334,8 +14020,8 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.LIST, 0) oprot.writeListBegin(TType.STRUCT, len(self.success)) - for iter256 in self.success: - iter256.write(oprot) + for iter270 in self.success: + iter270.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() if self.d is not None: @@ -13498,11 +14184,11 @@ def read(self, iprot): if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype260, _size257) = iprot.readListBegin() - for _i261 in range(_size257): - _elem262 = Backend() - _elem262.read(iprot) - self.success.append(_elem262) + (_etype274, _size271) = iprot.readListBegin() + for _i275 in range(_size271): + _elem276 = Backend() + _elem276.read(iprot) + self.success.append(_elem276) iprot.readListEnd() else: iprot.skip(ftype) @@ -13527,8 +14213,8 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.LIST, 0) oprot.writeListBegin(TType.STRUCT, len(self.success)) - for iter263 in self.success: - iter263.write(oprot) + for iter277 in self.success: + iter277.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() if self.d is not None: @@ -13693,11 +14379,11 @@ def read(self, iprot): if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype267, _size264) = iprot.readListBegin() - for _i268 in range(_size264): - _elem269 = Backend() - _elem269.read(iprot) - self.success.append(_elem269) + (_etype281, _size278) = iprot.readListBegin() + for _i282 in range(_size278): + _elem283 = Backend() + _elem283.read(iprot) + self.success.append(_elem283) iprot.readListEnd() else: iprot.skip(ftype) @@ -13722,8 +14408,8 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.LIST, 0) oprot.writeListBegin(TType.STRUCT, len(self.success)) - for iter270 in self.success: - iter270.write(oprot) + for iter284 in self.success: + iter284.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() if self.d is not None: @@ -14805,19 +15491,19 @@ def read(self, iprot): if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype272, _vtype273, _size271) = iprot.readMapBegin() - for _i275 in range(_size271): - _key276 = ( + (_ktype286, _vtype287, _size285) = iprot.readMapBegin() + for _i289 in range(_size285): + _key290 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val277 = ( + _val291 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.success[_key276] = _val277 + self.success[_key290] = _val291 iprot.readMapEnd() else: iprot.skip(ftype) @@ -14842,12 +15528,12 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.MAP, 0) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success)) - for kiter278, viter279 in self.success.items(): + for kiter292, viter293 in self.success.items(): oprot.writeString( - kiter278.encode("utf-8") if sys.version_info[0] == 2 else kiter278 + kiter292.encode("utf-8") if sys.version_info[0] == 2 else kiter292 ) oprot.writeString( - viter279.encode("utf-8") if sys.version_info[0] == 2 else viter279 + viter293.encode("utf-8") if sys.version_info[0] == 2 else viter293 ) oprot.writeMapEnd() oprot.writeFieldEnd() @@ -15005,14 +15691,14 @@ def read(self, iprot): if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype283, _size280) = iprot.readListBegin() - for _i284 in range(_size280): - _elem285 = ( + (_etype297, _size294) = iprot.readListBegin() + for _i298 in range(_size294): + _elem299 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.success.append(_elem285) + self.success.append(_elem299) iprot.readListEnd() else: iprot.skip(ftype) @@ -15037,9 +15723,9 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.LIST, 0) oprot.writeListBegin(TType.STRING, len(self.success)) - for iter286 in self.success: + for iter300 in self.success: oprot.writeString( - iter286.encode("utf-8") if sys.version_info[0] == 2 else iter286 + iter300.encode("utf-8") if sys.version_info[0] == 2 else iter300 ) oprot.writeListEnd() oprot.writeFieldEnd() @@ -15224,19 +15910,19 @@ def read(self, iprot): if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype288, _vtype289, _size287) = iprot.readMapBegin() - for _i291 in range(_size287): - _key292 = ( + (_ktype302, _vtype303, _size301) = iprot.readMapBegin() + for _i305 in range(_size301): + _key306 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val293 = ( + _val307 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.success[_key292] = _val293 + self.success[_key306] = _val307 iprot.readMapEnd() else: iprot.skip(ftype) @@ -15261,12 +15947,12 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.MAP, 0) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success)) - for kiter294, viter295 in self.success.items(): + for kiter308, viter309 in self.success.items(): oprot.writeString( - kiter294.encode("utf-8") if sys.version_info[0] == 2 else kiter294 + kiter308.encode("utf-8") if sys.version_info[0] == 2 else kiter308 ) oprot.writeString( - viter295.encode("utf-8") if sys.version_info[0] == 2 else viter295 + viter309.encode("utf-8") if sys.version_info[0] == 2 else viter309 ) oprot.writeMapEnd() oprot.writeFieldEnd() @@ -15391,11 +16077,11 @@ def read(self, iprot): if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype299, _size296) = iprot.readListBegin() - for _i300 in range(_size296): - _elem301 = ResearchEnvironmentTemplate() - _elem301.read(iprot) - self.success.append(_elem301) + (_etype313, _size310) = iprot.readListBegin() + for _i314 in range(_size310): + _elem315 = ResearchEnvironmentTemplate() + _elem315.read(iprot) + self.success.append(_elem315) iprot.readListEnd() else: iprot.skip(ftype) @@ -15415,8 +16101,8 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.LIST, 0) oprot.writeListBegin(TType.STRUCT, len(self.success)) - for iter302 in self.success: - iter302.write(oprot) + for iter316 in self.success: + iter316.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -15529,11 +16215,11 @@ def read(self, iprot): if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype306, _size303) = iprot.readListBegin() - for _i307 in range(_size303): - _elem308 = VM() - _elem308.read(iprot) - self.success.append(_elem308) + (_etype320, _size317) = iprot.readListBegin() + for _i321 in range(_size317): + _elem322 = VM() + _elem322.read(iprot) + self.success.append(_elem322) iprot.readListEnd() else: iprot.skip(ftype) @@ -15553,8 +16239,8 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.LIST, 0) oprot.writeListBegin(TType.STRUCT, len(self.success)) - for iter309 in self.success: - iter309.write(oprot) + for iter323 in self.success: + iter323.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -15617,14 +16303,14 @@ def read(self, iprot): if fid == 1: if ftype == TType.LIST: self.server_ids = [] - (_etype313, _size310) = iprot.readListBegin() - for _i314 in range(_size310): - _elem315 = ( + (_etype327, _size324) = iprot.readListBegin() + for _i328 in range(_size324): + _elem329 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.server_ids.append(_elem315) + self.server_ids.append(_elem329) iprot.readListEnd() else: iprot.skip(ftype) @@ -15644,9 +16330,9 @@ def write(self, oprot): if self.server_ids is not None: oprot.writeFieldBegin("server_ids", TType.LIST, 1) oprot.writeListBegin(TType.STRING, len(self.server_ids)) - for iter316 in self.server_ids: + for iter330 in self.server_ids: oprot.writeString( - iter316.encode("utf-8") if sys.version_info[0] == 2 else iter316 + iter330.encode("utf-8") if sys.version_info[0] == 2 else iter330 ) oprot.writeListEnd() oprot.writeFieldEnd() @@ -15711,11 +16397,11 @@ def read(self, iprot): if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype320, _size317) = iprot.readListBegin() - for _i321 in range(_size317): - _elem322 = VM() - _elem322.read(iprot) - self.success.append(_elem322) + (_etype334, _size331) = iprot.readListBegin() + for _i335 in range(_size331): + _elem336 = VM() + _elem336.read(iprot) + self.success.append(_elem336) iprot.readListEnd() else: iprot.skip(ftype) @@ -15735,8 +16421,8 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.LIST, 0) oprot.writeListBegin(TType.STRUCT, len(self.success)) - for iter323 in self.success: - iter323.write(oprot) + for iter337 in self.success: + iter337.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -15887,11 +16573,11 @@ def read(self, iprot): if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype327, _size324) = iprot.readListBegin() - for _i328 in range(_size324): - _elem329 = VM() - _elem329.read(iprot) - self.success.append(_elem329) + (_etype341, _size338) = iprot.readListBegin() + for _i342 in range(_size338): + _elem343 = VM() + _elem343.read(iprot) + self.success.append(_elem343) iprot.readListEnd() else: iprot.skip(ftype) @@ -15911,8 +16597,8 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.LIST, 0) oprot.writeListBegin(TType.STRUCT, len(self.success)) - for iter330 in self.success: - iter330.write(oprot) + for iter344 in self.success: + iter344.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -16217,14 +16903,14 @@ def read(self, iprot): elif fid == 5: if ftype == TType.LIST: self.names = [] - (_etype334, _size331) = iprot.readListBegin() - for _i335 in range(_size331): - _elem336 = ( + (_etype348, _size345) = iprot.readListBegin() + for _i349 in range(_size345): + _elem350 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.names.append(_elem336) + self.names.append(_elem350) iprot.readListEnd() else: iprot.skip(ftype) @@ -16282,9 +16968,9 @@ def write(self, oprot): if self.names is not None: oprot.writeFieldBegin("names", TType.LIST, 5) oprot.writeListBegin(TType.STRING, len(self.names)) - for iter337 in self.names: + for iter351 in self.names: oprot.writeString( - iter337.encode("utf-8") if sys.version_info[0] == 2 else iter337 + iter351.encode("utf-8") if sys.version_info[0] == 2 else iter351 ) oprot.writeListEnd() oprot.writeFieldEnd() @@ -16399,24 +17085,24 @@ def read(self, iprot): if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype339, _vtype340, _size338) = iprot.readMapBegin() - for _i342 in range(_size338): - _key343 = ( + (_ktype353, _vtype354, _size352) = iprot.readMapBegin() + for _i356 in range(_size352): + _key357 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val344 = [] - (_etype348, _size345) = iprot.readListBegin() - for _i349 in range(_size345): - _elem350 = ( + _val358 = [] + (_etype362, _size359) = iprot.readListBegin() + for _i363 in range(_size359): + _elem364 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val344.append(_elem350) + _val358.append(_elem364) iprot.readListEnd() - self.success[_key343] = _val344 + self.success[_key357] = _val358 iprot.readMapEnd() else: iprot.skip(ftype) @@ -16436,14 +17122,14 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.MAP, 0) oprot.writeMapBegin(TType.STRING, TType.LIST, len(self.success)) - for kiter351, viter352 in self.success.items(): + for kiter365, viter366 in self.success.items(): oprot.writeString( - kiter351.encode("utf-8") if sys.version_info[0] == 2 else kiter351 + kiter365.encode("utf-8") if sys.version_info[0] == 2 else kiter365 ) - oprot.writeListBegin(TType.STRING, len(viter352)) - for iter353 in viter352: + oprot.writeListBegin(TType.STRING, len(viter366)) + for iter367 in viter366: oprot.writeString( - iter353.encode("utf-8") if sys.version_info[0] == 2 else iter353 + iter367.encode("utf-8") if sys.version_info[0] == 2 else iter367 ) oprot.writeListEnd() oprot.writeMapEnd() @@ -17159,19 +17845,19 @@ def read(self, iprot): if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype355, _vtype356, _size354) = iprot.readMapBegin() - for _i358 in range(_size354): - _key359 = ( + (_ktype369, _vtype370, _size368) = iprot.readMapBegin() + for _i372 in range(_size368): + _key373 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val360 = ( + _val374 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.success[_key359] = _val360 + self.success[_key373] = _val374 iprot.readMapEnd() else: iprot.skip(ftype) @@ -17196,12 +17882,12 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.MAP, 0) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success)) - for kiter361, viter362 in self.success.items(): + for kiter375, viter376 in self.success.items(): oprot.writeString( - kiter361.encode("utf-8") if sys.version_info[0] == 2 else kiter361 + kiter375.encode("utf-8") if sys.version_info[0] == 2 else kiter375 ) oprot.writeString( - viter362.encode("utf-8") if sys.version_info[0] == 2 else viter362 + viter376.encode("utf-8") if sys.version_info[0] == 2 else viter376 ) oprot.writeMapEnd() oprot.writeFieldEnd() @@ -17730,6 +18416,7 @@ class get_server_args(object): """ Attributes: - openstack_id: Id of the server. + - no_connection """ @@ -17738,8 +18425,10 @@ class get_server_args(object): def __init__( self, openstack_id=None, + no_connection=None, ): self.openstack_id = openstack_id + self.no_connection = no_connection def read(self, iprot): if ( @@ -17763,6 +18452,11 @@ def read(self, iprot): ) else: iprot.skip(ftype) + elif fid == 2: + if ftype == TType.BOOL: + self.no_connection = iprot.readBool() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -17784,6 +18478,10 @@ def write(self, oprot): else self.openstack_id ) oprot.writeFieldEnd() + if self.no_connection is not None: + oprot.writeFieldBegin("no_connection", TType.BOOL, 2) + oprot.writeBool(self.no_connection) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -17811,6 +18509,13 @@ def __ne__(self, other): "UTF8", None, ), # 1 + ( + 2, + TType.BOOL, + "no_connection", + None, + None, + ), # 2 ) @@ -17917,6 +18622,7 @@ class get_server_by_unique_name_args(object): """ Attributes: - unique_name: Id of the server. + - no_connection """ @@ -17925,8 +18631,10 @@ class get_server_by_unique_name_args(object): def __init__( self, unique_name=None, + no_connection=None, ): self.unique_name = unique_name + self.no_connection = no_connection def read(self, iprot): if ( @@ -17950,6 +18658,11 @@ def read(self, iprot): ) else: iprot.skip(ftype) + elif fid == 2: + if ftype == TType.BOOL: + self.no_connection = iprot.readBool() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -17971,6 +18684,10 @@ def write(self, oprot): else self.unique_name ) oprot.writeFieldEnd() + if self.no_connection is not None: + oprot.writeFieldBegin("no_connection", TType.BOOL, 2) + oprot.writeBool(self.no_connection) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -17998,6 +18715,13 @@ def __ne__(self, other): "UTF8", None, ), # 1 + ( + 2, + TType.BOOL, + "no_connection", + None, + None, + ), # 2 ) @@ -18357,14 +19081,14 @@ def read(self, iprot): elif fid == 4: if ftype == TType.LIST: self.base_tags = [] - (_etype366, _size363) = iprot.readListBegin() - for _i367 in range(_size363): - _elem368 = ( + (_etype380, _size377) = iprot.readListBegin() + for _i381 in range(_size377): + _elem382 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.base_tags.append(_elem368) + self.base_tags.append(_elem382) iprot.readListEnd() else: iprot.skip(ftype) @@ -18415,9 +19139,9 @@ def write(self, oprot): if self.base_tags is not None: oprot.writeFieldBegin("base_tags", TType.LIST, 4) oprot.writeListBegin(TType.STRING, len(self.base_tags)) - for iter369 in self.base_tags: + for iter383 in self.base_tags: oprot.writeString( - iter369.encode("utf-8") if sys.version_info[0] == 2 else iter369 + iter383.encode("utf-8") if sys.version_info[0] == 2 else iter383 ) oprot.writeListEnd() oprot.writeFieldEnd() @@ -18693,19 +19417,19 @@ def read(self, iprot): if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype371, _vtype372, _size370) = iprot.readMapBegin() - for _i374 in range(_size370): - _key375 = ( + (_ktype385, _vtype386, _size384) = iprot.readMapBegin() + for _i388 in range(_size384): + _key389 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val376 = ( + _val390 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.success[_key375] = _val376 + self.success[_key389] = _val390 iprot.readMapEnd() else: iprot.skip(ftype) @@ -18725,12 +19449,12 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.MAP, 0) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success)) - for kiter377, viter378 in self.success.items(): + for kiter391, viter392 in self.success.items(): oprot.writeString( - kiter377.encode("utf-8") if sys.version_info[0] == 2 else kiter377 + kiter391.encode("utf-8") if sys.version_info[0] == 2 else kiter391 ) oprot.writeString( - viter378.encode("utf-8") if sys.version_info[0] == 2 else viter378 + viter392.encode("utf-8") if sys.version_info[0] == 2 else viter392 ) oprot.writeMapEnd() oprot.writeFieldEnd() @@ -18803,14 +19527,14 @@ def read(self, iprot): if fid == 1: if ftype == TType.LIST: self.public_keys = [] - (_etype382, _size379) = iprot.readListBegin() - for _i383 in range(_size379): - _elem384 = ( + (_etype396, _size393) = iprot.readListBegin() + for _i397 in range(_size393): + _elem398 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.public_keys.append(_elem384) + self.public_keys.append(_elem398) iprot.readListEnd() else: iprot.skip(ftype) @@ -18823,11 +19547,11 @@ def read(self, iprot): elif fid == 3: if ftype == TType.LIST: self.worker_instances = [] - (_etype388, _size385) = iprot.readListBegin() - for _i389 in range(_size385): - _elem390 = ClusterInstance() - _elem390.read(iprot) - self.worker_instances.append(_elem390) + (_etype402, _size399) = iprot.readListBegin() + for _i403 in range(_size399): + _elem404 = ClusterInstance() + _elem404.read(iprot) + self.worker_instances.append(_elem404) iprot.readListEnd() else: iprot.skip(ftype) @@ -18856,9 +19580,9 @@ def write(self, oprot): if self.public_keys is not None: oprot.writeFieldBegin("public_keys", TType.LIST, 1) oprot.writeListBegin(TType.STRING, len(self.public_keys)) - for iter391 in self.public_keys: + for iter405 in self.public_keys: oprot.writeString( - iter391.encode("utf-8") if sys.version_info[0] == 2 else iter391 + iter405.encode("utf-8") if sys.version_info[0] == 2 else iter405 ) oprot.writeListEnd() oprot.writeFieldEnd() @@ -18869,8 +19593,8 @@ def write(self, oprot): if self.worker_instances is not None: oprot.writeFieldBegin("worker_instances", TType.LIST, 3) oprot.writeListBegin(TType.STRUCT, len(self.worker_instances)) - for iter392 in self.worker_instances: - iter392.write(oprot) + for iter406 in self.worker_instances: + iter406.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() if self.user is not None: @@ -18961,19 +19685,19 @@ def read(self, iprot): if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype394, _vtype395, _size393) = iprot.readMapBegin() - for _i397 in range(_size393): - _key398 = ( + (_ktype408, _vtype409, _size407) = iprot.readMapBegin() + for _i411 in range(_size407): + _key412 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val399 = ( + _val413 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.success[_key398] = _val399 + self.success[_key412] = _val413 iprot.readMapEnd() else: iprot.skip(ftype) @@ -18993,12 +19717,12 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.MAP, 0) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success)) - for kiter400, viter401 in self.success.items(): + for kiter414, viter415 in self.success.items(): oprot.writeString( - kiter400.encode("utf-8") if sys.version_info[0] == 2 else kiter400 + kiter414.encode("utf-8") if sys.version_info[0] == 2 else kiter414 ) oprot.writeString( - viter401.encode("utf-8") if sys.version_info[0] == 2 else viter401 + viter415.encode("utf-8") if sys.version_info[0] == 2 else viter415 ) oprot.writeMapEnd() oprot.writeFieldEnd() @@ -19153,19 +19877,19 @@ def read(self, iprot): if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype403, _vtype404, _size402) = iprot.readMapBegin() - for _i406 in range(_size402): - _key407 = ( + (_ktype417, _vtype418, _size416) = iprot.readMapBegin() + for _i420 in range(_size416): + _key421 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val408 = ( + _val422 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.success[_key407] = _val408 + self.success[_key421] = _val422 iprot.readMapEnd() else: iprot.skip(ftype) @@ -19190,12 +19914,12 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.MAP, 0) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success)) - for kiter409, viter410 in self.success.items(): + for kiter423, viter424 in self.success.items(): oprot.writeString( - kiter409.encode("utf-8") if sys.version_info[0] == 2 else kiter409 + kiter423.encode("utf-8") if sys.version_info[0] == 2 else kiter423 ) oprot.writeString( - viter410.encode("utf-8") if sys.version_info[0] == 2 else viter410 + viter424.encode("utf-8") if sys.version_info[0] == 2 else viter424 ) oprot.writeMapEnd() oprot.writeFieldEnd() @@ -19979,19 +20703,19 @@ def read(self, iprot): if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype412, _vtype413, _size411) = iprot.readMapBegin() - for _i415 in range(_size411): - _key416 = ( + (_ktype426, _vtype427, _size425) = iprot.readMapBegin() + for _i429 in range(_size425): + _key430 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val417 = ( + _val431 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.success[_key416] = _val417 + self.success[_key430] = _val431 iprot.readMapEnd() else: iprot.skip(ftype) @@ -20021,12 +20745,12 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin("success", TType.MAP, 0) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success)) - for kiter418, viter419 in self.success.items(): + for kiter432, viter433 in self.success.items(): oprot.writeString( - kiter418.encode("utf-8") if sys.version_info[0] == 2 else kiter418 + kiter432.encode("utf-8") if sys.version_info[0] == 2 else kiter432 ) oprot.writeString( - viter419.encode("utf-8") if sys.version_info[0] == 2 else viter419 + viter433.encode("utf-8") if sys.version_info[0] == 2 else viter433 ) oprot.writeMapEnd() oprot.writeFieldEnd() @@ -20319,19 +21043,19 @@ def read(self, iprot): elif fid == 3: if ftype == TType.MAP: self.metadata = {} - (_ktype421, _vtype422, _size420) = iprot.readMapBegin() - for _i424 in range(_size420): - _key425 = ( + (_ktype435, _vtype436, _size434) = iprot.readMapBegin() + for _i438 in range(_size434): + _key439 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val426 = ( + _val440 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.metadata[_key425] = _val426 + self.metadata[_key439] = _val440 iprot.readMapEnd() else: iprot.skip(ftype) @@ -20363,12 +21087,12 @@ def write(self, oprot): if self.metadata is not None: oprot.writeFieldBegin("metadata", TType.MAP, 3) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.metadata)) - for kiter427, viter428 in self.metadata.items(): + for kiter441, viter442 in self.metadata.items(): oprot.writeString( - kiter427.encode("utf-8") if sys.version_info[0] == 2 else kiter427 + kiter441.encode("utf-8") if sys.version_info[0] == 2 else kiter441 ) oprot.writeString( - viter428.encode("utf-8") if sys.version_info[0] == 2 else viter428 + viter442.encode("utf-8") if sys.version_info[0] == 2 else viter442 ) oprot.writeMapEnd() oprot.writeFieldEnd() @@ -20580,19 +21304,19 @@ def read(self, iprot): elif fid == 2: if ftype == TType.MAP: self.metadata = {} - (_ktype430, _vtype431, _size429) = iprot.readMapBegin() - for _i433 in range(_size429): - _key434 = ( + (_ktype444, _vtype445, _size443) = iprot.readMapBegin() + for _i447 in range(_size443): + _key448 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val435 = ( + _val449 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.metadata[_key434] = _val435 + self.metadata[_key448] = _val449 iprot.readMapEnd() else: iprot.skip(ftype) @@ -20629,12 +21353,12 @@ def write(self, oprot): if self.metadata is not None: oprot.writeFieldBegin("metadata", TType.MAP, 2) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.metadata)) - for kiter436, viter437 in self.metadata.items(): + for kiter450, viter451 in self.metadata.items(): oprot.writeString( - kiter436.encode("utf-8") if sys.version_info[0] == 2 else kiter436 + kiter450.encode("utf-8") if sys.version_info[0] == 2 else kiter450 ) oprot.writeString( - viter437.encode("utf-8") if sys.version_info[0] == 2 else viter437 + viter451.encode("utf-8") if sys.version_info[0] == 2 else viter451 ) oprot.writeMapEnd() oprot.writeFieldEnd() @@ -20854,19 +21578,19 @@ def read(self, iprot): elif fid == 2: if ftype == TType.MAP: self.metadata = {} - (_ktype439, _vtype440, _size438) = iprot.readMapBegin() - for _i442 in range(_size438): - _key443 = ( + (_ktype453, _vtype454, _size452) = iprot.readMapBegin() + for _i456 in range(_size452): + _key457 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - _val444 = ( + _val458 = ( iprot.readString().decode("utf-8", errors="replace") if sys.version_info[0] == 2 else iprot.readString() ) - self.metadata[_key443] = _val444 + self.metadata[_key457] = _val458 iprot.readMapEnd() else: iprot.skip(ftype) @@ -20903,12 +21627,12 @@ def write(self, oprot): if self.metadata is not None: oprot.writeFieldBegin("metadata", TType.MAP, 2) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.metadata)) - for kiter445, viter446 in self.metadata.items(): + for kiter459, viter460 in self.metadata.items(): oprot.writeString( - kiter445.encode("utf-8") if sys.version_info[0] == 2 else kiter445 + kiter459.encode("utf-8") if sys.version_info[0] == 2 else kiter459 ) oprot.writeString( - viter446.encode("utf-8") if sys.version_info[0] == 2 else viter446 + viter460.encode("utf-8") if sys.version_info[0] == 2 else viter460 ) oprot.writeMapEnd() oprot.writeFieldEnd() diff --git a/simple_vm_client/openstack_connector/openstack_connector.py b/simple_vm_client/openstack_connector/openstack_connector.py index 9496a4d..e310d92 100644 --- a/simple_vm_client/openstack_connector/openstack_connector.py +++ b/simple_vm_client/openstack_connector/openstack_connector.py @@ -512,18 +512,31 @@ def delete_keypair(self, key_name: str) -> None: if key_pair: self.openstack_connection.delete_keypair(name=key_name) - def create_add_keys_script(self, keys: list[str]) -> str: + def create_add_keys_script( + self, additional_owner_keys: list[str], addtional_user_keys: list[str] + ) -> str: logger.info("create add key script") file_dir = os.path.dirname(os.path.abspath(__file__)) key_script = os.path.join(file_dir, "scripts/bash/add_keys_to_authorized.sh") - bash_keys_array = "(" - for key in keys: - bash_keys_array += f'"{key}" ' - bash_keys_array += ")" - + if not additional_owner_keys: + additional_owner_keys = [] + if not addtional_user_keys: + addtional_user_keys = [] + + bash_addtional_user_keys_array = "(" + for key in addtional_user_keys: + bash_addtional_user_keys_array += f'"{key}" ' + bash_addtional_user_keys_array += ")" + bash_addtional_owner_keys_array = "(" + for key in additional_owner_keys: + bash_addtional_owner_keys_array += f'"{key}" ' + bash_addtional_owner_keys_array += ")" with open(key_script, "r") as file: text = file.read() - text = text.replace("KEYS_TO_ADD", bash_keys_array) + text = text.replace( + "ADDITIONAL_USER_KEYS_TO_ADD", bash_addtional_user_keys_array + ) + text = text.replace("OWNER_KEYS_TO_ADD", bash_addtional_owner_keys_array) text = encodeutils.safe_encode(text.encode("utf-8")) key_script = text return key_script @@ -1212,7 +1225,9 @@ def set_server_metadata(self, openstack_id: str, metadata) -> None: message=f"Error when setting server {openstack_id} metadata --> {metadata}! - {e}" ) - def get_server_by_unique_name(self, unique_name: str) -> Server: + def get_server_by_unique_name( + self, unique_name: str, no_connection: bool = False + ) -> Server: logger.info(f"Get Server by unique_name: {unique_name}") filters = {"name": unique_name} @@ -1222,7 +1237,7 @@ def get_server_by_unique_name(self, unique_name: str) -> Server: if len(servers) == 1: server = list(servers)[0] logger.info(server) - if server.vm_state == VmStates.ACTIVE.value: + if server.vm_state == VmStates.ACTIVE.value and not no_connection: ssh_port, udp_port = self._calculate_vm_ports(server=server) if not self.netcat(port=ssh_port): @@ -1249,7 +1264,7 @@ def get_server_by_unique_name(self, unique_name: str) -> Server: message=f"Error when getting server {unique_name}! - multiple entries" ) - def get_server(self, openstack_id: str) -> Server: + def get_server(self, openstack_id: str, no_connection: bool = False) -> Server: try: logger.info(f"Get Server by id: {openstack_id}") server: Server = self.openstack_connection.get_server_by_id(id=openstack_id) @@ -1259,7 +1274,7 @@ def get_server(self, openstack_id: str) -> Server: message=f"Instance {openstack_id} not found", name_or_id=openstack_id, ) - if server.vm_state == VmStates.ACTIVE.value: + if server.vm_state == VmStates.ACTIVE.value and not no_connection: ssh_port, udp_port = self._calculate_vm_ports(server=server) if not self.netcat(port=ssh_port): @@ -1359,6 +1374,15 @@ def _remove_security_groups_from_server(self, server: Server) -> None: f"Could not remoeve security group {sec.id} from server" ) + def remove_security_groups_from_server(self, openstack_id): + logger.info(f"Delete Security Groups for {openstack_id}") + try: + server: Server = self.get_server(openstack_id=openstack_id) + self._remove_security_groups_from_server(server) + except ConflictException as e: + logger.error(f"Delete Security Groups for {openstack_id} failed!") + raise OpenStackConflictException(message=e.message) + def _validate_server_for_deletion(self, server: Server) -> None: task_state = server.task_state if task_state in [ @@ -1462,7 +1486,8 @@ def create_userdata( self, volume_ids_path_new: list[dict[str, str]], volume_ids_path_attach: list[dict[str, str]], - additional_keys: list[str], + additional_owner_keys: list[str], + additional_user_keys: list[str], metadata_token: str = None, metadata_endpoint: str = None, ) -> str: @@ -1474,8 +1499,11 @@ def create_userdata( logger.info( f"Metadata token {metadata_token} | Metadata Endpoint {metadata_endpoint}" ) - if additional_keys: - add_key_script = self.create_add_keys_script(keys=additional_keys) + if additional_owner_keys or additional_user_keys: + add_key_script = self.create_add_keys_script( + additional_owner_keys=additional_owner_keys, + addtional_user_keys=additional_user_keys, + ) init_script = ( add_key_script + encodeutils.safe_encode("\n".encode("utf-8")) @@ -1513,7 +1541,8 @@ def start_server( research_environment_metadata: Union[ResearchEnvironmentMetadata, None] = None, volume_ids_path_new: Union[list[dict[str, str]], None] = None, volume_ids_path_attach: Union[list[dict[str, str]], None] = None, - additional_keys: Union[list[str], None] = None, + additional_owner_keys: Union[list[str], None] = None, + additional_user_keys: Union[list[str], None] = None, additional_security_group_ids: Union[list[str], None] = None, slurm_version: str = None, metadata_token: str = None, @@ -1559,7 +1588,8 @@ def start_server( init_script = self.create_userdata( volume_ids_path_new=volume_ids_path_new, volume_ids_path_attach=volume_ids_path_attach, - additional_keys=additional_keys, + additional_owner_keys=additional_owner_keys, + additional_user_keys=additional_user_keys, metadata_token=metadata_token, metadata_endpoint=metadata_endpoint, ) @@ -1643,7 +1673,8 @@ def start_server_with_playbook( research_environment_metadata: ResearchEnvironmentMetadata, volume_ids_path_new: list[dict[str, str]] = None, # type: ignore volume_ids_path_attach: list[dict[str, str]] = None, # type: ignore - additional_keys: Union[list[str], None] = None, + additional_owner_keys: Union[list[str], None] = None, + additional_user_keys: Union[list[str], None] = None, additional_security_group_ids=None, # type: ignore metadata_token: str = None, metadata_endpoint: str = None, @@ -1679,7 +1710,8 @@ def start_server_with_playbook( init_script = self.create_userdata( volume_ids_path_new=volume_ids_path_new, volume_ids_path_attach=volume_ids_path_attach, - additional_keys=additional_keys, + additional_owner_keys=additional_owner_keys, + additional_user_keys=additional_user_keys, metadata_token=metadata_token, metadata_endpoint=metadata_endpoint, ) @@ -1734,6 +1766,25 @@ def add_research_environment_security_group( server=server, security_group=security_group ) + def add_project_security_group_to_server( + self, server_id: str, project_name: str, project_id: str + ): + logger.info(f"Setting up {project_name} security group for {server_id}") + server: Server = self.get_server(openstack_id=server_id) + security_group_id = self.get_or_create_project_security_group( + project_name=project_name, project_id=project_id + ) + security_group = self.openstack_connection.get_security_group( + name_or_id=security_group_id + ) + if self._is_security_group_already_added_to_server( + server=server, security_group_name=security_group.name + ): + return + self.openstack_connection.compute.add_security_group_to_server( + server=server, security_group=security_group + ) + def add_metadata_to_server(self, server_id, metadata): server = self.get_server(openstack_id=server_id) diff --git a/simple_vm_client/openstack_connector/scripts/bash/add_keys_to_authorized.sh b/simple_vm_client/openstack_connector/scripts/bash/add_keys_to_authorized.sh index a514b2b..05b4efc 100644 --- a/simple_vm_client/openstack_connector/scripts/bash/add_keys_to_authorized.sh +++ b/simple_vm_client/openstack_connector/scripts/bash/add_keys_to_authorized.sh @@ -1,26 +1,30 @@ #!/bin/bash -declare -a keys_to_add=KEYS_TO_ADD +declare -a additional_user_keys_to_add=ADDITIONAL_USER_KEYS_TO_ADD +declare -a additional_owner_keys_to_add=OWNER_KEYS_TO_ADD USER_TO_SET="${USER_TO_SET:-ubuntu}" USER_HOME="/home/${USER_TO_SET}" METADATA_AUTHORIZED_KEYS_FILE="${USER_HOME}/.ssh/metadata_authorized_keys" +AUTHORIZED_KEYS_FILE="${USER_HOME}/.ssh/authorized_keys" SSHD_CONFIG_FILE="/etc/ssh/sshd_config" AUTHORIZED_KEYS_LINE="AuthorizedKeysFile .ssh/authorized_keys /home/%u/.ssh/authorized_keys /home/%u/.ssh/metadata_authorized_keys" -# Validate if KEYS_TO_ADD is set properly to avoid empty file operations -if [ ${#keys_to_add[@]} -eq 0 ]; then - echo "No keys provided in KEYS_TO_ADD." - exit 1 -fi - -# Create the authorized keys file and add the keys -touch "$METADATA_AUTHORIZED_KEYS_FILE" -echo "Adding ${#keys_to_add[@]} keys to $METADATA_AUTHORIZED_KEYS_FILE" -for key in "${keys_to_add[@]}"; do - printf "\n%s" "$key" >> "$METADATA_AUTHORIZED_KEYS_FILE" -done -# Set correct permissions for the metadata_authorized_keys file -chown "$USER_TO_SET:$USER_TO_SET" "$METADATA_AUTHORIZED_KEYS_FILE" +if [ ${#additional_owner_keys_to_add[@]} -gt 0 ]; then + echo "Adding ${#additional_owner_keys_to_add[@]} keys to $AUTHORIZED_KEYS_FILE" + for key in "${additional_owner_keys_to_add[@]}"; do + printf "\n%s" "$key" >> "$AUTHORIZED_KEYS_FILE" + done +fi +if [ ${#additional_user_keys_to_add[@]} -gt 0 ]; then + # Create the authorized keys file and add the keys + touch "$METADATA_AUTHORIZED_KEYS_FILE" + echo "Adding ${#additional_user_keys_to_add[@]} keys to $METADATA_AUTHORIZED_KEYS_FILE" + for key in "${additional_user_keys_to_add[@]}"; do + printf "\n%s" "$key" >> "$METADATA_AUTHORIZED_KEYS_FILE" + done + # Set correct permissions for the metadata_authorized_keys file + chown "$USER_TO_SET:$USER_TO_SET" "$METADATA_AUTHORIZED_KEYS_FILE" +fi # Check if the line is already in the configuration file and update or append accordingly if grep -qE '^#?[[:space:]]*AuthorizedKeysFile' "$SSHD_CONFIG_FILE"; then @@ -33,4 +37,4 @@ fi echo "Reloading and restarting SSH service..." systemctl daemon-reload -service sshd restart +systemctl restart ssh diff --git a/simple_vm_client/test_openstack_connector.py b/simple_vm_client/test_openstack_connector.py index c38920d..d99f8cc 100644 --- a/simple_vm_client/test_openstack_connector.py +++ b/simple_vm_client/test_openstack_connector.py @@ -24,8 +24,8 @@ ) from simple_vm_client.util.state_enums import VmStates, VmTaskStates -from .openstack_connector.openstack_connector import OpenStackConnector -from .ttypes import ( +from openstack_connector.openstack_connector import OpenStackConnector +from ttypes import ( DefaultException, FlavorNotFoundException, ImageNotFoundException, @@ -2910,6 +2910,30 @@ def test_delete_security_group_rule_failure(self): rule_id="rule_id" ) + @patch.object(OpenStackConnector, "get_server") + def test_remove_security_groups_from_server_sucess(self, mock_get_server): + server_mock = fakes.generate_fake_resource(server.Server) + mock_get_server.return_value = server_mock + + self.openstack_connector.remove_security_groups_from_server(server_mock.id) + self.openstack_connector.openstack_connection.remove_server_security_groups.assert_called_once_with( + server_mock, server_mock.security_groups + ) + + @patch.object(OpenStackConnector, "get_server") + def test_remove_security_groups_from_server_failure(self, mock_get_server): + server_mock = fakes.generate_fake_resource(server.Server) + mock_get_server.return_value = server_mock + + self.openstack_connector.openstack_connection.remove_server_security_groups.return_value = ( + False + ) + with self.assertRaises(DefaultException): + self.openstack_connector.remove_security_groups_from_server(server_mock.id) + self.openstack_connector.openstack_connection.remove_server_security_groups.assert_called_once_with( + server_mock, server_mock.security_groups + ) + def test_get_gateway_ip(self): result = self.openstack_connector.get_gateway_ip() self.assertEqual( diff --git a/simple_vm_client/test_virtualmachinehandler.py b/simple_vm_client/test_virtualmachinehandler.py index 38da130..94b5813 100644 --- a/simple_vm_client/test_virtualmachinehandler.py +++ b/simple_vm_client/test_virtualmachinehandler.py @@ -421,6 +421,12 @@ def test_delete_security_group_rule(self): openstack_id=OPENSTACK_ID ) + def test_remove_security_groups_from_server(self): + self.handler.remove_security_groups_from_server(openstack_id=OPENSTACK_ID) + self.handler.openstack_connector.remove_security_groups_from_server.assert_called_once_with( + openstack_id=OPENSTACK_ID + ) + def test_open_port_range_for_vm_in_project(self): self.handler.open_port_range_for_vm_in_project( range_start=1000, range_stop=1000, openstack_id=OPENSTACK_ID diff --git a/simple_vm_client/util/state_enums.py b/simple_vm_client/util/state_enums.py index 9554c82..4d7d267 100644 --- a/simple_vm_client/util/state_enums.py +++ b/simple_vm_client/util/state_enums.py @@ -77,3 +77,4 @@ class VmStates(Enum): CLIENT_OFFLINE = "client_offline" PLANNED = "planned" PORT_CLOSED = "port_closed" + CONNECTION_DISABLED = "connection_disabled"