# eddywebs/sf-connector architecture

> Architecture diagram of the GitHub repository eddywebs/sf-connector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eddywebs/sf-connector
- Repository: https://github.com/eddywebs/sf-connector

## Overview

##### Main Components

a) Input Layer:
- Command Line Interface (CLI)
- Environment Configuration (.env file)
- Command Arguments Parser

b) Core Components:
- Salesforce API Client (SalesforceApi.py)
- Log Retrieval Service (retrieveLogs.py)
- File Writing Service (FileWriter.py)
- UDP Connection Handler (UDPConnect.py)

c) External Systems:
- Salesforce Platform
- Graylog Server (Optional destination)
- Local File System

##### Component Relationships

- User input → CLI → Log Retrieval Service
- Environment Config → Salesforce API Client
- Salesforce API Client ↔ Salesforce Platform
- Log Retrieval Service → File Writing Service → Local Storage
- Log Retrieval Service → UDP Connection → Graylog Server

- Green: Input components (CLI, config)
- Blue: Core processing components
- Yellow: External systems
- Gray: Storage systems

##### Detailed Component Descriptions

**CLI (retrieveLogs.py)**
- Handles command arguments
- Supports debug, logging, and verbose modes
- Environment listing capability

**Salesforce API Client**
- Authentication handling
- API request management
- Response processing

**Log Processing Pipeline**
- Log retrieval
- Format transformation
- Routing (File/UDP)

##### Technical Details

- Python-based implementation
- UDP protocol for Graylog integration
- Environment-based configuration
- JSON log format

##### Log retrieval and Graylog streaming

Remember to highlight the modular nature of the system, showing how the different Python modules (SalesforceApi.py, FileWriter.py, UDPConnect.py) interact while maintaining separation of concerns.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef input fill:#90EE90,stroke:#333,stroke-width:2px
    classDef core fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef external fill:#FFD700,stroke:#333,stroke-width:2px
    classDef storage fill:#D3D3D3,stroke:#333,stroke-width:2px

    %% Input Layer
    subgraph InputLayer
        CLI["Command Line Interface"]:::input
        EnvConfig["Environment Configuration"]:::input
        ArgParser["Command Arguments Parser"]:::input
    end

    %% Core Components
    subgraph CoreComponents
        SFApi["Salesforce API Client"]:::core
        LogService["Log Retrieval Service"]:::core
        FileService["File Writing Service"]:::core
        UDPHandler["UDP Connection Handler"]:::core
    end

    %% External Systems
    subgraph ExternalSystems
        SFPlatform["Salesforce Platform"]:::external
        Graylog["Graylog Server"]:::external
        FileSystem["Local File System"]:::storage
    end

    %% Relationships
    CLI --> LogService
    EnvConfig --> SFApi
    ArgParser --> LogService
    SFApi <--> SFPlatform
    LogService --> FileService
    LogService --> UDPHandler
    FileService --> FileSystem
    UDPHandler --> Graylog

    %% Click events for component mapping
    click CLI "https://github.com/eddywebs/SF-Connector/blob/master/retrieveLogs.py"
    click EnvConfig "https://github.com/eddywebs/SF-Connector/blob/master/.env.bak"
    click SFApi "https://github.com/eddywebs/SF-Connector/blob/master/SalesforceApi.py"
    click FileService "https://github.com/eddywebs/SF-Connector/blob/master/FileWriter.py"
    click UDPHandler "https://github.com/eddywebs/SF-Connector/blob/master/UDPConnect.py"

    %% Legend
    subgraph Legend
        L1["Input Components"]:::input
        L2["Core Components"]:::core
        L3["External Systems"]:::external
        L4["Storage Systems"]:::storage
    end
```
