Example #1
0
 class Meta:
     queryset = Director.objects\
         .select_related('time_profile', 'probe')\
         .prefetch_related(
             Prefetch('cluster', queryset=LogicalCluster.objects.annotate(Count('varnishserver')).all()),
             Prefetch('backends', queryset=Backend.objects.all().only('id', 'director_id'))
         )\
         .all()
     resource_name = 'director'
     serializer = PrettyJSONSerializer()
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication(),
                                              SessionAuthentication())
     validation = ModelCleanedDataFormValidation(
         form_class=DirectorModelForm)
     always_return_data = True
     filtering = {
         'name': ['exact'],
         'enabled': ['exact'],
         'probe': ALL_WITH_RELATIONS,
         'cluster': ALL_WITH_RELATIONS,
         'service': ['exact'],
         'virtual': ['exact'],
         'service_tag': ['exact'],
         'reachable_via_service_mesh': ['exact'],
     }
Example #2
0
 class Meta:
     queryset = Backend.objects\
         .select_related('director__time_profile', 'dc')\
         .prefetch_related('tags')\
         .extra(select={
             'status':
                 "SELECT status from monitor_backendstatus"
                 " WHERE monitor_backendstatus.address=manager_backend.address"
                 " AND monitor_backendstatus.port=manager_backend.port"
                 " LIMIT 1"
         })\
         .all()
     resource_name = 'backend'
     serializer = PrettyJSONSerializer()
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication())
     validation = ModelCleanedDataFormValidation(
         form_class=BackendModelForm)
     always_return_data = True
     filtering = {
         'dc': ALL_WITH_RELATIONS,
         'director': ALL_WITH_RELATIONS,
         'address': ['exact'],
         'port': ['exact']
     }
Example #3
0
 class Meta:
     resource_name = 'task'
     list_allowed_methods = ['get']
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication())
     fields = ['status', 'info']
     include_resource_uri = True
Example #4
0
 class Meta:
     resource_name = 'validate_routes'
     list_allowed_methods = ['post']
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication(),
                                              SessionAuthentication())
     include_resource_uri = False
Example #5
0
 class Meta:
     resource_name = 'route_config'
     list_allowed_methods = ['get']
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication())
     fields = ['lefts', 'actions', 'operators']
     include_resource_uri = False
Example #6
0
File: api.py Project: sshyran/vaas
 class Meta:
     resource_name = 'purger'
     list_allowed_methods = ['post']
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication())
     fields = ['url', 'clusters']
     include_resource_uri = False
Example #7
0
 class Meta:
     resource_name = 'validation_report'
     list_allowed_methods = ['get']
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication(),
                                              SessionAuthentication())
     fields = ['validation_results', 'validation_status', 'task_status']
     include_resource_uri = False
Example #8
0
 class Meta:
     queryset = VclTemplateBlock.objects.all()
     resource_name = 'vcl_template_block'
     serializer = PrettyJSONSerializer()
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication())
     validation = ModelCleanedDataFormValidation(
         form_class=VclTemplateBlockModelForm)
     always_return_data = True
     filtering = {'name': ['exact'], 'template': ALL_WITH_RELATIONS}
Example #9
0
 class Meta:
     queryset = Dc.objects.all()
     resource_name = 'dc'
     serializer = PrettyJSONSerializer()
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication())
     validation = ModelCleanedDataFormValidation(form_class=DcModelForm)
     always_return_data = True
     filtering = {
         'symbol': ['exact'],
     }
Example #10
0
File: api.py Project: sshyran/vaas
 class Meta:
     queryset = LogicalCluster.objects.all()
     resource_name = 'logical_cluster'
     serializer = PrettyJSONSerializer()
     authorization = DjangoAuthorization()
     validation = ModelCleanedDataFormValidation(form_class=LogicalCLusterModelForm)
     authentication = VaasMultiAuthentication(ApiKeyAuthentication())
     always_return_data = True
     filtering = {
         'name': ['exact'],
         'reload_timestamp': ['exact'],
     }
Example #11
0
File: api.py Project: sshyran/vaas
 class Meta:
     queryset = VarnishServer.objects.all()
     resource_name = 'varnish_server'
     serializer = PrettyJSONSerializer()
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication())
     validation = ModelCleanedDataFormValidation(form_class=VarnishServerModelForm)
     always_return_data = True
     filtering = {
         'ip': ['exact'],
         'cluster': ['exact']
     }
Example #12
0
 class Meta:
     queryset = Probe.objects.all()
     resource_name = 'probe'
     serializer = PrettyJSONSerializer()
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication())
     validation = ModelCleanedDataFormValidation(form_class=ProbeModelForm)
     always_return_data = True
     filtering = {
         'name': ['exact'],
         'url': ['exact'],
         'expected_response': ['exact']
     }
Example #13
0
 class Meta:
     queryset = Route.objects.all().prefetch_related('clusters')
     resource_name = 'route'
     serializer = PrettyJSONSerializer()
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication())
     validation = ModelCleanedDataFormValidation(form_class=RouteModelForm)
     always_return_data = True
     filtering = {
         'director': ALL_WITH_RELATIONS,
         'clusters': ALL_WITH_RELATIONS,
         'condition': ['icontains']
     }
Example #14
0
 class Meta:
     queryset = TimeProfile.objects.all()
     resource_name = 'time_profile'
     serializer = PrettyJSONSerializer()
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication())
     validation = ModelCleanedDataFormValidation(
         form_class=TimeProfileModelForm)
     always_return_data = True
     filtering = {
         'max_connections': ['exact'],
         'connect_timeout': ['exact'],
         'first_byte_timeout': ['exact'],
         'between_bytes_timeout': ['exact']
     }
Example #15
0
 class Meta:
     queryset = Backend.objects.all()
     resource_name = 'backend'
     serializer = PrettyJSONSerializer()
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication())
     validation = ModelCleanedDataFormValidation(
         form_class=BackendModelForm)
     always_return_data = True
     filtering = {
         'dc': ALL_WITH_RELATIONS,
         'director': ALL_WITH_RELATIONS,
         'address': ['exact'],
         'port': ['exact']
     }
Example #16
0
 class Meta:
     queryset = Director.objects.all()
     resource_name = 'director'
     serializer = PrettyJSONSerializer()
     authorization = DjangoAuthorization()
     authentication = VaasMultiAuthentication(ApiKeyAuthentication(),
                                              SessionAuthentication())
     validation = ModelCleanedDataFormValidation(
         form_class=DirectorModelForm)
     always_return_data = True
     filtering = {
         'name': ['exact'],
         'enabled': ['exact'],
         'probe': ALL_WITH_RELATIONS,
         'cluster': ALL_WITH_RELATIONS,
         'service': ['exact']
     }