Beispiel #1
0
    def __init__(self, mapper):
        plans_resources = plans.create_resource()
        restores_resources = restores.create_resource()
        protectables_resources = protectables.create_resource()
        providers_resources = providers.create_resource()
        trigger_resources = triggers.create_resource()
        scheduled_operation_resources = scheduled_operations.create_resource()

        mapper.resource("plan",
                        "plans",
                        controller=plans_resources,
                        collection={},
                        member={'action': 'POST'})
        mapper.resource("restore",
                        "restores",
                        controller=restores_resources,
                        collection={},
                        member={'action': 'POST'})
        mapper.resource("protectable",
                        "protectables",
                        controller=protectables_resources,
                        collection={},
                        member={})
        mapper.connect("protectable", "/{project_id}/protectables/"
                       "{protectable_type}/instances",
                       controller=protectables_resources,
                       action='instances_index',
                       conditions={"method": ['GET']})
        mapper.connect("protectable", "/{project_id}/protectables/"
                       "{protectable_type}/instances/{protectable_id}",
                       controller=protectables_resources,
                       action='instances_show',
                       conditions={"method": ['GET']})
        mapper.resource("provider",
                        "providers",
                        controller=providers_resources,
                        collection={},
                        member={})
        mapper.connect("provider",
                       "/{project_id}/providers/{provider_id}/checkpoints",
                       controller=providers_resources,
                       action='checkpoints_index',
                       conditions={"method": ['GET']})
        mapper.connect("provider",
                       "/{project_id}/providers/{provider_id}/checkpoints",
                       controller=providers_resources,
                       action='checkpoints_create',
                       conditions={"method": ['POST']})
        mapper.connect("provider",
                       "/{project_id}/providers/{provider_id}/checkpoints/"
                       "{checkpoint_id}",
                       controller=providers_resources,
                       action='checkpoints_show',
                       conditions={"method": ['GET']})
        mapper.connect("provider",
                       "/{project_id}/providers/{provider_id}/checkpoints/"
                       "{checkpoint_id}",
                       controller=providers_resources,
                       action='checkpoints_delete',
                       conditions={"method": ['DELETE']})
        mapper.resource("trigger",
                        "triggers",
                        controller=trigger_resources,
                        collection={},
                        member={'action': 'POST'})
        mapper.resource("scheduled_operation",
                        "scheduled_operations",
                        controller=scheduled_operation_resources,
                        collection={},
                        member={'action': 'POST'})
        super(APIRouter, self).__init__(mapper)
