Example #1
0
    def get_resources(self):
        resources = []
        serializer = wsgi.ReddwarfResponseSerializer(
            body_serializers={
                'application/xml': wsgi.ReddwarfXMLDictSerializer()
            })
        instances = extensions.ResourceExtension(
            '{tenant_id}/mgmt/instances',
            MgmtInstanceController(),
            deserializer=wsgi.ReddwarfRequestDeserializer(),
            serializer=serializer,
            member_actions={
                'root': 'GET',
                'diagnostics': 'GET',
                'hwinfo': 'GET',
                'action': 'POST'
            })
        resources.append(instances)

        hosts = extensions.ResourceExtension(
            '{tenant_id}/mgmt/hosts',
            HostController(),
            deserializer=wsgi.RequestDeserializer(),
            serializer=serializer,
            member_actions={})
        resources.append(hosts)

        quota = extensions.ResourceExtension(
            '{tenant_id}/mgmt/quotas',
            QuotaController(),
            deserializer=wsgi.RequestDeserializer(),
            serializer=serializer,
            member_actions={})
        resources.append(quota)

        storage = extensions.ResourceExtension(
            '{tenant_id}/mgmt/storage',
            StorageController(),
            deserializer=wsgi.RequestDeserializer(),
            serializer=serializer,
            member_actions={})
        resources.append(storage)

        host_instances = extensions.ResourceExtension(
            'instances',
            hostservice.HostInstanceController(),
            parent={
                'member_name': 'host',
                'collection_name': '{tenant_id}/mgmt/hosts'
            },
            deserializer=wsgi.RequestDeserializer(),
            serializer=serializer,
            collection_actions={'action': 'POST'})
        resources.append(host_instances)

        return resources
Example #2
0
    def get_resources(self):
        resources = []
        serializer = wsgi.ReddwarfResponseSerializer(
            body_serializers={
                'application/xml': wsgi.ReddwarfXMLDictSerializer()
            })

        resource = extensions.ResourceExtension(
            'databases',
            service.SchemaController(),
            parent={
                'member_name': 'instance',
                'collection_name': '{tenant_id}/instances'
            },
            deserializer=wsgi.ReddwarfRequestDeserializer(),
            serializer=serializer)
        resources.append(resource)

        resource = extensions.ResourceExtension(
            'users',
            service.UserController(),
            parent={
                'member_name': 'instance',
                'collection_name': '{tenant_id}/instances'
            },
            # deserializer=extensions.ExtensionsXMLSerializer()
            deserializer=wsgi.ReddwarfRequestDeserializer(),
            serializer=serializer,
            collection_actions={'update': 'PUT'})
        resources.append(resource)

        collection_url = '{tenant_id}/instances/:instance_id/users'
        resource = extensions.ResourceExtension(
            'databases',
            service.UserAccessController(),
            parent={
                'member_name': 'user',
                'collection_name': collection_url
            },
            deserializer=wsgi.ReddwarfRequestDeserializer(),
            serializer=serializer,
            collection_actions={'update': 'PUT'})
        resources.append(resource)

        resource = extensions.ResourceExtension(
            'root',
            service.RootController(),
            parent={
                'member_name': 'instance',
                'collection_name': '{tenant_id}/instances'
            },
            deserializer=wsgi.ReddwarfRequestDeserializer(),
            serializer=serializer)
        resources.append(resource)

        return resources
Example #3
0
    def get_resources(self):
        resources = []
        serializer = wsgi.ReddwarfResponseSerializer(
            body_serializers={'application/xml':
                              wsgi.ReddwarfXMLDictSerializer()})
        resource = extensions.ResourceExtension(
            '{tenant_id}/mgmt/accounts',
            service.AccountController(),
            deserializer=wsgi.RequestDeserializer(),
            serializer=serializer)
        resources.append(resource)

        return resources
Example #4
0
    def get_resources(self):
        resources = []
        serializer = wsgi.ReddwarfResponseSerializer(
            body_serializers={'application/xml':
                              wsgi.ReddwarfXMLDictSerializer()})

        if CONF.reddwarf_security_groups_support:
            security_groups = extensions.ResourceExtension(
                '{tenant_id}/security_groups',
                service.SecurityGroupController(),
                deserializer=wsgi.ReddwarfRequestDeserializer(),
                serializer=serializer)
            resources.append(security_groups)

            security_group_rules = extensions.ResourceExtension(
                '{tenant_id}/security_group_rules',
                service.SecurityGroupRuleController(),
                deserializer=wsgi.ReddwarfRequestDeserializer(),
                serializer=serializer)
            resources.append(security_group_rules)

        return resources