Exemplo n.º 1
0
    def get_resources(self):
        resources = []
        serializer = wsgi.TroveResponseSerializer(
            body_serializers={
                'application/xml': wsgi.TroveXMLDictSerializer()
            })
        instances = extensions.ResourceExtension(
            '{tenant_id}/mgmt/instances',
            MgmtInstanceController(),
            deserializer=wsgi.TroveRequestDeserializer(),
            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
Exemplo n.º 2
0
 def __init__(self, collection, controller, parent=None,
              collection_actions=None, member_actions=None,
              deserializer=None, serializer=None):
     super(ResourceExtension, self).__init__(
         collection, controller,
         parent=parent,
         collection_actions=collection_actions,
         member_actions=member_actions,
         deserializer=wsgi.RequestDeserializer(),
         serializer=wsgi.TroveResponseSerializer())
Exemplo n.º 3
0
    def get_resources(self):
        resources = []
        serializer = wsgi.TroveResponseSerializer(
            body_serializers={
                'application/xml': wsgi.TroveXMLDictSerializer()
            })
        resource = extensions.ResourceExtension(
            '{tenant_id}/mgmt/accounts',
            service.AccountController(),
            deserializer=wsgi.RequestDeserializer(),
            serializer=serializer)
        resources.append(resource)

        return resources