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