'name': sess.tenant_id, 'enabled': True}]}) except KeyError: request.setResponseCode(401) return json.dumps({'unauthorized': { 'code': 401, 'message': ("No valid token provided. Please use the 'X-Auth-Token'" " header with a valid token.")}}) def base_uri_from_request(request): """ Given a request, return the base URI of the request :param request: a twisted HTTP request :type request: :class:`twisted.web.http.Request` :return: the base uri the request was trying to access :rtype: ``str`` """ return str(URLPath.fromRequest(request).click(b'/')) AuthControlApiBehaviors = make_behavior_api({'auth': authentication}) """ Handlers for CRUD operations on authentication behaviors. :ivar registry_collection: an instance of :class:`mimic.model.behaviors.BehaviorRegistryCollection` """
for region in self.nova_api._regions ] ) ] def resource_for_region(self, region, uri_prefix, session_store): """ Get an :obj:`twisted.web.iweb.IResource` for the given URI prefix; implement :obj:`IAPIMock`. """ return (NovaControlApiRegion(api_mock=self, uri_prefix=uri_prefix, session_store=session_store, region=region) .app.resource()) NovaControlApiRegionBehaviors = make_behavior_api( {'creation': server_creation}) """ Handlers for CRUD operations on create server behaviors. :ivar registry_collection: an instance of :class:`mimic.model.behaviors.BehaviorRegistryColelction` """ @attributes(["api_mock", "uri_prefix", "session_store", "region"]) class NovaControlApiRegion(object): """ Klein resources for the Nova Control plane API """ app = MimicApp()
"cloudServersBehavior", [Endpoint(tenant_id, region, text_type(uuid4()), prefix="v2") for region in self.nova_api._regions], ) ] def resource_for_region(self, region, uri_prefix, session_store): """ Get an :obj:`twisted.web.iweb.IResource` for the given URI prefix; implement :obj:`IAPIMock`. """ return NovaControlApiRegion( api_mock=self, uri_prefix=uri_prefix, session_store=session_store, region=region ).app.resource() NovaControlApiRegionBehaviors = make_behavior_api({"creation": server_creation}) """ Handlers for CRUD operations on create server behaviors. :ivar registry_collection: an instance of :class:`mimic.model.behaviors.BehaviorRegistryColelction` """ @attributes(["api_mock", "uri_prefix", "session_store", "region"]) class NovaControlApiRegion(object): """ Klein resources for the Nova Control plane API """ app = MimicApp()
else: request.setResponseCode(204) return b'' return json.dumps( not_found( "Unable to locate an External API with the given Template ID.", request)) def base_uri_from_request(request): """ Given a request, return the base URI of the request :param request: a twisted HTTP request :type request: :class:`twisted.web.http.Request` :return: the base uri the request was trying to access :rtype: ``str`` """ return str(URLPath.fromRequest(request).click(b'/')) AuthControlApiBehaviors = make_behavior_api({'auth': authentication}) """ Handlers for CRUD operations on authentication behaviors. :ivar registry_collection: an instance of :class:`mimic.model.behaviors.BehaviorRegistryCollection` """