openapi: 3.0.3 info: title: Flowfish Platform API description: | # Flowfish Platform API eBPF tabanlı Kubernetes/OpenShift uygulama iletişimi ve bağımlılık haritalama platformu REST API dokümantasyonu. ## Özellikler - **Otomatik Keşif**: Pod'lar arası iletişimi eBPF ile otomatik tespit - **Gerçek Zamanlı Harita**: Bağımlılık haritalarını canlı görüntüleme - **Anomali Tespiti**: LLM destekli akıllı anomali algılama - **Multi-Cluster**: Birden fazla cluster'ı tek arayüzden yönetim - **Import/Export**: Veri içe/dışa aktarma ## Kimlik Doğrulama API, JWT (JSON Web Token) tabanlı kimlik doğrulama kullanır. 1. `/api/v1/auth/login` endpoint'ine kullanıcı adı ve şifre ile POST request gönderin 2. Response'da dönen `access_token`'ı alın 3. Sonraki tüm isteklerde `Authorization: Bearer ` header'ı kullanın ## Rate Limiting - **Authenticated Users**: 1000 requests/hour - **Unauthenticated**: 100 requests/hour version: 1.0.0 contact: name: Flowfish Team email: support@flowfish.io license: name: MIT url: https://opensource.org/licenses/MIT servers: - url: https://api.flowfish.io/api/v1 description: Production server - url: https://staging.flowfish.io/api/v1 description: Staging server - url: http://localhost:8000/api/v1 description: Development server tags: - name: Authentication description: Kullanıcı kimlik doğrulama işlemleri - name: Users description: Kullanıcı yönetimi - name: Clusters description: Kubernetes/OpenShift cluster yönetimi - name: Analyses description: Analiz wizard ve çalıştırma - name: Workloads description: Kubernetes workload'ları (Pod, Deployment, Service, StatefulSet) - name: Communications description: Workload'lar arası iletişim kayıtları - name: Dependencies description: Bağımlılık haritası ve graph sorguları - name: Anomalies description: Tespit edilen anomaliler - name: Changes description: Değişim tespiti - name: Baselines description: Trafik baseline profilleri - name: Import/Export description: Veri içe ve dışa aktarma - name: Settings description: Sistem ayarları - name: AI Integration description: AI Agent ve CI/CD pipeline entegrasyonlari icin dependency intelligence API'leri components: securitySchemes: BearerAuth: type: http scheme: bearer bearerFormat: JWT description: JWT token authorization header using the Bearer scheme schemas: Error: type: object required: - error - message properties: error: type: string example: "UNAUTHORIZED" message: type: string example: "Invalid or expired token" details: type: object nullable: true Pagination: type: object properties: page: type: integer minimum: 1 default: 1 page_size: type: integer minimum: 1 maximum: 100 default: 20 total_items: type: integer total_pages: type: integer User: type: object required: - id - username - email properties: id: type: integer username: type: string email: type: string format: email first_name: type: string nullable: true last_name: type: string nullable: true avatar_url: type: string format: uri nullable: true is_active: type: boolean roles: type: array items: type: string created_at: type: string format: date-time Cluster: type: object required: - id - name - cluster_type properties: id: type: integer name: type: string description: type: string nullable: true cluster_type: type: string enum: [kubernetes, openshift] api_url: type: string format: uri is_active: type: boolean is_default: type: boolean kubernetes_version: type: string nullable: true node_count: type: integer nullable: true pod_count: type: integer nullable: true namespace_count: type: integer nullable: true health_status: type: string enum: [healthy, degraded, unhealthy, unknown] last_sync_at: type: string format: date-time nullable: true created_at: type: string format: date-time Namespace: type: object properties: id: type: integer cluster_id: type: integer name: type: string uid: type: string labels: type: object additionalProperties: type: string status: type: string created_at: type: string format: date-time Workload: type: object properties: id: type: integer cluster_id: type: integer namespace_id: type: integer workload_type: type: string enum: [pod, deployment, statefulset, service] name: type: string labels: type: object additionalProperties: type: string annotations: type: object additionalProperties: type: string ip_address: type: string format: ipv4 nullable: true ports: type: array items: type: object properties: port: type: integer protocol: type: string status: type: string first_seen: type: string format: date-time last_seen: type: string format: date-time is_active: type: boolean Communication: type: object properties: id: type: integer cluster_id: type: integer source_namespace: type: string source_workload: type: string source_workload_type: type: string destination_namespace: type: string destination_workload: type: string destination_workload_type: type: string destination_ip: type: string destination_port: type: integer protocol: type: string first_seen: type: string format: date-time last_seen: type: string format: date-time request_count: type: integer request_rate_per_second: type: number format: float avg_latency_ms: type: number format: float risk_score: type: integer minimum: 0 maximum: 100 risk_level: type: string enum: [low, medium, high, critical] is_cross_namespace: type: boolean is_external: type: boolean is_active: type: boolean Analysis: type: object properties: id: type: integer name: type: string description: type: string cluster_id: type: integer scope_type: type: string enum: [cluster, namespace, deployment, pod, label] scope_config: type: object gadget_modules: type: array items: type: string time_config: type: object output_config: type: object status: type: string enum: [draft, running, stopped, completed, failed] created_at: type: string format: date-time Anomaly: type: object properties: id: type: integer cluster_id: type: integer anomaly_type: type: string severity: type: string enum: [low, medium, high, critical] anomaly_score: type: integer minimum: 0 maximum: 100 title: type: string description: type: string affected_workloads: type: array items: type: object recommended_action: type: string status: type: string enum: [new, investigating, resolved, false_positive] detected_at: type: string format: date-time DependencyStreamCommunication: type: object properties: protocol: type: string app_protocol: type: string service_type: type: string description: Detected service type (e.g. postgresql, kafka, redis) service_category: type: string description: Service category (database, cache, message_broker, search_engine, etc.) enum: [database, cache, message_broker, search_engine, service_discovery, identity, object_storage, observability, api_gateway, mail, dns, file_transfer, service] is_critical: type: boolean description: Whether this dependency is classified as infrastructure-critical port: type: integer request_count: type: integer error_rate_percent: type: number retransmit_count: type: integer avg_latency_ms: type: number DependencyHealth: type: object properties: score: type: integer minimum: 0 maximum: 100 status: type: string enum: [healthy, degraded, unhealthy, critical] error_rate_percent: type: number retransmit_rate_percent: type: number avg_latency_ms: type: number risk_factors: type: array items: type: string DependencyStreamPeer: type: object properties: hop_count: type: integer pod_name: type: string namespace: type: string labels: type: object additionalProperties: type: string annotations: type: object additionalProperties: type: string ip: type: string owner_kind: type: string owner_name: type: string communication: $ref: '#/components/schemas/DependencyStreamCommunication' health: $ref: '#/components/schemas/DependencyHealth' CommunicationsDependenciesBatchRequest: type: object required: - services properties: analysis_id: type: string cluster_id: type: string services: type: array items: type: object properties: pod_name: type: string namespace: type: string owner_name: type: string label_key: type: string label_value: type: string annotation_key: type: string annotation_value: type: string ip: type: string depth: type: integer default: 1 include_communication_details: type: boolean default: true CommunicationsDependenciesBatchResponse: type: object properties: success: type: boolean service_count: type: integer results: type: array items: type: object additionalProperties: true shared_dependencies: type: array items: type: string CommunicationsDependenciesDiffResponse: type: object properties: success: type: boolean service: type: object analysis_before: type: object analysis_after: type: object added_dependencies: type: array items: type: object additionalProperties: true removed_dependencies: type: array items: type: object additionalProperties: true changed_dependencies: type: array items: type: object additionalProperties: true unchanged_count: type: integer summary: type: object CommunicationsDependenciesImpactResponse: type: object properties: success: type: boolean service: type: object dependencies: type: object properties: downstream: type: array items: type: object additionalProperties: true callers: type: array items: type: object additionalProperties: true downstream_count: type: integer callers_count: type: integer impact_assessment: type: object properties: risk_score: type: integer description: Risk score 0-100 risk_level: type: string enum: [low, medium, high, critical] blast_radius: type: integer description: Total direct dependency count critical_dependencies: type: array items: type: string description: List of critical service types (e.g. postgresql, redis) recommendation: type: string enum: [proceed, caution, block] suggested_actions: type: array items: type: object properties: priority: type: string enum: [critical, high, medium, low] action: type: string reason: type: string automatable: type: boolean change_type: type: string enum: [image_update, config_change, scale_change, delete] DependencySummaryService: type: object properties: name: type: string namespace: type: string kind: type: string annotations: type: object additionalProperties: type: string labels: type: object additionalProperties: type: string is_critical: type: boolean service_type: type: string port: type: integer DependencySummaryGroup: type: object properties: total: type: integer critical_count: type: integer by_category: type: object additionalProperties: type: array items: $ref: '#/components/schemas/DependencySummaryService' MatchedService: type: object properties: name: type: string namespace: type: string kind: type: string annotations: type: object additionalProperties: type: string labels: type: object additionalProperties: type: string downstream_count: type: integer callers_count: type: integer DependencySummaryResponse: type: object properties: success: type: boolean analysis_ids: type: array items: type: integer multi_service: type: boolean description: True when multiple upstream pods matched (e.g. namespace-wide query) service: $ref: '#/components/schemas/DependencySummaryService' matched_services: type: array description: Present when multi_service is true. Lists each matched upstream pod with its dependency counts. items: $ref: '#/components/schemas/MatchedService' downstream: $ref: '#/components/schemas/DependencySummaryGroup' callers: $ref: '#/components/schemas/DependencySummaryGroup' error: type: string GraphData: type: object properties: nodes: type: array items: type: object properties: id: type: string type: type: string name: type: string namespace: type: string labels: type: object additionalProperties: type: string annotations: type: object additionalProperties: type: string metadata: type: object edges: type: array items: type: object properties: id: type: string source: type: string target: type: string port: type: integer protocol: type: string metrics: type: object security: - BearerAuth: [] paths: /auth/login: post: tags: - Authentication summary: Kullanıcı girişi description: Kullanıcı adı ve şifre ile JWT token alınır security: [] requestBody: required: true content: application/json: schema: type: object required: - username - password properties: username: type: string password: type: string format: password examples: example1: summary: Admin kullanıcı value: username: "admin" password: "admin123" responses: '200': description: Giriş başarılı content: application/json: schema: type: object properties: access_token: type: string token_type: type: string example: "bearer" expires_in: type: integer example: 3600 user: $ref: '#/components/schemas/User' '401': description: Geçersiz kullanıcı adı veya şifre content: application/json: schema: $ref: '#/components/schemas/Error' /auth/me: get: tags: - Authentication summary: Mevcut kullanıcı bilgilerini getir description: Token'dan kullanıcı bilgilerini döndürür responses: '200': description: Kullanıcı bilgileri content: application/json: schema: $ref: '#/components/schemas/User' '401': description: Geçersiz veya eksik token content: application/json: schema: $ref: '#/components/schemas/Error' /clusters: get: tags: - Clusters summary: Cluster listesini getir description: Kullanıcının erişim yetkisi olan tüm cluster'ları listeler parameters: - name: page in: query schema: type: integer minimum: 1 default: 1 - name: page_size in: query schema: type: integer minimum: 1 maximum: 100 default: 20 - name: is_active in: query schema: type: boolean responses: '200': description: Cluster listesi content: application/json: schema: type: object properties: items: type: array items: $ref: '#/components/schemas/Cluster' pagination: $ref: '#/components/schemas/Pagination' post: tags: - Clusters summary: Yeni cluster ekle requestBody: required: true content: application/json: schema: type: object required: - name - cluster_type - api_url properties: name: type: string description: type: string cluster_type: type: string enum: [kubernetes, openshift] api_url: type: string format: uri kubeconfig: type: string description: Base64 encoded kubeconfig responses: '201': description: Cluster başarıyla oluşturuldu content: application/json: schema: $ref: '#/components/schemas/Cluster' '400': description: Geçersiz istek content: application/json: schema: $ref: '#/components/schemas/Error' /clusters/{cluster_id}: get: tags: - Clusters summary: Cluster detaylarını getir parameters: - name: cluster_id in: path required: true schema: type: integer responses: '200': description: Cluster detayları content: application/json: schema: $ref: '#/components/schemas/Cluster' '404': description: Cluster bulunamadı content: application/json: schema: $ref: '#/components/schemas/Error' put: tags: - Clusters summary: Cluster güncelle parameters: - name: cluster_id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: type: object properties: name: type: string description: type: string is_active: type: boolean responses: '200': description: Cluster güncellendi content: application/json: schema: $ref: '#/components/schemas/Cluster' delete: tags: - Clusters summary: Cluster sil parameters: - name: cluster_id in: path required: true schema: type: integer responses: '204': description: Cluster silindi '404': description: Cluster bulunamadı /analyses: get: tags: - Analyses summary: Analiz listesini getir parameters: - name: cluster_id in: query schema: type: integer - name: status in: query schema: type: string enum: [draft, running, stopped, completed, failed] responses: '200': description: Analiz listesi content: application/json: schema: type: object properties: items: type: array items: $ref: '#/components/schemas/Analysis' post: tags: - Analyses summary: Yeni analiz oluştur description: Wizard'dan gelen yapılandırma ile yeni analiz tanımlar requestBody: required: true content: application/json: schema: type: object required: - name - cluster_id - scope_type - scope_config - gadget_modules - time_config - output_config properties: name: type: string description: type: string cluster_id: type: integer scope_type: type: string enum: [cluster, namespace, deployment, pod, label] scope_config: type: object gadget_modules: type: array items: type: string time_config: type: object properties: mode: type: string enum: [continuous, time_bound, scheduled, baseline] duration_minutes: type: integer schedule: type: string output_config: type: object properties: dashboards: type: array items: type: string llm_enabled: type: boolean alerts_enabled: type: boolean responses: '201': description: Analiz oluşturuldu content: application/json: schema: $ref: '#/components/schemas/Analysis' /analyses/{analysis_id}/start: post: tags: - Analyses summary: Analizi başlat parameters: - name: analysis_id in: path required: true schema: type: integer responses: '200': description: Analiz başlatıldı content: application/json: schema: type: object properties: message: type: string run_id: type: integer /analyses/{analysis_id}/stop: post: tags: - Analyses summary: Analizi durdur parameters: - name: analysis_id in: path required: true schema: type: integer responses: '200': description: Analiz durduruldu /workloads: get: tags: - Workloads summary: Workload listesini getir parameters: - name: cluster_id in: query required: true schema: type: integer - name: namespace in: query schema: type: string - name: workload_type in: query schema: type: string enum: [pod, deployment, statefulset, service] - name: is_active in: query schema: type: boolean default: true responses: '200': description: Workload listesi content: application/json: schema: type: object properties: items: type: array items: $ref: '#/components/schemas/Workload' /communications: get: tags: - Communications summary: İletişim kayıtlarını getir parameters: - name: cluster_id in: query required: true schema: type: integer - name: namespace in: query schema: type: string - name: source_workload in: query schema: type: string - name: destination_workload in: query schema: type: string - name: risk_level in: query schema: type: string enum: [low, medium, high, critical] - name: is_active in: query schema: type: boolean default: true - name: from_time in: query schema: type: string format: date-time - name: to_time in: query schema: type: string format: date-time responses: '200': description: İletişim kayıtları content: application/json: schema: type: object properties: items: type: array items: $ref: '#/components/schemas/Communication' total_count: type: integer /dependencies/graph: get: tags: - Dependencies summary: Bağımlılık haritasını getir description: Graph formatında node ve edge'lerle bağımlılık haritasını döndürür parameters: - name: cluster_id in: query description: Opsiyonel; multi-cluster senaryolarında filtreleme için schema: type: integer - name: analysis_id in: query schema: type: integer - name: namespace in: query schema: type: string - name: depth in: query schema: type: integer default: 2 - name: search in: query schema: type: string minLength: 3 responses: '200': description: Graph verisi content: application/json: schema: $ref: '#/components/schemas/GraphData' /communications/dependencies/stream: get: tags: - AI Integration - Communications summary: Pod bağımlılıklarını upstream/downstream olarak getir description: | Herhangi bir pod bilgisi (annotation, label, pod name, namespace, ip) ile istek atılarak o pod'un bağımlı olduğu ve gittiği tüm pod'ları döndürür. Eşleşen pod upstream kabul edilir. İletişim kurduğu pod'lar downstream olarak döner. Bu pod'a bağlanan pod'lar ise callers olarak döner. parameters: - name: analysis_id in: query schema: type: integer - name: cluster_id in: query schema: type: integer - name: pod_name in: query schema: type: string - name: namespace in: query schema: type: string - name: owner_name in: query description: Deployment/StatefulSet/DaemonSet adı schema: type: string - name: annotation_key in: query schema: type: string - name: annotation_value in: query schema: type: string - name: label_key in: query schema: type: string - name: label_value in: query schema: type: string - name: ip in: query schema: type: string - name: depth in: query schema: type: integer minimum: 1 maximum: 5 default: 1 - name: format in: query schema: type: string enum: [json, mermaid, dot] default: json responses: '200': description: Upstream pod ve downstream bağımlılıkları content: application/json: schema: type: object properties: success: type: boolean count: type: integer results: type: array items: type: object properties: upstream: type: object properties: pod_name: type: string namespace: type: string labels: type: object annotations: type: object ip: type: string owner_kind: type: string owner_name: type: string downstream: type: array items: $ref: '#/components/schemas/DependencyStreamPeer' callers: type: array items: $ref: '#/components/schemas/DependencyStreamPeer' /communications/dependencies/batch: post: tags: - AI Integration - Communications summary: Birden fazla servis için bağımlılıkları toplu sorgula requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CommunicationsDependenciesBatchRequest' responses: '200': description: Toplu bağımlılık sonuçları content: application/json: schema: $ref: '#/components/schemas/CommunicationsDependenciesBatchResponse' /communications/dependencies/diff: get: tags: - AI Integration - Communications summary: İki analiz arasında bağımlılık farkını getir parameters: - name: analysis_id_before in: query required: true schema: type: string - name: analysis_id_after in: query required: true schema: type: string - name: pod_name in: query schema: type: string - name: namespace in: query schema: type: string - name: owner_name in: query schema: type: string - name: cluster_id in: query schema: type: integer responses: '200': description: Bağımlılık diff sonucu content: application/json: schema: $ref: '#/components/schemas/CommunicationsDependenciesDiffResponse' /communications/dependencies/impact: get: tags: - AI Integration - Communications summary: Değişiklik türüne göre bağımlılık etki analizi parameters: - name: analysis_id in: query schema: type: integer - name: cluster_id in: query schema: type: integer - name: pod_name in: query schema: type: string - name: namespace in: query schema: type: string - name: owner_name in: query schema: type: string - name: annotation_key in: query schema: type: string - name: annotation_value in: query schema: type: string - name: label_key in: query schema: type: string - name: label_value in: query schema: type: string - name: ip in: query schema: type: string - name: depth in: query schema: type: integer minimum: 1 maximum: 5 default: 1 - name: change_type in: query schema: type: string enum: [image_update, config_change, scale_change, delete] default: image_update responses: '200': description: Etki analizi sonucu content: application/json: schema: $ref: '#/components/schemas/CommunicationsDependenciesImpactResponse' /communications/dependencies/summary: get: tags: - AI Integration summary: AI-agent-friendly dependency summary grouped by category description: | Returns a compact, grouped dependency summary for AI agents and CI/CD pipelines. Dependencies are grouped by service_category. Annotations and labels are prominently exposed for cross-project impact analysis (e.g. git-repo URLs, team info). Requires at least one analysis_id and one search parameter. parameters: - name: analysis_ids in: query required: true description: Analysis IDs (at least one required) schema: type: array items: type: integer minItems: 1 - name: cluster_id in: query schema: type: integer - name: pod_name in: query schema: type: string - name: namespace in: query schema: type: string - name: owner_name in: query schema: type: string - name: annotation_key in: query schema: type: string - name: annotation_value in: query schema: type: string - name: label_key in: query schema: type: string - name: label_value in: query schema: type: string - name: ip in: query schema: type: string - name: depth in: query schema: type: integer minimum: 1 maximum: 5 default: 1 responses: '200': description: Grouped dependency summary content: application/json: schema: $ref: '#/components/schemas/DependencySummaryResponse' /anomalies: get: tags: - Anomalies summary: Anomali listesini getir parameters: - name: cluster_id in: query schema: type: integer - name: severity in: query schema: type: string enum: [low, medium, high, critical] - name: status in: query schema: type: string enum: [new, investigating, resolved, false_positive] - name: from_date in: query schema: type: string format: date responses: '200': description: Anomali listesi content: application/json: schema: type: object properties: items: type: array items: $ref: '#/components/schemas/Anomaly' /export/csv: get: tags: - Import/Export summary: CSV formatında export parameters: - name: cluster_id in: query required: true schema: type: integer - name: namespace in: query schema: type: string - name: from_time in: query schema: type: string format: date-time - name: to_time in: query schema: type: string format: date-time responses: '200': description: CSV dosyası content: text/csv: schema: type: string /export/graph-json: get: tags: - Import/Export summary: Graph JSON formatında export parameters: - name: cluster_id in: query required: true schema: type: integer responses: '200': description: Graph JSON dosyası content: application/json: schema: type: object /import: post: tags: - Import/Export summary: Veri import et requestBody: required: true content: multipart/form-data: schema: type: object required: - file - cluster_id - import_mode properties: file: type: string format: binary cluster_id: type: integer import_mode: type: string enum: [merge, overwrite, snapshot] responses: '202': description: Import işlemi başlatıldı content: application/json: schema: type: object properties: job_id: type: integer message: type: string