# flexera-public/policy_templates architecture

> Architecture diagram of the GitHub repository flexera-public/policy_templates, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/flexera-public/policy_templates
- Repository: https://github.com/flexera-public/policy_templates

## Overview

##### Main System Components

a. Policy Categories (Top Level)
- Optimization
- Compliance
- Cost
- Operational
- SaaS Management
- Security

b. Cloud Provider Integration Layer
- AWS
- Azure
- Google Cloud
- Others (Oracle, GitHub, etc.)

c. Core Components
- Policy Template Engine
- Data Management
- Automation Tools
- Integration Services

##### Key Relationships to Highlight

a. Policy Flow
- How policies are processed from template (.pt files) to execution
- Data flow between components
- Integration points with cloud providers

b. Data Management
- Connection to external data sets (data/ directory)
- Integration with pricing information
- Policy state and results storage

##### Specific Architectural Elements

**[Policy Categories]**
- ↓
**[Template Processing Layer]**
- ↓
**[Core Services Layer]**
- ↓
**[Cloud Provider Integration Layer]**
- ↓
**[External Systems]**

##### Component Details

For each major component, include:
- Input/Output relationships
- Key dependencies
- Integration points
- Data flow direction

##### Metadata

- Component types
- Relationship types
- Version information

##### Technical Details

Specific technical elements:
- Policy Template Language (PTL) processing
- Integration with Flexera CMP
- Data transformation flows
- API endpoints and interfaces

##### Implementation Notes

- Maintain appropriate abstraction level
- Both synchronous and asynchronous flows
- Scaling points
- High-availability components

Remember to:
- Use consistent symbols throughout
- A clear title and description
- Version information and date

This system design should effectively communicate the complex nature of the policy template system while maintaining clarity and usefulness for technical stakeholders.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph PolicyCategories
        Compliance["Compliance"]:::category
        Cost["Cost"]:::category
        Operational["Operational"]:::category
        SaaS["SaaS Management"]:::category
        Security["Security"]:::category
        Automation["Automation"]:::category
    end

    subgraph CloudProviders
        AWS["AWS Integration"]:::cloud
        Azure["Azure Integration"]:::cloud
        GCP["Google Cloud Integration"]:::cloud
        GitHub["GitHub Integration"]:::cloud
    end

    subgraph CoreServices
        PTEngine["Policy Template Engine"]:::core
        DataMgmt["Data Management"]:::core
        AutoTools["Automation Tools"]:::core
        IntServices["Integration Services"]:::core
    end

    subgraph DataStores
        AWSData["AWS Data"]:::data
        AzureData["Azure Data"]:::data
        GoogleData["Google Data"]:::data
        CurrencyData["Currency Data"]:::data
        PolicyList["Policy List Data"]:::data
    end

    subgraph Tools
        PTTools["Policy Template Tools"]:::tool
        CFTemplates["CloudFormation Templates"]:::tool
        CatalogMgmt["Catalog Management"]:::tool
        MetaCompiler["Meta Policy Compiler"]:::tool
    end

    subgraph Testing
        PolicyTests["Policy Tests"]:::test
        CodeTests["Code Tests"]:::test
        ChangelogTests["Changelog Tests"]:::test
    end

    subgraph CICD
        PolicyTesting["Policy Testing"]:::cicd
        CFNPublish["CloudFormation Management"]:::cicd
        PricingUpdates["Pricing Updates"]:::cicd
    end

    PolicyCategories --> PTEngine
    PTEngine --> CloudProviders
    CloudProviders --> DataMgmt
    DataMgmt --> DataStores
    PTEngine --> Tools
    Tools --> Testing
    Testing --> CICD

    %% Click Events
    click Compliance "https://github.com/flexera-public/policy_templates/tree/master//compliance"
    click Cost "https://github.com/flexera-public/policy_templates/tree/master//cost"
    click Operational "https://github.com/flexera-public/policy_templates/tree/master//operational"
    click SaaS "https://github.com/flexera-public/policy_templates/tree/master//saas"
    click Security "https://github.com/flexera-public/policy_templates/tree/master//security"
    click Automation "https://github.com/flexera-public/policy_templates/tree/master//automation"
    click AWS "https://github.com/flexera-public/policy_templates/tree/master//cost/aws"
    click Azure "https://github.com/flexera-public/policy_templates/tree/master//cost/azure"
    click GCP "https://github.com/flexera-public/policy_templates/tree/master//cost/google"
    click GitHub "https://github.com/flexera-public/policy_templates/tree/master//compliance/github"
    click AWSData "https://github.com/flexera-public/policy_templates/tree/master//data/aws"
    click AzureData "https://github.com/flexera-public/policy_templates/tree/master//data/azure"
    click GoogleData "https://github.com/flexera-public/policy_templates/tree/master//data/google"
    click CurrencyData "https://github.com/flexera-public/policy_templates/tree/master//data/currency"
    click PolicyList "https://github.com/flexera-public/policy_templates/tree/master//data/active_policy_list"
    click PTTools "https://github.com/flexera-public/policy_templates/tree/master//tools/policy_template_release_generation"
    click CFTemplates "https://github.com/flexera-public/policy_templates/tree/master//tools/cloudformation-template"
    click CatalogMgmt "https://github.com/flexera-public/policy_templates/tree/master//tools/catalog_management"
    click MetaCompiler "https://github.com/flexera-public/policy_templates/tree/master//tools/meta_parent_policy_compiler"
    click PolicyTests "https://github.com/flexera-public/policy_templates/blob/master//.dangerfile/policy_tests.rb"
    click CodeTests "https://github.com/flexera-public/policy_templates/blob/master//.dangerfile/code_tests.rb"
    click ChangelogTests "https://github.com/flexera-public/policy_templates/blob/master//.dangerfile/changelog_tests.rb"
    click PolicyTesting "https://github.com/flexera-public/policy_templates/blob/master//.github/workflows/test-policies.yaml"
    click CFNPublish "https://github.com/flexera-public/policy_templates/blob/master//.github/workflows/cfn-publish.yaml"
    click PricingUpdates "https://github.com/flexera-public/policy_templates/blob/master//.github/workflows/generate-aws-ec2-pricing-json.yaml"

    %% Styles
    classDef category fill:#3498db,stroke:#2980b9,color:white
    classDef cloud fill:#e67e22,stroke:#d35400,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#9b59b6,stroke:#8e44ad,color:white
    classDef tool fill:#f1c40f,stroke:#f39c12,color:black
    classDef test fill:#e74c3c,stroke:#c0392b,color:white
    classDef cicd fill:#95a5a6,stroke:#7f8c8d,color:white
```
