mirror of
https://github.com/ansible/awx.git
synced 2026-02-12 15:14:45 -03:30
Adding ansible_base.api_documentation to the INSTALL_APPS which extends the schema to include an LLM-friendly description to each endpoint --------- Signed-off-by: Seth Foster <fosterbseth@gmail.com> Co-authored-by: Peter Braun <pbraun@redhat.com>
27 lines
1.0 KiB
Python
27 lines
1.0 KiB
Python
# Copyright (c) 2018 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
from ansible_base.lib.utils.schema import extend_schema_if_available
|
|
|
|
from awx.api.generics import APIView, Response
|
|
from awx.api.permissions import IsSystemAdminOrAuditor
|
|
from awx.api.serializers import InstanceLinkSerializer, InstanceNodeSerializer
|
|
from awx.main.models import InstanceLink, Instance
|
|
|
|
|
|
class MeshVisualizer(APIView):
|
|
name = _("Mesh Visualizer")
|
|
permission_classes = (IsSystemAdminOrAuditor,)
|
|
swagger_topic = "System Configuration"
|
|
resource_purpose = 'mesh network topology visualization data'
|
|
|
|
@extend_schema_if_available(extensions={"x-ai-description": "Get mesh network topology visualization data"})
|
|
def get(self, request, format=None):
|
|
data = {
|
|
'nodes': InstanceNodeSerializer(Instance.objects.all(), many=True).data,
|
|
'links': InstanceLinkSerializer(InstanceLink.objects.select_related('target__instance', 'source'), many=True).data,
|
|
}
|
|
|
|
return Response(data)
|