def get_resources(self): resources = [] body_serializers = { 'application/xml': VolumeTypesSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers) res = extensions.ResourceExtension('os-volume-types', VolumeTypesController(), serializer=serializer) resources.append(res) body_serializers = { 'application/xml': VolumeTypeExtraSpecsSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers) res = extensions.ResourceExtension( 'extra_specs', VolumeTypeExtraSpecsController(), serializer=serializer, parent=dict(member_name='vol_type', collection_name='os-volume-types')) resources.append(res) return resources
def get_resources(self): resources = [] # NOTE(justinsb): No way to provide singular name ('volume') # Does this matter? res = extensions.ResourceExtension( 'os-volumes', VolumeController(), collection_actions={'detail': 'GET'}) resources.append(res) res = extensions.ResourceExtension('os-volume_attachments', VolumeAttachmentController(), parent=dict( member_name='server', collection_name='servers')) resources.append(res) res = extensions.ResourceExtension('os-volumes_boot', BootFromVolumeController()) resources.append(res) res = extensions.ResourceExtension( 'os-snapshots', SnapshotController(), collection_actions={'detail': 'GET'}) resources.append(res) return resources
def get_resources(self): resources = [] metadata = _get_metadata() body_serializers = { 'application/xml': wsgi.XMLDictSerializer(metadata=metadata, xmlns=wsgi.XMLNS_V11), } serializer = wsgi.ResponseSerializer(body_serializers, None) body_deserializers = { 'application/xml': SecurityGroupXMLDeserializer(), } deserializer = wsgi.RequestDeserializer(body_deserializers) res = extensions.ResourceExtension( 'os-security-groups', controller=SecurityGroupController(), deserializer=deserializer, serializer=serializer) resources.append(res) body_deserializers = { 'application/xml': SecurityGroupRulesXMLDeserializer(), } deserializer = wsgi.RequestDeserializer(body_deserializers) res = extensions.ResourceExtension( 'os-security-group-rules', controller=SecurityGroupRulesController(), deserializer=deserializer, serializer=serializer) resources.append(res) return resources
def get_resources(self): resources = [] res = extensions.ResourceExtension( 'os-security-groups', controller=SecurityGroupController()) resources.append(res) res = extensions.ResourceExtension( 'os-security-group-rules', controller=SecurityGroupRulesController()) resources.append(res) return resources
def get_resources(self): resources = [] res = extensions.ResourceExtension('os-volume-types', VolumeTypesController()) resources.append(res) res = extensions.ResourceExtension( 'extra_specs', VolumeTypeExtraSpecsController(), parent=dict(member_name='vol_type', collection_name='os-volume-types')) resources.append(res) return resources
def get_resources(self): resources = [] body_serializers = { 'application/xml': VolumeSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers) # NOTE(justinsb): No way to provide singular name ('volume') # Does this matter? res = extensions.ResourceExtension( 'os-volumes', VolumeController(), serializer=serializer, collection_actions={'detail': 'GET'}) resources.append(res) body_serializers = { 'application/xml': VolumeAttachmentSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers) res = extensions.ResourceExtension('os-volume_attachments', VolumeAttachmentController(), serializer=serializer, parent=dict( member_name='server', collection_name='servers')) resources.append(res) headers_serializer = servers.HeadersSerializer() body_serializers = { 'application/xml': servers.ServerXMLSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers, headers_serializer) body_deserializers = { 'application/xml': servers.ServerXMLDeserializer(), } deserializer = wsgi.RequestDeserializer(body_deserializers) res = extensions.ResourceExtension('os-volumes_boot', BootFromVolumeController(), serializer=serializer, deserializer=deserializer) resources.append(res) return resources
def get_resources(self): resources = [] res = extensions.ResourceExtension('os-keypairs', KeypairController()) resources.append(res) return resources
def get_resources(self): parent_def = {'member_name': 'server', 'collection_name': 'servers'} #NOTE(bcwaldon): This should be prefixed with 'os-' ext = extensions.ResourceExtension('actions', ServerActionListController(), parent=parent_def) return [ext]
def get_resources(self): coll_actions = {'detail': 'GET'} res = extensions.ResourceExtension('users', Controller(), collection_actions=coll_actions) return [res]
def get_resources(self): resources = [] res = extensions.ResourceExtension('os-floating-ip-dns', FloatingIPDNSController()) resources.append(res) return resources
def get_resources(self): resources = [] res = extensions.ResourceExtension('os-simple-tenant-usage', SimpleTenantUsageController()) resources.append(res) return resources
def get_resources(self): resources = [] res = extensions.ResourceExtension('os-quota-sets', QuotaSetsController(), member_actions={'defaults': 'GET'}) resources.append(res) return resources
def get_resources(self): resources = [] controller = Controller() res = extensions.ResourceExtension('os-create-server-ext', controller=controller) resources.append(res) return resources
def get_resources(self): resources = [] res = extensions.ResourceExtension('os-floating-ips', FloatingIPController(), member_actions={}) resources.append(res) return resources
def get_resources(self): resources = [] res = extensions.ResourceExtension( 'zadr-vsa', VsaController(), collection_actions={'detail': 'GET'}, member_actions={ 'add_capacity': 'POST', 'remove_capacity': 'POST', 'associate_address': 'POST', 'disassociate_address': 'POST' }) resources.append(res) res = extensions.ResourceExtension( 'volumes', VsaVolumeController(), collection_actions={'detail': 'GET'}, parent=dict(member_name='vsa', collection_name='zadr-vsa')) resources.append(res) res = extensions.ResourceExtension( 'drives', VsaDriveController(), collection_actions={'detail': 'GET'}, parent=dict(member_name='vsa', collection_name='zadr-vsa')) resources.append(res) res = extensions.ResourceExtension('vpools', VsaVPoolController(), parent=dict( member_name='vsa', collection_name='zadr-vsa')) resources.append(res) res = extensions.ResourceExtension('instances', VsaVCController(), parent=dict( member_name='vsa', collection_name='zadr-vsa')) resources.append(res) return resources
def get_resources(self): resources = [] res = extensions.ResourceExtension( 'os-virtual-interfaces', controller=ServerVirtualInterfaceController(), parent=dict(member_name='server', collection_name='servers')) resources.append(res) return resources
def test_get_resources_with_controller(self): res_ext = extensions.ResourceExtension('tweedles', StubController(response_body)) manager = StubExtensionManager(res_ext) app = v2.APIRouter(manager) ext_midware = extensions.ExtensionMiddleware(app, manager) ser_midware = wsgi.LazySerializationMiddleware(ext_midware) request = webob.Request.blank("/123/tweedles") response = request.get_response(ser_midware) self.assertEqual(200, response.status_int) self.assertEqual(response_body, response.body)
def get_resources(self): resources = [] res = extensions.ResourceExtension('os-extra_specs', FlavorExtraSpecsController(), parent=dict( member_name='flavor', collection_name='flavors')) resources.append(res) return resources
def get_resources(self): resources = [] body_serializers = { 'application/xml': CloudpipeSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers) res = extensions.ResourceExtension('os-cloudpipe', CloudpipeController(), serializer=serializer) resources.append(res) return resources
def get_resources(self): body_serializers = { 'application/xml': AccountXMLSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers) #TODO(bcwaldon): This should be prefixed with 'os-' res = extensions.ResourceExtension('accounts', Controller(), serializer=serializer) return [res]
def get_resources(self): #NOTE(bcwaldon): This resource should be prefixed with 'os-' coll_actions = { 'detail': 'GET', 'info': 'GET', 'select': 'POST', } res = extensions.ResourceExtension('zones', Controller(), collection_actions=coll_actions) return [res]
def get_resources(self): resources = [ extensions.ResourceExtension('os-hosts', HostController(), collection_actions={'update': 'PUT'}, member_actions={ "startup": "GET", "shutdown": "GET", "reboot": "GET" }) ] return resources
def get_resources(self): body_serializers = { 'application/xml': UserXMLSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers) coll_actions = {'detail': 'GET'} res = extensions.ResourceExtension('users', Controller(), serializer=serializer, collection_actions=coll_actions) return [res]
def get_resources(self): resources = [] body_serializers = {'application/xml': VirtualInterfaceSerializer()} serializer = wsgi.ResponseSerializer(body_serializers, None) res = extensions.ResourceExtension( 'os-virtual-interfaces', controller=ServerVirtualInterfaceController(), parent=dict(member_name='server', collection_name='servers'), serializer=serializer) resources.append(res) return resources
def get_resources(self): resources = [] body_serializers = { 'application/xml': SimpleTenantUsageSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers) res = extensions.ResourceExtension('os-simple-tenant-usage', SimpleTenantUsageController(), serializer=serializer) resources.append(res) return resources
def get_resources(self): resources = [] body_serializers = { 'application/xml': KeypairsSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers) res = extensions.ResourceExtension('os-keypairs', KeypairController(), serializer=serializer) resources.append(res) return resources
def get_resources(self): resources = [] body_serializers = { 'application/xml': FloatingIPDNSSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers) res = extensions.ResourceExtension('os-floating-ip-dns', FloatingIPDNSController(), serializer=serializer) resources.append(res) return resources
def get_resources(self): resources = [] body_serializers = { 'application/xml': FloatingIPPoolsSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers) res = extensions.ResourceExtension('os-floating-ip-pools', FloatingIPPoolsController(), serializer=serializer, member_actions={}) resources.append(res) return resources
def get_resources(self): resources = [] body_serializers = { 'application/xml': ExtraSpecsSerializer(), } serializer = wsgi.ResponseSerializer(body_serializers) res = extensions.ResourceExtension('os-extra_specs', FlavorExtraSpecsController(), serializer=serializer, parent=dict( member_name='flavor', collection_name='flavors')) resources.append(res) return resources
def test_non_exist_resource(self): res_ext = extensions.ResourceExtension('tweedles', StubController(response_body)) manager = StubExtensionManager(res_ext) app = v2.APIRouter(manager) ext_midware = extensions.ExtensionMiddleware(app, manager) ser_midware = wsgi.LazySerializationMiddleware(ext_midware) request = webob.Request.blank("/123/tweedles/1") response = request.get_response(ser_midware) self.assertEqual(404, response.status_int) self.assertEqual('application/json', response.content_type) body = json.loads(response.body) expected = { "itemNotFound": { "message": "The resource could not be found.", "code": 404 } } self.assertDictMatch(expected, body)