Exemplo n.º 1
0
    def get_resources(self):
        resources = []

        resource = extensions.ResourceExtension(
            'databases',
            mysql_service.SchemaController(),
            parent={
                'member_name': 'instance',
                'collection_name': '{tenant_id}/instances'
            })
        resources.append(resource)

        resource = extensions.ResourceExtension(
            'users',
            mysql_service.UserController(),
            parent={
                'member_name': 'instance',
                'collection_name': '{tenant_id}/instances'
            },
            member_actions={'update': 'PUT'},
            collection_actions={'update_all': 'PUT'})
        resources.append(resource)

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

        resource = extensions.ResourceExtension(
            'root',
            common_service.RootController(),
            parent={
                'member_name': 'instance',
                'collection_name': '{tenant_id}/instances'
            },
            custom_routes=[{
                'include_parent_path': True,
                'path': '/root',
                'action': 'delete',
                'method': 'DELETE'
            }])
        resources.append(resource)

        resource = extensions.ResourceExtension(
            'root',
            common_service.RootController(),
            parent={
                'member_name': 'instance',
                'collection_name': '{tenant_id}/clusters'
            })
        resources.append(resource)

        return resources
Exemplo n.º 2
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
Exemplo n.º 3
0
Arquivo: mysql.py Projeto: sitle/trove
    def get_resources(self):
        resources = []

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

        resource = extensions.ResourceExtension(
            'users',
            service.UserController(),
            parent={
                'member_name': 'instance',
                'collection_name': '{tenant_id}/instances'
            },
            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
            },
            collection_actions={'update': 'PUT'})
        resources.append(resource)

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

        return resources