def show(self, id, parameters=None):
     """Get resource details
     :param id: identificator
     """
     showed = []
     showed_err = []
     try:
         path = '%s/%s' % (self.default_path, self.resource)
         if id:
             path = '%s/%s' % (path, id)
         result = self.os_helper.show(path, parameters)
         if self.resource[:-1] in result:
             showed.append(result[self.resource[:-1]])
         else:
             showed.append(result[self.resource])
     except TypeError:
         result = parsers.parse_controller_err("Undefined", "Bad attribute definition for OS")
         showed_err.append(result)
     except Exception as e:
         result = parsers.parse_controller_err(id, e.message)
         showed_err.append(result)
     return showed, showed_err
 def create(self, parameters):
     """Create a resource instance in the cloud
     :param parameters: array of projects (containg their paramemters)
     """
     path = '%s/%s' % (self.default_path, self.resource)
     created = []
     error_creation = []
     for param in parameters:
         if 'name' not in param:
             raise ParseException(400, "Bad attribute definition for OS")
         try:
             result = self.os_helper.create(path, param)
             created.append(result[self.resource[:-1]])
         except Exception as e:
             result = parsers.parse_controller_err(param['name'], e.message)
             error_creation.append(result)
     return created, error_creation
 def link(self, id): # fixme(jorgesece): manage it with parameters list
     """Put link resources
     :param id: identificator
     """
     linked = []
     link_err = []
     try:
         path = '%s/%s/%s' % (self.default_path, self.resource, id)
         result = self.os_helper.put(path)
         result = parsers.parse_controller_delete("statisfully linked", id, result)
         linked.append(result)
     except TypeError:
         result = parsers.parse_controller_delete("ERROR", "Undefined", "Bad attribute definition for OS")
         link_err.append(result)
     except Exception as e:
         result = parsers.parse_controller_err(id, e.message)
         link_err.append(result)
     return linked, link_err