예제 #1
0
파일: mysql.py 프로젝트: mlowery/trove
    def get_resources(self):
        resources = []
        serializer = wsgi.TroveResponseSerializer(
            body_serializers={
                'application/xml': wsgi.TroveXMLDictSerializer()
            })

        resource = extensions.ResourceExtension(
            'databases',
            service.SchemaController(),
            parent={
                'member_name': 'instance',
                'collection_name': '{tenant_id}/instances'
            },
            deserializer=wsgi.TroveRequestDeserializer(),
            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.TroveRequestDeserializer(),
            serializer=serializer,
            member_actions={'update': 'PUT'},
            collection_actions={'update_all': '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.TroveRequestDeserializer(),
            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.TroveRequestDeserializer(),
            serializer=serializer)
        resources.append(resource)

        return resources
예제 #2
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
예제 #3
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())
예제 #4
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
예제 #5
0
    def get_resources(self):
        resources = []
        serializer = wsgi.TroveResponseSerializer(
            body_serializers={'application/xml':
                              wsgi.TroveXMLDictSerializer()})

        if CONF.trove_security_groups_support:
            security_groups = extensions.ResourceExtension(
                '{tenant_id}/security-groups',
                service.SecurityGroupController(),
                deserializer=wsgi.TroveRequestDeserializer(),
                serializer=serializer)
            resources.append(security_groups)

            security_group_rules = extensions.ResourceExtension(
                '{tenant_id}/security-group-rules',
                service.SecurityGroupRuleController(),
                deserializer=wsgi.TroveRequestDeserializer(),
                serializer=serializer)
            resources.append(security_group_rules)

        return resources