MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / modify_agents

Method modify_agents

keepercommander/pedm/admin_plugin.py:798–822  ·  view source on GitHub ↗
(self, *,
                        update_agents: Optional[Iterable[admin_types.UpdateAgent]] = None,
                        remove_agents: Optional[Iterable[str]] = None)

Source from the content-addressed store, hash-verified

796 return admin_types.ModifyStatus.from_proto(status_rs)
797
798 def modify_agents(self, *,
799 update_agents: Optional[Iterable[admin_types.UpdateAgent]] = None,
800 remove_agents: Optional[Iterable[str]] = None) -> admin_types.ModifyStatus:
801 rq = pedm_pb2.ModifyAgentRequest()
802 if update_agents is not None:
803 for ua in update_agents:
804 agent_uid = ua.agent_uid
805 existing_agent = self.agents.get_entity(agent_uid)
806 if existing_agent is None:
807 raise Exception(f'Update: Policy {agent_uid} not found')
808 au = pedm_pb2.AgentUpdate()
809 au.agentUid = utils.base64_url_decode(agent_uid)
810 if isinstance(ua.deployment_uid, str):
811 au.deploymentUid = utils.base64_url_decode(ua.deployment_uid)
812 if isinstance(ua.disabled, bool):
813 au.disabled = folder_pb2.BOOLEAN_TRUE if ua.disabled else folder_pb2.BOOLEAN_FALSE
814
815 rq.updateAgent.append(au)
816 if remove_agents is not None:
817 rq.removeAgent.extend((utils.base64_url_decode(x) for x in remove_agents))
818
819 status_rs = api.execute_router(self.params,'pedm/modify_agent', rq, rs_type=pedm_pb2.PedmStatusResponse)
820 self._need_sync = True
821 assert status_rs is not None
822 return admin_types.ModifyStatus.from_proto(status_rs)
823
824 def modify_approvals(self, *,
825 to_approve: Optional[List[bytes]] = None,

Callers 2

executeMethod · 0.80
executeMethod · 0.80

Calls 2

from_protoMethod · 0.80
get_entityMethod · 0.45

Tested by

no test coverage detected