Esempio n. 1
0
    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
Esempio n. 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
Esempio n. 3
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