Beispiel #2
0
    def __init__(self, mapper):
        plans_resources = plans.create_resource()
        restores_resources = restores.create_resource()
        protectables_resources = protectables.create_resource()
        providers_resources = providers.create_resource()
        trigger_resources = triggers.create_resource()
        scheduled_operation_resources = scheduled_operations.create_resource()
        operation_log_resources = operation_logs.create_resource()
        verification_resources = verifications.create_resource()
        service_resources = services.create_resource()
        quota_resources = quotas.create_resource()
        quota_class_resources = quota_classes.create_resource()
        copy_resources = copies.create_resource()

        mapper.resource("plan",
                        "plans",
                        controller=plans_resources,
                        collection={},
                        member={'action': 'POST'})
        mapper.resource("restore",
                        "restores",
                        controller=restores_resources,
                        collection={},
                        member={'action': 'POST'})
        mapper.resource("protectable",
                        "protectables",
                        controller=protectables_resources,
                        collection={},
                        member={})
        mapper.connect("protectable", "/{project_id}/protectables/"
                       "{protectable_type}/instances",
                       controller=protectables_resources,
                       action='instances_index',
                       conditions={"method": ['GET']})
        mapper.connect("protectable", "/{project_id}/protectables/"
                       "{protectable_type}/instances/{protectable_id}",
                       controller=protectables_resources,
                       action='instances_show',
                       conditions={"method": ['GET']})
        mapper.resource("provider",
                        "providers",
                        controller=providers_resources,
                        collection={},
                        member={})
        mapper.connect("provider",
                       "/{project_id}/providers/{provider_id}/checkpoints",
                       controller=providers_resources,
                       action='checkpoints_index',
                       conditions={"method": ['GET']})
        mapper.connect("provider",
                       "/{project_id}/providers/{provider_id}/checkpoints",
                       controller=providers_resources,
                       action='checkpoints_create',
                       conditions={"method": ['POST']})
        mapper.connect("provider",
                       "/{project_id}/providers/{provider_id}/checkpoints/"
                       "{checkpoint_id}",
                       controller=providers_resources,
                       action='checkpoints_show',
                       conditions={"method": ['GET']})
        mapper.connect("provider",
                       "/{project_id}/providers/{provider_id}/checkpoints/"
                       "{checkpoint_id}",
                       controller=providers_resources,
                       action='checkpoints_delete',
                       conditions={"method": ['DELETE']})
        mapper.connect("provider",
                       "/{project_id}/providers/{provider_id}/checkpoints/"
                       "{checkpoint_id}",
                       controller=providers_resources,
                       action='checkpoints_update',
                       conditions={'method': ['PUT']})
        mapper.resource("trigger",
                        "triggers",
                        controller=trigger_resources,
                        collection={},
                        member={'action': 'POST'})
        mapper.resource("scheduled_operation",
                        "scheduled_operations",
                        controller=scheduled_operation_resources,
                        collection={},
                        member={'action': 'POST'})
        mapper.resource("operation_log",
                        "operation_logs",
                        controller=operation_log_resources,
                        collection={},
                        member={})
        mapper.resource("verification",
                        "verifications",
                        controller=verification_resources,
                        collection={},
                        member={'action': 'POST'})
        mapper.resource("os-service",
                        "os-services",
                        controller=service_resources,
                        collection={},
                        member={'action': 'POST'})
        mapper.resource("quota",
                        "quotas",
                        controller=quota_resources,
                        collection={},
                        member={'action': 'POST'})
        mapper.connect("quota",
                       "/{project_id}/quotas/{id}/defaults",
                       controller=quota_resources,
                       action='defaults',
                       conditions={"method": ['GET']})
        mapper.connect("quota",
                       "/{project_id}/quotas/{id}/detail",
                       controller=quota_resources,
                       action='detail',
                       conditions={"method": ['GET']})
        mapper.resource("quota_class",
                        "quota_classes",
                        controller=quota_class_resources,
                        collection={},
                        member={'action': 'POST'})
        mapper.connect("copy",
                       "/{project_id}/providers/{provider_id}/checkpoints/"
                       "action",
                       controller=copy_resources,
                       action='create',
                       conditions={"method": ['POST']})
        super(APIRouter, self).__init__(mapper)
Beispiel #3
0
    def __init__(self, mapper):
        plans_resources = plans.create_resource()
        restores_resources = restores.create_resource()
        protectables_resources = protectables.create_resource()
        providers_resources = providers.create_resource()
        trigger_resources = triggers.create_resource()
        scheduled_operation_resources = scheduled_operations.create_resource()

        mapper.resource("plan", "plans", controller=plans_resources, collection={}, member={"action": "POST"})
        mapper.resource("restore", "restores", controller=restores_resources, collection={}, member={"action": "POST"})
        mapper.resource("protectable", "protectables", controller=protectables_resources, collection={}, member={})
        mapper.connect(
            "protectable",
            "/{project_id}/protectables/" "{protectable_type}/instances",
            controller=protectables_resources,
            action="instances_index",
            conditions={"method": ["GET"]},
        )
        mapper.connect(
            "protectable",
            "/{project_id}/protectables/" "{protectable_type}/instances/{protectable_id}",
            controller=protectables_resources,
            action="instances_show",
            conditions={"method": ["GET"]},
        )
        mapper.resource("provider", "providers", controller=providers_resources, collection={}, member={})
        mapper.connect(
            "provider",
            "/{project_id}/providers/{provider_id}/checkpoints",
            controller=providers_resources,
            action="checkpoints_index",
            conditions={"method": ["GET"]},
        )
        mapper.connect(
            "provider",
            "/{project_id}/providers/{provider_id}/checkpoints",
            controller=providers_resources,
            action="checkpoints_create",
            conditions={"method": ["POST"]},
        )
        mapper.connect(
            "provider",
            "/{project_id}/providers/{provider_id}/checkpoints/" "{checkpoint_id}",
            controller=providers_resources,
            action="checkpoints_show",
            conditions={"method": ["GET"]},
        )
        mapper.connect(
            "provider",
            "/{project_id}/providers/{provider_id}/checkpoints/" "{checkpoint_id}",
            controller=providers_resources,
            action="checkpoints_delete",
            conditions={"method": ["DELETE"]},
        )
        mapper.resource("trigger", "triggers", controller=trigger_resources, collection={}, member={"action": "POST"})
        mapper.resource(
            "scheduled_operation",
            "scheduled_operations",
            controller=scheduled_operation_resources,
            collection={},
            member={"action": "POST"},
        )
        super(APIRouter, self).__init__(mapper)