Exemple #1
0
    def _setup_routes(self, mapper, ext_mgr):
        mapper.redirect("", "/")

        self.resources['providers'] = providers.create_resource()
        mapper.resource('provider',
                        'providers',
                        controller=self.resources['providers'])

        self.resources['regions'] = regions.create_resource()
        mapper.resource('region',
                        'regions',
                        controller=self.resources['regions'],
                        collection={'detail': 'GET'})

        self.resources['endpoints'] = endpoints.create_resource()
        mapper.resource('endpoint',
                        'endpoints',
                        controller=self.resources['endpoints'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        self.resources['services'] = services.create_resource()
        mapper.resource('service',
                        'services',
                        controller=self.resources['services'],
                        collection={'detail': 'GET'})

        self.resources['minion_pools'] = minion_pools.create_resource()
        mapper.resource('minion_pool',
                        'minion_pools',
                        controller=self.resources['minion_pools'],
                        collection={'detail': 'GET'})

        minion_pool_actions_resource = minion_pool_actions.create_resource()
        self.resources['minion_pool_actions'] = minion_pool_actions_resource
        minion_pool_path = '/{project_id}/minion_pools/{id}'
        mapper.connect('minion_pool_actions',
                       minion_pool_path + '/actions',
                       controller=self.resources['minion_pool_actions'],
                       action='action',
                       conditions={'method': 'POST'})

        self.resources['minion_pool_tasks_executions'] = \
            minion_pool_tasks_executions.create_resource()
        mapper.resource(
            'minion_pools',
            'minion_pools/{minion_pool_id}/executions',
            controller=self.resources['minion_pool_tasks_executions'],
            collection={'detail': 'GET'},
            member={'action': 'POST'})

        minion_pool_tasks_execution_actions_resource = \
            minion_pool_tasks_execution_actions.create_resource()
        self.resources['minion_pool_tasks_execution_actions'] = \
            minion_pool_tasks_execution_actions_resource
        pool_execution_path = (
            '/{project_id}/minion_pools/{minion_pool_id}/executions/{id}')
        mapper.connect(
            'minion_pool_tasks_execution_actions',
            pool_execution_path + '/actions',
            controller=self.resources['minion_pool_tasks_execution_actions'],
            action='action',
            conditions={'method': 'POST'})

        self.resources['endpoint_source_minion_pool_options'] = \
            endpoint_source_minion_pool_options.create_resource()
        mapper.resource(
            'minion_pool_options',
            'endpoints/{endpoint_id}/source-minion-pool-options',
            controller=(self.resources['endpoint_source_minion_pool_options']))

        self.resources['endpoint_destination_minion_pool_options'] = \
            endpoint_destination_minion_pool_options.create_resource()
        mapper.resource(
            'minion_pool_options',
            'endpoints/{endpoint_id}/destination-minion-pool-options',
            controller=(
                self.resources['endpoint_destination_minion_pool_options']))

        endpoint_actions_resource = endpoint_actions.create_resource()
        self.resources['endpoint_actions'] = endpoint_actions_resource
        endpoint_path = '/{project_id}/endpoints/{id}'
        mapper.connect('endpoint_actions',
                       endpoint_path + '/actions',
                       controller=self.resources['endpoint_actions'],
                       action='action',
                       conditions={'method': 'POST'})

        self.resources['endpoint_instances'] = \
            endpoint_instances.create_resource()
        mapper.resource('instance',
                        'endpoints/{endpoint_id}/instances',
                        controller=self.resources['endpoint_instances'])

        self.resources['endpoint_networks'] = \
            endpoint_networks.create_resource()
        mapper.resource('network',
                        'endpoints/{endpoint_id}/networks',
                        controller=self.resources['endpoint_networks'])

        self.resources['endpoint_storage'] = \
            endpoint_storage.create_resource()
        mapper.resource('storage',
                        'endpoints/{endpoint_id}/storage',
                        controller=self.resources['endpoint_storage'])

        self.resources['endpoint_destination_options'] = \
            endpoint_destination_options.create_resource()
        mapper.resource(
            'destination_options',
            'endpoints/{endpoint_id}/destination-options',
            controller=(self.resources['endpoint_destination_options']))

        self.resources['endpoint_source_options'] = \
            endpoint_source_options.create_resource()
        mapper.resource('source_options',
                        'endpoints/{endpoint_id}/source-options',
                        controller=(self.resources['endpoint_source_options']))

        self.resources['provider_schemas'] = \
            provider_schemas.create_resource()
        mapper.resource('provider_schemas',
                        'providers/{platform_name}/schemas/{provider_type}',
                        controller=self.resources['provider_schemas'])

        self.resources['migrations'] = migrations.create_resource()
        mapper.resource('migration',
                        'migrations',
                        controller=self.resources['migrations'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        migration_actions_resource = migration_actions.create_resource()
        self.resources['migration_actions'] = migration_actions_resource
        migration_path = '/{project_id}/migrations/{id}'
        mapper.connect('migration_actions',
                       migration_path + '/actions',
                       controller=self.resources['migration_actions'],
                       action='action',
                       conditions={'method': 'POST'})

        self.resources['replicas'] = replicas.create_resource()
        mapper.resource('replica',
                        'replicas',
                        controller=self.resources['replicas'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        replica_actions_resource = replica_actions.create_resource()
        self.resources['replica_actions'] = replica_actions_resource
        migration_path = '/{project_id}/replicas/{id}'
        mapper.connect('replica_actions',
                       migration_path + '/actions',
                       controller=self.resources['replica_actions'],
                       action='action',
                       conditions={'method': 'POST'})

        self.resources['replica_tasks_executions'] = \
            replica_tasks_executions.create_resource()
        mapper.resource('execution',
                        'replicas/{replica_id}/executions',
                        controller=self.resources['replica_tasks_executions'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        replica_tasks_execution_actions_resource = \
            replica_tasks_execution_actions.create_resource()
        self.resources['replica_tasks_execution_actions'] = \
            replica_tasks_execution_actions_resource
        migration_path = '/{project_id}/replicas/{replica_id}/executions/{id}'
        mapper.connect(
            'replica_tasks_execution_actions',
            migration_path + '/actions',
            controller=self.resources['replica_tasks_execution_actions'],
            action='action',
            conditions={'method': 'POST'})

        sched = replica_schedules.create_resource()
        self.resources['replica_schedules'] = sched
        mapper.resource('replica_schedule',
                        'replicas/{replica_id}/schedules',
                        controller=self.resources['replica_schedules'],
                        collection={'index': 'GET'},
                        member={'action': 'POST'})

        diag = diagnostics.create_resource()
        self.resources['diagnostics'] = diag
        mapper.resource('diagnostics',
                        'diagnostics',
                        controller=self.resources['diagnostics'])
Exemple #2
0
    def _setup_routes(self, mapper, ext_mgr):
        mapper.redirect("", "/")

        self.resources['providers'] = providers.create_resource()
        mapper.resource('provider',
                        'providers',
                        controller=self.resources['providers'])

        self.resources['endpoints'] = endpoints.create_resource()
        mapper.resource('endpoint',
                        'endpoints',
                        controller=self.resources['endpoints'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        endpoint_actions_resource = endpoint_actions.create_resource()
        self.resources['endpoint_actions'] = endpoint_actions_resource
        endpoint_path = '/{project_id}/endpoints/{id}'
        mapper.connect('endpoint_actions',
                       endpoint_path + '/actions',
                       controller=self.resources['endpoint_actions'],
                       action='action',
                       conditions={'method': 'POST'})

        self.resources['endpoint_instances'] = \
            endpoint_instances.create_resource()
        mapper.resource('instance',
                        'endpoints/{endpoint_id}/instances',
                        controller=self.resources['endpoint_instances'])

        self.resources['endpoint_networks'] = \
            endpoint_networks.create_resource()
        mapper.resource('network',
                        'endpoints/{endpoint_id}/networks',
                        controller=self.resources['endpoint_networks'])

        self.resources['provider_schemas'] = \
            provider_schemas.create_resource()
        mapper.resource('provider_schemas',
                        'providers/{platform_name}/schemas/{provider_type}',
                        controller=self.resources['provider_schemas'])

        self.resources['migrations'] = migrations.create_resource()
        mapper.resource('migration',
                        'migrations',
                        controller=self.resources['migrations'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        migration_actions_resource = migration_actions.create_resource()
        self.resources['migration_actions'] = migration_actions_resource
        migration_path = '/{project_id}/migrations/{id}'
        mapper.connect('migration_actions',
                       migration_path + '/actions',
                       controller=self.resources['migration_actions'],
                       action='action',
                       conditions={'method': 'POST'})

        self.resources['replicas'] = replicas.create_resource()
        mapper.resource('replica',
                        'replicas',
                        controller=self.resources['replicas'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        replica_actions_resource = replica_actions.create_resource()
        self.resources['replica_actions'] = replica_actions_resource
        migration_path = '/{project_id}/replicas/{id}'
        mapper.connect('replica_actions',
                       migration_path + '/actions',
                       controller=self.resources['replica_actions'],
                       action='action',
                       conditions={'method': 'POST'})

        self.resources['replica_tasks_executions'] = \
            replica_tasks_executions.create_resource()
        mapper.resource('execution',
                        'replicas/{replica_id}/executions',
                        controller=self.resources['replica_tasks_executions'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        replica_tasks_execution_actions_resource = \
            replica_tasks_execution_actions.create_resource()
        self.resources['replica_tasks_execution_actions'] = \
            replica_tasks_execution_actions_resource
        migration_path = '/{project_id}/replicas/{replica_id}/executions/{id}'
        mapper.connect(
            'replica_tasks_execution_actions',
            migration_path + '/actions',
            controller=self.resources['replica_tasks_execution_actions'],
            action='action',
            conditions={'method': 'POST'})

        sched = replica_schedules.create_resource()
        self.resources['replica_schedules'] = sched
        mapper.resource('replica_schedule',
                        'replicas/{replica_id}/schedules',
                        controller=self.resources['replica_schedules'],
                        collection={'index': 'GET'},
                        member={'action': 'POST'})