Esempio n. 1
0
    class Meta:
        queryset = Job.objects.all()
        resource_name = 'job'
        detail_allowed_methods = ['get', 'put', 'patch']
        list_allowed_methods = ['get', 'post']
        fields = [
            'id',
            'title',
            'description',
            'script_content',
            'script_content_partial',
            'enqueue_is_enabled',
            'reschedule_interval',
            'reschedule_interval_type',
            'run_on_all_workers',
            'schedule_children_on_error',
            'notification_addresses',
            'disable_enqueue_after_fails',
        ]
        filtering = {
            'job_template': ALL_WITH_RELATIONS,
            'title': 'exact',
        }

        authentication = MultiAuthentication(SessionAuthentication(),
                                             HmacAuthentication())

        authorization = ModelAuthorization(
            api_key_path=(
                'job_template__project__worker_pools__workers__api_key'),
            user_groups_path='job_template__project__groups',
            auth_user_groups_path='job_template__project__auth_groups',
        )
Esempio n. 2
0
    class Meta:
        queryset = Worker.objects.all()
        resource_name = 'worker'
        list_allowed_methods = ['get']
        detail_allowed_methods = ['get', 'patch']
        fields = [
            'id',
            'title',
            'api_key',
            'description',
            'enqueue_is_enabled',
            'ping_response_dts',
            'worker_version',
            'concurrent_jobs',
        ]
        filtering = {
            'api_key': ALL,
        }

        authentication = MultiAuthentication(SessionAuthentication(),
                                             HmacAuthentication())

        authorization = ModelAuthorization(
            api_key_path='api_key',
            user_groups_path='workerpool__project__groups',
        )
Esempio n. 3
0
    class Meta:
        queryset = Group.objects.all()
        resource_name = 'group'
        allowed_methods = ['get']
        fields = ['name']

        authentication = MultiAuthentication(SessionAuthentication(),
                                             HmacAuthentication())

        authorization = ModelAuthorization(
            api_key_path='project__worker_pools__workers__api_key',
            user_groups_path='',
        )
Esempio n. 4
0
    class Meta:
        queryset = RunLog.objects.all()
        resource_name = 'run_log'
        list_allowed_methods = ['get', 'post']
        detail_allowed_methods = ['get', 'patch']

        authentication = MultiAuthentication(SessionAuthentication(),
                                             HmacAuthentication())

        authorization = ModelAuthorization(
            api_key_path='run__job__worker_pool__workers__api_key',
            user_groups_path='run__job__job_template__project__groups',
            auth_user_groups_path=(
                'run__job__job_template__project__auth_groups'),
        )
Esempio n. 5
0
    class Meta:
        queryset = Project.objects.all()
        resource_name = 'project'
        allowed_methods = ['get']
        fields = ['title', 'id', 'description', 'enqueue_is_enabled']
        filtering = {
            'id': 'exact',
            'title': 'exact',
        }

        authentication = MultiAuthentication(SessionAuthentication(),
                                             HmacAuthentication())

        authorization = ModelAuthorization(
            api_key_path='worker_pools__workers__api_key',
            user_groups_path='groups',
        )
Esempio n. 6
0
    class Meta:
        queryset = JobTemplate.objects.all()
        resource_name = 'job_template'
        allowed_methods = ['get']
        fields = ['id', 'title', 'description', 'enqueue_is_enabled']
        filtering = {
            'project': ALL_WITH_RELATIONS,
            'title': 'exact',
        }

        authentication = MultiAuthentication(SessionAuthentication(),
                                             HmacAuthentication())

        authorization = ModelAuthorization(
            api_key_path='project__worker_pools__workers__api_key',
            user_groups_path='project__groups',
        )
Esempio n. 7
0
    class Meta:
        queryset = Run.objects.filter()
        resource_name = 'run'
        detail_allowed_methods = ['get', 'patch']
        list_allowed_methods = ['get', 'post']
        filtering = {
            'schedule_dts': ALL,
            'is_manual': ALL,
            'job': ALL_WITH_RELATIONS,
            'worker': ALL_WITH_RELATIONS,
        }

        authentication = MultiAuthentication(SessionAuthentication(),
                                             HmacAuthentication())

        authorization = ModelAuthorization(
            api_key_path=(
                'job__job_template__project__worker_pools__workers__api_key'),
            user_groups_path='job__job_template__project__groups',
            auth_user_groups_path='job__job_template__project__auth_groups',
        )