コード例 #1
0
ファイル: commands.py プロジェクト: mdheller/snet-cli
    def list_my(self):
        """ Find organization that has the current identity as the owner or as the member """
        org_list = self.call_contract_command("Registry", "listOrganizations", [])

        rez_owner  = []
        rez_member = []
        for idx, org_id in enumerate(org_list):
            (found, org_id, org_name, owner, members, serviceNames, repositoryNames) = self.call_contract_command("Registry", "getOrganizationById", [org_id])
            if (not found):
                raise Exception("Organization was removed during this call. Please retry.");
            if self.ident.address == owner:
                rez_owner.append((org_name, bytes32_to_str(org_id)))

            if self.ident.address in members:
                rez_member.append((org_name, bytes32_to_str(org_id)))

        if (rez_owner):
            self._printout("# Organizations you are the owner of")
            self._printout("# OrgName OrgId")
            for n,i in rez_owner:
                self._printout("%s   %s"%(n,i))

        if (rez_member):
            self._printout("# Organizations you are the member of")
            self._printout("# OrgName OrgId")
            for n,i in rez_member:
                self._printout("%s   %s"%(n,i))
コード例 #2
0
ファイル: commands.py プロジェクト: mdheller/snet-cli
 def list_services(self):
     org_id = self.args.org_id
     (found, org_service_list) = self.call_contract_command("Registry", "listServicesForOrganization", [type_converter("bytes32")(org_id)])
     self.error_organization_not_found(org_id, found)
     if org_service_list:
         self._printout("\nList of {}'s Services:".format(org_id))
         for idx, org_service in enumerate(org_service_list):
             self._printout("- {}".format(bytes32_to_str(org_service)))
     else:
         self._printout("Organization with id={} exists but has no registered services.".format(org_id))
コード例 #3
0
ファイル: commands.py プロジェクト: mdheller/snet-cli
    def list_orgnames(self):
        org_list = self.call_contract_command("Registry", "listOrganizations", [])

        self._printout("# OrgName OrgId")
        for idx, org_id in enumerate(org_list):
            rez = self.call_contract_command("Registry", "getOrganizationById", [org_id])
            if (not rez[0]):
                raise Exception("Organization was removed during this call. Please retry.");
            org_name = rez[2]
            self._printout("%s  %s"%(org_name, bytes32_to_str(org_id)))
コード例 #4
0
ファイル: commands.py プロジェクト: mdheller/snet-cli
    def info(self):
        org_id = self.args.org_id
        (found, org_id, org_name, owner, members, serviceNames, repositoryNames) = self._getorganizationbyid(org_id)
        self.error_organization_not_found(self.args.org_id, found)

        self._printout("\nOrganization Name:\n - %s"%org_name)
        self._printout("\nOrganization Id:\n - %s"%bytes32_to_str(org_id))
        self._printout("\nOwner:\n - {}".format(owner))
        if members:
            self._printout("\nMembers:")
            for idx, member in enumerate(members):
                self._printout(" - {}".format(member))
        if serviceNames:
            self._printout("\nServices:")
            for idx, service in enumerate(serviceNames):
                self._printout(" - {}".format(bytes32_to_str(service)))
        if repositoryNames:
            self._printout("\nRepositories:")
            for idx, repo in enumerate(repositoryNames):
                self._printout(" - {}".format(bytes32_to_str(repo)))
コード例 #5
0
ファイル: commands.py プロジェクト: mdheller/snet-cli
    def list(self):
        org_list = self.call_contract_command("Registry", "listOrganizations", [])

        self._printout("# OrgId")
        for idx, org_id in enumerate(org_list):
            self._printout(bytes32_to_str(org_id))
コード例 #6
0
 def print_service_tags_from_registry(self):
     rez = self._get_service_registration()
     tags = rez["tags"]
     tags = [bytes32_to_str(tag) for tag in tags]
     self._printout(" ".join(tags))