Skip to content

# Circuit Maintenance API Package

## `nautobot_circuit_maintenance.api`

REST API module for circuit maintenance app.

### `serializers`

Serializer for Circuit Maintenance API.

#### `CircuitImpactSerializer`

Bases: `NautobotModelSerializer`

Serializer for API.

Source code in `nautobot_circuit_maintenance/api/serializers.py`

    64
    65
    66
    67
    68
    69
    70
    71
    class CircuitImpactSerializer(NautobotModelSerializer):
        """Serializer for API."""

        class Meta:
            """Meta class for CircuitImpactSerializer."""

            model = CircuitImpact
            fields = "__all__"

##### `Meta`

Meta class for CircuitImpactSerializer.

Source code in `nautobot_circuit_maintenance/api/serializers.py`

    67
    68
    69
    70
    71
    class Meta:
        """Meta class for CircuitImpactSerializer."""

        model = CircuitImpact
        fields = "__all__"

#### `CircuitMaintenanceSerializer`

Bases: `NautobotModelSerializer`

Serializer for API.

Source code in `nautobot_circuit_maintenance/api/serializers.py`

    14
    15
    16
    17
    18
    19
    20
    21
    class CircuitMaintenanceSerializer(NautobotModelSerializer):
        """Serializer for API."""

        class Meta:
            """Meta class for MaintenanceSerializer."""

            model = CircuitMaintenance
            fields = "__all__"

##### `Meta`

Meta class for MaintenanceSerializer.

Source code in `nautobot_circuit_maintenance/api/serializers.py`

    17
    18
    19
    20
    21
    class Meta:
        """Meta class for MaintenanceSerializer."""

        model = CircuitMaintenance
        fields = "__all__"

#### `NoteSerializer`

Bases: `NautobotModelSerializer`

Serializer for API.

Source code in `nautobot_circuit_maintenance/api/serializers.py`

    44
    45
    46
    47
    48
    49
    50
    51
    class NoteSerializer(NautobotModelSerializer):
        """Serializer for API."""

        class Meta:
            """Meta class for MaintenanceNoteSerializer."""

            model = Note
            fields = "__all__"

##### `Meta`

Meta class for MaintenanceNoteSerializer.

Source code in `nautobot_circuit_maintenance/api/serializers.py`

    47
    48
    49
    50
    51
    class Meta:
        """Meta class for MaintenanceNoteSerializer."""

        model = Note
        fields = "__all__"

#### `NotificationSourceSerializer`

Bases: `NautobotModelSerializer`

Serializer for NotificationSource records.

Source code in `nautobot_circuit_maintenance/api/serializers.py`

    54
    55
    56
    57
    58
    59
    60
    61
    class NotificationSourceSerializer(NautobotModelSerializer):
        """Serializer for NotificationSource records."""

        class Meta:
            """Meta class for NotificationSourceSerializer."""

            model = NotificationSource
            fields = "__all__"

##### `Meta`

Meta class for NotificationSourceSerializer.

Source code in `nautobot_circuit_maintenance/api/serializers.py`

    57
    58
    59
    60
    61
    class Meta:
        """Meta class for NotificationSourceSerializer."""

        model = NotificationSource
        fields = "__all__"

#### `ParsedNotificationSerializer`

Bases: `NautobotModelSerializer`

Serializer for API.

Source code in `nautobot_circuit_maintenance/api/serializers.py`

    24
    25
    26
    27
    28
    29
    30
    31
    class ParsedNotificationSerializer(NautobotModelSerializer):
        """Serializer for API."""

        class Meta:
            """Meta class for ParsedNotificationSerializer."""

            model = ParsedNotification
            fields = "__all__"

##### `Meta`

Meta class for ParsedNotificationSerializer.

Source code in `nautobot_circuit_maintenance/api/serializers.py`

    27
    28
    29
    30
    31
    class Meta:
        """Meta class for ParsedNotificationSerializer."""

        model = ParsedNotification
        fields = "__all__"

#### `RawNotificationSerializer`

Bases: `NautobotModelSerializer`

Serializer for API.

Source code in `nautobot_circuit_maintenance/api/serializers.py`

    34
    35
    36
    37
    38
    39
    40
    41
    class RawNotificationSerializer(NautobotModelSerializer):
        """Serializer for API."""

        class Meta:
            """Meta class for RawNotificationSerializer."""

            model = RawNotification
            fields = "__all__"

##### `Meta`

Meta class for RawNotificationSerializer.

