Ejemplo n.º 1
0
 def _get_href_link(self, request, identifier, collection_name):
     """Return an href string pointing to this object."""
     prefix = self._update_link_prefix(request.application_url,
                                       CONF.osapi_compute_link_prefix)
     url = os.path.join(prefix, request.environ["nova.context"].project_id,
                        collection_name, str(identifier))
     if 'fields' in request.params:
         return "%s?%s" % (url,
                           common.dict_to_query_str(
                               {'fields': request.params['fields']}))
     else:
         return url
Ejemplo n.º 2
0
 def _get_href_link(self, request, identifier, collection_name):
     """Return an href string pointing to this object."""
     prefix = self._update_link_prefix(request.application_url,
                                       CONF.osapi_compute_link_prefix)
     url = os.path.join(prefix,
                        request.environ["nova.context"].project_id,
                        collection_name,
                        str(identifier))
     if 'fields' in request.params:
         return "%s?%s" % (url,
                           common.dict_to_query_str(
                               {'fields': request.params['fields']}))
     else:
         return url
Ejemplo n.º 3
0
 def _get_previous_link(self, request, identifier, collection_name):
     """
     Return href string with proper limit and marker params. If identifier
     is not specified, no marker would be added.
     :params request: webob request
     :params identifier: unique identifier for the resource
     :returns: href string with limit and marker params.
     """
     params = request.params.copy()
     if identifier:
         params["marker"] = identifier
     elif "marker" in params:
         del params["marker"]
     prefix = self._update_link_prefix(request.application_url,
                                       CONF.osapi_compute_link_prefix)
     url = os.path.join(prefix, request.environ["nova.context"].project_id,
                        collection_name)
     return "%s?%s" % (url, common.dict_to_query_str(params))
Ejemplo n.º 4
0
 def _get_previous_link(self, request, identifier, collection_name):
     """
     Return href string with proper limit and marker params. If identifier
     is not specified, no marker would be added.
     :params request: webob request
     :params identifier: unique identifier for the resource
     :returns: href string with limit and marker params.
     """
     params = request.params.copy()
     if identifier:
         params["marker"] = identifier
     elif "marker" in params:
         del params["marker"]
     prefix = self._update_link_prefix(request.application_url,
                                       CONF.osapi_compute_link_prefix)
     url = os.path.join(prefix,
                        request.environ["nova.context"].project_id,
                        collection_name)
     return "%s?%s" % (url, common.dict_to_query_str(params))
Ejemplo n.º 5
0
 def generate_next_link(self, image_id, params):
     """ Return an href string with proper limit and marker params"""
     params['marker'] = image_id
     return "%s?%s" % (
         os.path.join(self.base_url, self.project_id, "images"),
         common.dict_to_query_str(params))
Ejemplo n.º 6
0
 def generate_next_link(self, server_id, params, is_detail=False):
     """ Return an href string with proper limit and marker params"""
     params["marker"] = server_id
     return "%s?%s" % (os.path.join(self.base_url, self.project_id, "servers"), common.dict_to_query_str(params))