4 from geni.util.faults import *
5 from geni.util.method import Method
6 from geni.util.parameter import Parameter, Mixed
7 from geni.util.auth import Auth
8 from geni.util.cert import Keypair
10 class create_gid(Method):
12 Create a new GID. For MAs and SAs that are physically located on the
13 registry, this allows a owner/operator/PI to create a new GID and have it
14 signed by his respective authority.
16 @param cred credential of caller
17 @param name hrn for new GID
18 @param uuid unique identifier for new GID
19 @param pkey_string public-key string (TODO: why is this a string and not a keypair object?)
21 @return the string representation of a GID object
24 interfaces = ['registry']
27 Parameter(str, "Credential string"),
28 Parameter(str, "Human readable name (hrn)"),
29 Mixed(Parameter(str, "Unique identifier for new GID (uuid)"),
30 Parameter(None, "Unique identifier (uuid) not specified")),
31 Parameter(str, "public-key string")
34 returns = Parameter(str, "String represeneation of a GID object")
36 def call(self, cred, hrn, uuid, pubkey_str):
37 self.api.auth.check(cred, "getcredential")
38 self.api.auth.verify_object_belongs_to_me(hrn)
39 self.api.auth.verify_object_permission(hrn)
45 pkey.load_pubkey_from_string(pubkey_str)
46 gid = self.api.auth.hierarchy.create_gid(hrn, uuid, pkey)
48 return gid.save_to_string(save_parents=True)