import logging

from rest_framework.mixins import RetrieveModelMixin, ListModelMixin
from rest_framework.viewsets import GenericViewSet

from console.models import Connection
from console.serializers import ConnectionSerializer
from core.mixins import ApiPermissionCheckMixin
from perms.models import Perm

_log = logging.getLogger(__name__)


class ConnectionViewSet(ApiPermissionCheckMixin, RetrieveModelMixin, ListModelMixin,
                        GenericViewSet):
    serializer_class = ConnectionSerializer
    console_permissions = [Perm.can_view_network]

    class Meta:
        model = Connection

    queryset = Connection.objects.all()
