Documentation
¶
Overview ¶
Package compare provides functionality for comparing two Port organizations.
Package compare provides functionality for comparing two Port organizations.
Package compare provides functionality for comparing two Port organizations.
Package compare provides functionality for comparing two Port organizations.
Package compare provides functionality for comparing two Port organizations.
Index ¶
- Variables
- func FormatPath(path string) string
- type CompareResult
- type DiffSummary
- type Differ
- type FetchOptions
- type Fetcher
- type FieldDiff
- type HTMLData
- type HTMLFormatter
- type HTMLSection
- type JSONFieldDiff
- type JSONFormatter
- type JSONOutput
- type JSONResourceChange
- type JSONResourceDiff
- type JSONSummary
- type Module
- type Options
- type OrgData
- type ResourceChange
- type ResourceDiff
- type TextFormatter
Constants ¶
This section is empty.
Variables ¶
var ExcludedFields = map[string]bool{ "_id": true, "id": true, "orgId": true, "createdAt": true, "createdBy": true, "updatedAt": true, "updatedBy": true, "icon": true, "color": true, }
ExcludedFields contains fields to exclude from comparison. These fields are typically auto-generated or organization-specific.
Functions ¶
Types ¶
type CompareResult ¶
type CompareResult struct {
Source string
Target string
Timestamp string
Identical bool
Blueprints ResourceDiff
Actions ResourceDiff
Scorecards ResourceDiff
Pages ResourceDiff
Integrations ResourceDiff
Teams ResourceDiff
Users ResourceDiff
Automations ResourceDiff
BlueprintPermissions ResourceDiff
ActionPermissions ResourceDiff
Entities ResourceDiff
}
CompareResult represents the full comparison result.
type DiffSummary ¶
DiffSummary represents the summary of differences for a resource type.
type Differ ¶
type Differ struct {
// contains filtered or unexported fields
}
Differ computes differences between two organizations.
type FetchOptions ¶
type FetchOptions struct {
OrgName string
FilePath string
ClientID string
ClientSecret string
APIUrl string
IncludeResources []string
}
FetchOptions contains options for fetching org data.
type Fetcher ¶
type Fetcher struct {
// contains filtered or unexported fields
}
Fetcher loads organization data from live orgs or export files.
func NewFetcher ¶
func NewFetcher(configManager *config.ConfigManager) *Fetcher
NewFetcher creates a new fetcher.
type FieldDiff ¶
type FieldDiff struct {
Path string
SourceValue interface{}
TargetValue interface{}
}
FieldDiff represents a single field-level difference.
type HTMLData ¶
type HTMLData struct {
Source string
Target string
Timestamp string
Identical bool
TotalAdded int
TotalModified int
TotalRemoved int
Sections []HTMLSection
}
HTMLData represents the data passed to HTML templates.
type HTMLFormatter ¶
type HTMLFormatter struct {
// contains filtered or unexported fields
}
HTMLFormatter formats comparison results as HTML.
func NewHTMLFormatter ¶
func NewHTMLFormatter(w io.Writer, simple bool) *HTMLFormatter
NewHTMLFormatter creates a new HTML formatter.
func (*HTMLFormatter) Format ¶
func (f *HTMLFormatter) Format(result *CompareResult) error
Format outputs the comparison result as HTML.
type HTMLSection ¶
type HTMLSection struct {
Name string
Added int
Modified int
Removed int
HasChanges bool
AddedItems []ResourceChange
ModifiedItems []ResourceChange
RemovedItems []ResourceChange
}
HTMLSection represents a section in the HTML report.
type JSONFieldDiff ¶
type JSONFieldDiff struct {
Path string `json:"path"`
SourceValue interface{} `json:"source_value"`
TargetValue interface{} `json:"target_value"`
}
JSONFieldDiff represents a field-level diff in JSON.
type JSONFormatter ¶
type JSONFormatter struct {
// contains filtered or unexported fields
}
JSONFormatter formats comparison results as JSON.
func NewJSONFormatter ¶
func NewJSONFormatter(w io.Writer) *JSONFormatter
NewJSONFormatter creates a new JSON formatter.
func (*JSONFormatter) Format ¶
func (f *JSONFormatter) Format(result *CompareResult) error
Format outputs the comparison result as JSON.
type JSONOutput ¶
type JSONOutput struct {
Source string `json:"source"`
Target string `json:"target"`
Timestamp string `json:"timestamp"`
Summary JSONSummary `json:"summary"`
Identical bool `json:"identical"`
Diffs map[string]JSONResourceDiff `json:"differences"`
}
JSONOutput represents the JSON output structure.
type JSONResourceChange ¶
type JSONResourceChange struct {
Identifier string `json:"identifier"`
Data map[string]interface{} `json:"data,omitempty"`
SourceData map[string]interface{} `json:"source,omitempty"`
TargetData map[string]interface{} `json:"target,omitempty"`
Changes []JSONFieldDiff `json:"changes,omitempty"`
}
JSONResourceChange represents a single changed resource in JSON.
type JSONResourceDiff ¶
type JSONResourceDiff struct {
Added []JSONResourceChange `json:"added,omitempty"`
Modified []JSONResourceChange `json:"modified,omitempty"`
Removed []JSONResourceChange `json:"removed,omitempty"`
}
JSONResourceDiff represents differences for a resource type in JSON.
type JSONSummary ¶
type JSONSummary struct {
TotalAdded int `json:"total_added"`
TotalModified int `json:"total_modified"`
TotalRemoved int `json:"total_removed"`
}
JSONSummary represents the overall summary.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module handles organization comparison operations.
func NewModule ¶
func NewModule(configManager *config.ConfigManager) *Module
NewModule creates a new compare module.
func (*Module) FormatOutput ¶
func (m *Module) FormatOutput(result *CompareResult, opts Options) error
FormatOutput formats the result based on options.
type Options ¶
type Options struct {
SourceOrg string // Source org name from config
TargetOrg string // Target org name from config
SourceFile string // Source export file path (alternative to org)
TargetFile string // Target export file path (alternative to org)
SourceClientID string // Override source client ID
SourceSecret string // Override source client secret
TargetClientID string // Override target client ID
TargetSecret string // Override target client secret
OutputFormat string // text, json, html
HTMLFile string // Output path for HTML report
HTMLSimple bool // Use simple HTML template
Verbose bool // Show identifiers
Full bool // Show full diff
IncludeResources []string // Filter resource types
FailOnDiff bool // Exit 1 if differences found
}
Options represents compare options.
type ResourceChange ¶
type ResourceChange struct {
Identifier string
SourceData map[string]interface{}
TargetData map[string]interface{}
FieldDiffs []FieldDiff
}
ResourceChange represents a single changed resource.
type ResourceDiff ¶
type ResourceDiff struct {
Summary DiffSummary
Added []ResourceChange
Modified []ResourceChange
Removed []ResourceChange
}
ResourceDiff represents differences for a single resource type.
type TextFormatter ¶
type TextFormatter struct {
// contains filtered or unexported fields
}
TextFormatter formats comparison results as text.
func NewTextFormatter ¶
func NewTextFormatter(w io.Writer, verbose, full bool, includeResources []string) *TextFormatter
NewTextFormatter creates a new text formatter.
func (*TextFormatter) Format ¶
func (f *TextFormatter) Format(result *CompareResult) error
Format outputs the comparison result as text.