def associate(self, network, project): """ Associates a network with project. :param project: The ID of the :class:`Network` to get. """ self.api.post("/gd-networks/%s/action" % base.getid(network), body={"associate": base.getid(project)})
def delete(self, user, key): """ Delete a keypair for a user :param user: user to delete keypair for :param key: The :class:`Keypair` (or its ID) to delete. """ self._delete('/gd-userinfo/%s/keypairs/%s' % (base.getid(user), base.getid(key)))
def get(self, user, key): """ Get specific keypair for a user :param user: user who owns the keypair :param key: The :class:`Keypair` (or its ID) to get """ return self._get('/gd-userinfo/%s/keypairs/%s' % (base.getid(user), base.getid(key)), 'keypair')
def delete(self, network): """ Delete a specific network. :param network: The ID of the :class:`Network` to get. """ self._delete("/gd-networks/%s" % base.getid(network))
def disassociate(self, network): """ Disassociate a specific network from project. :param network: The ID of the :class:`Network` to get. """ self.api.post("/gd-networks/%s/action" % base.getid(network), body={"disassociate": 1})
def get(self, network): """ Get a specific network. :param network: The ID of the :class:`Network` to get. :rtype: :class:`Network` """ return self._get("/gd-networks/%s" % base.getid(network), "network")
def get(self, server): """ Fping a specific server. :param network: The ID of the server to get. :rtype: :class:`Fping` """ return self._get("/os-fping/%s" % base.getid(server), "server")
def create(self, user, name, public_key): """ Create a keypair for a user :param user: user to create keypair for :param name: name for the keypair to create :param public_key: existing public key to import """ body = {'keypair': { 'name': name, 'public_key': public_key }} return self._create('/gd-userinfo/%s/keypairs' % base.getid(user), body, 'keypair')
def list(self, user): """ Get a list of keypairs. """ return self._list('/gd-userinfo/%s/keypairs' % base.getid(user), 'keypairs')