Source code in `nautobot_circuit_maintenance/api/serializers.py`

    37
    38
    39
    40
    41
    class Meta:
        """Meta class for RawNotificationSerializer."""

        model = RawNotification
        fields = "__all__"

### `urls`

URLS for Circuit Maintenance API.

### `views`

Views for API.

#### `MaintenanceCircuitImpactTaskView`

Bases: `CustomFieldModelViewSet`

API view for Circuit Impact CRUD operations.

Source code in `nautobot_circuit_maintenance/api/views.py`

    42
    43
    44
    45
    46
    47
    class MaintenanceCircuitImpactTaskView(CustomFieldModelViewSet):
        """API view for Circuit Impact CRUD operations."""

        queryset = CircuitImpact.objects.prefetch_related()
        serializer_class = CircuitImpactSerializer
        filterset_class = filters.CircuitImpactFilterSet

#### `MaintenanceNoteTaskView`

Bases: `CustomFieldModelViewSet`

API view for Circuit Note CRUD operations.

Source code in `nautobot_circuit_maintenance/api/views.py`

    35
    36
    37
    38
    39
    class MaintenanceNoteTaskView(CustomFieldModelViewSet):
        """API view for Circuit Note CRUD operations."""

        queryset = Note.objects.prefetch_related()
        serializer_class = NoteSerializer

#### `MaintenanceTaskView`

Bases: `CustomFieldModelViewSet`

API view for Circuit Maintenance CRUD operations.

Source code in `nautobot_circuit_maintenance/api/views.py`

    27
    28
    29
    30
    31
    32
    class MaintenanceTaskView(CustomFieldModelViewSet):
        """API view for Circuit Maintenance CRUD operations."""

        queryset = CircuitMaintenance.objects.prefetch_related()
        serializer_class = CircuitMaintenanceSerializer
        filterset_class = filters.CircuitMaintenanceFilterSet

#### `NotificationSourceTaskView`

Bases: `ReadOnlyModelViewSet`

API view for Notification Source CRUD operations.

Source code in `nautobot_circuit_maintenance/api/views.py`

    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    class NotificationSourceTaskView(viewsets.ReadOnlyModelViewSet):
        """API view for Notification Source CRUD operations."""

        queryset = NotificationSource.objects.prefetch_related()
        serializer_class = NotificationSourceSerializer
        filterset_class = filters.NotificationSourceFilterSet

        def get_serializer_context(self):
            """Add custom fields to the serializer context, as in nautobot.extras.api.views.CustomFieldModelViewSet."""
            # Gather all custom fields for the model
            content_type = ContentType.objects.get_for_model(self.queryset.model)
            custom_fields = content_type.custom_fields.all()

            context = super().get_serializer_context()
            context.update(
                {
                    "custom_fields": custom_fields,
                }
            )
            return context

##### `get_serializer_context()`

Add custom fields to the serializer context, as in nautobot.extras.api.views.CustomFieldModelViewSet.

Source code in `nautobot_circuit_maintenance/api/views.py`

    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    def get_serializer_context(self):
        """Add custom fields to the serializer context, as in nautobot.extras.api.views.CustomFieldModelViewSet."""
        # Gather all custom fields for the model
        content_type = ContentType.objects.get_for_model(self.queryset.model)
        custom_fields = content_type.custom_fields.all()

        context = super().get_serializer_context()
        context.update(
            {
                "custom_fields": custom_fields,
            }
        )
        return context

#### `ParsedNotificationTaskView`

Bases: `ReadOnlyModelViewSet`

API view for Notification Source CRUD operations.

Source code in `nautobot_circuit_maintenance/api/views.py`

    58
    59
    60
    61
    62
    63
    class ParsedNotificationTaskView(viewsets.ReadOnlyModelViewSet):
        """API view for Notification Source CRUD operations."""

        queryset = ParsedNotification.objects.prefetch_related()
        serializer_class = ParsedNotificationSerializer
        filterset_class = filters.ParsedNotificationFilterSet

#### `RawNotificationTaskView`

Bases: `ReadOnlyModelViewSet`

API view for Notification Source CRUD operations.

Source code in `nautobot_circuit_maintenance/api/views.py`

    50
    51
    52
    53
    54
    55
    class RawNotificationTaskView(viewsets.ReadOnlyModelViewSet):
        """API view for Notification Source CRUD operations."""

        queryset = RawNotification.objects.prefetch_related()
        serializer_class = RawNotificationSerializer
        filterset_class = filters.RawNotificationFilterSet