Documentation
¶
Overview ¶
Package summary provides infrastructure summary HTML generation
Package summary provides source infrastructure summary markdown generation ¶
Package summary provides infrastructure summary markdown generation ¶
Package summary provides source infrastructure summary data models ¶
Package summary provides target infrastructure summary data models ¶
Package summary provides source infrastructure summary generation logic ¶
Package summary provides infrastructure summary generation logic
Index ¶
- func ConvertMarkdownToHTML(md []byte) []byte
- func GenerateMarkdownSummary(summary *TargetInfraSummary) string
- func GenerateSourceMarkdownSummary(summary *SourceInfraSummary) string
- type SourceCPUInfo
- type SourceDiskInfo
- type SourceFirewallRule
- type SourceInfraSummary
- type SourceInterfaceInfo
- type SourceMemoryInfo
- type SourceNetworkBrief
- type SourceNetworkInfo
- type SourceOSInfo
- type SourceRoutingTableRow
- type SourceServerFirewall
- type SourceServerInfo
- type SourceStorageByServer
- type SourceStorageByType
- type SourceSummaryComputeResources
- type SourceSummaryInfraOverview
- type SourceSummaryMetadata
- type SourceSummaryNetworkResources
- type SourceSummarySecurityResources
- type SourceSummaryStorageResources
- type SummaryComputeResources
- type SummaryCostByRegion
- type SummaryCostByVm
- type SummaryCostEstimation
- type SummaryFirewallRule
- type SummaryImageInfoWithUsage
- type SummaryNetworkResources
- type SummarySecurityGroupInfo
- type SummarySecurityResources
- type SummarySpecInfoWithUsage
- type SummarySshKeyInfo
- type SummarySubnetInfo
- type SummaryVNetInfo
- type SummaryVmImageInfo
- type SummaryVmInfo
- type SummaryVmMiscInfo
- type SummaryVmSpecInfo
- type TargetInfraOverview
- type TargetInfraSummary
- type TargetSummaryMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertMarkdownToHTML ¶
ConvertMarkdownToHTML converts markdown content to HTML It uses goldmark library with the following configurations: - Extensions: GFM (GitHub Flavored Markdown), Table, Strikethrough, Linkify, TaskList, Emoji - Parser: AutoHeadingID enabled (automatic heading ID generation) - Renderer: Unsafe mode (allow raw HTML), XHTML mode
func GenerateMarkdownSummary ¶
func GenerateMarkdownSummary(summary *TargetInfraSummary) string
GenerateMarkdownSummary converts TargetInfraSummary to markdown format
func GenerateSourceMarkdownSummary ¶
func GenerateSourceMarkdownSummary(summary *SourceInfraSummary) string
GenerateSourceMarkdownSummary converts SourceInfraSummary to markdown format
Types ¶
type SourceCPUInfo ¶
type SourceCPUInfo struct {
Cores int `json:"cores" example:"8"`
Model string `json:"model" example:"Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz"`
MaxSpeed float64 `json:"maxSpeed" example:"2.4"`
Vendor string `json:"vendor" example:"GenuineIntel"`
CPUs int `json:"cpus" example:"1"`
Threads int `json:"threads" example:"16"`
Architecture string `json:"architecture" example:"x86_64"`
Utilization float64 `json:"utilization,omitempty" example:"45.2"`
}
SourceCPUInfo represents CPU information
type SourceDiskInfo ¶
type SourceDiskInfo struct {
Label string `json:"label" example:"/dev/sda"`
Type string `json:"type" example:"SSD"`
TotalGB int `json:"totalGb" example:"500"`
Used int `json:"used,omitempty" example:"300"`
Available int `json:"available,omitempty" example:"200"`
Utilization float64 `json:"utilization,omitempty" example:"60.0"`
}
SourceDiskInfo represents disk information
type SourceFirewallRule ¶
type SourceFirewallRule struct {
SrcCIDR string `json:"srcCidr" example:"0.0.0.0/0"`
SrcPorts string `json:"srcPorts" example:"*"`
DstCIDR string `json:"dstCidr" example:"0.0.0.0/0"`
DstPorts string `json:"dstPorts" example:"22,80,443"`
Protocol string `json:"protocol" example:"tcp"`
Direction string `json:"direction" example:"inbound"`
Action string `json:"action" example:"allow"`
}
SourceFirewallRule represents a firewall rule
type SourceInfraSummary ¶
type SourceInfraSummary struct {
SummaryMetadata SourceSummaryMetadata `json:"summaryMetadata"`
Overview SourceSummaryInfraOverview `json:"overview"`
ComputeResources SourceSummaryComputeResources `json:"computeResources"`
NetworkResources SourceSummaryNetworkResources `json:"networkResources"`
StorageResources SourceSummaryStorageResources `json:"storageResources"`
SecurityResources SourceSummarySecurityResources `json:"securityResources"`
}
SourceInfraSummary represents the comprehensive source infrastructure summary (on-premise)
func GenerateSourceInfraSummary ¶
func GenerateSourceInfraSummary(infraName string, infraData onpremmodel.OnpremInfra) (*SourceInfraSummary, error)
GenerateSourceInfraSummary generates a comprehensive source infrastructure summary from on-premise data
type SourceInterfaceInfo ¶
type SourceInterfaceInfo struct {
Name string `json:"name" example:"eth0"`
IPAddress string `json:"ipAddress,omitempty" example:"192.168.1.10"`
IPv4CidrBlocks []string `json:"ipv4CidrBlocks,omitempty" example:"192.168.1.10/24"`
IPv6CidrBlocks []string `json:"ipv6CidrBlocks,omitempty" example:"fe80::1/64"`
MacAddress string `json:"macAddress,omitempty" example:"00:1a:2b:3c:4d:5e"`
MTU int `json:"mtu,omitempty" example:"1500"`
State string `json:"state,omitempty" example:"up"`
}
SourceInterfaceInfo represents network interface information
type SourceMemoryInfo ¶
type SourceMemoryInfo struct {
Type string `json:"type" example:"DDR4"`
TotalGB int `json:"totalGb" example:"32"`
Available int `json:"available,omitempty" example:"20"`
Used int `json:"used,omitempty" example:"12"`
Utilization float64 `json:"utilization,omitempty" example:"37.5"`
}
SourceMemoryInfo represents memory information
type SourceNetworkBrief ¶
type SourceNetworkBrief struct {
IPAddress string `json:"ipAddress" example:"192.168.1.10"`
PublicIP string `json:"publicIp,omitempty" example:"203.0.113.45"`
MacAddress string `json:"macAddress,omitempty" example:"00:1a:2b:3c:4d:5e"`
NetworkName string `json:"networkName,omitempty" example:"office-lan"`
}
SourceNetworkBrief represents brief network information for a server
type SourceNetworkInfo ¶
type SourceNetworkInfo struct {
NetworkName string `json:"networkName" example:"office-lan"`
NetworkCIDR string `json:"networkCidr" example:"192.168.1.0/24"`
Gateway string `json:"gateway,omitempty" example:"192.168.1.1"`
DNSServers []string `json:"dnsServers,omitempty" example:"8.8.8.8,8.8.4.4"`
ServerCount int `json:"serverCount" example:"5"`
Description string `json:"description,omitempty" example:"Office LAN network"`
}
SourceNetworkInfo represents source network information
type SourceOSInfo ¶
type SourceOSInfo struct {
PrettyName string `json:"prettyName,omitempty" example:"Ubuntu 22.04.5 LTS"`
Name string `json:"name" example:"Ubuntu"`
Version string `json:"version" example:"22.04"`
Architecture string `json:"architecture" example:"x86_64"`
Kernel string `json:"kernel,omitempty" example:"5.15.0-91-generic"`
}
SourceOSInfo represents OS information
type SourceRoutingTableRow ¶
type SourceRoutingTableRow struct {
Destination string `json:"destination" example:"0.0.0.0/0"`
Gateway string `json:"gateway,omitempty" example:"192.168.1.1"`
Interface string `json:"interface" example:"eth0"`
Metric int `json:"metric,omitempty" example:"100"`
Protocol string `json:"protocol,omitempty" example:"kernel"`
}
SourceRoutingTableRow represents a routing table entry
type SourceServerFirewall ¶
type SourceServerFirewall struct {
Hostname string `json:"hostname" example:"web-server-01"`
FirewallRules []SourceFirewallRule `json:"firewallRules"`
}
SourceServerFirewall represents firewall configuration for a server
type SourceServerInfo ¶
type SourceServerInfo struct {
Hostname string `json:"hostname" example:"web-server-01"`
MachineId string `json:"machineId" example:"00a9f3d4-74b6-e811-906e-000ffee02d5c"`
CPU SourceCPUInfo `json:"cpu"`
Memory SourceMemoryInfo `json:"memory"`
Disk SourceDiskInfo `json:"disk"`
OS SourceOSInfo `json:"os"`
RootDiskType string `json:"rootDiskType" example:"SSD"`
RootDiskSize int `json:"rootDiskSize" example:"100"`
Network SourceNetworkBrief `json:"network"`
Interfaces []SourceInterfaceInfo `json:"interfaces,omitempty"`
RoutingTable []SourceRoutingTableRow `json:"routingTable,omitempty"`
}
SourceServerInfo represents source server information
type SourceStorageByServer ¶
type SourceStorageByServer struct {
Hostname string `json:"hostname" example:"web-server-01"`
TotalGB int `json:"totalGb" example:"500"`
Type string `json:"type" example:"SSD"`
}
SourceStorageByServer represents storage breakdown by server
type SourceStorageByType ¶
type SourceStorageByType struct {
Type string `json:"type" example:"SSD"`
TotalGB int `json:"totalGb" example:"1000"`
ServerCount int `json:"serverCount" example:"3"`
}
SourceStorageByType represents storage breakdown by type (SSD, HDD, etc.)
type SourceSummaryComputeResources ¶
type SourceSummaryComputeResources struct {
Servers []SourceServerInfo `json:"servers"`
}
SourceSummaryComputeResources contains source server information
type SourceSummaryInfraOverview ¶
type SourceSummaryInfraOverview struct {
InfraName string `json:"infraName" example:"datacenter-seoul-1"`
TotalServerCount int `json:"totalServerCount" example:"5"`
TotalCPUCores int `json:"totalCpuCores" example:"40"`
TotalMemoryGB int `json:"totalMemoryGb" example:"160"`
TotalDiskGB int `json:"totalDiskGb" example:"2000"`
TotalNetworks int `json:"totalNetworks" example:"3"`
}
SourceSummaryInfraOverview provides high-level overview of the source infrastructure
type SourceSummaryMetadata ¶
type SourceSummaryMetadata struct {
GeneratedAt time.Time `json:"generatedAt" example:"2025-10-31T14:30:00Z"`
InfraName string `json:"infraName" example:"datacenter-seoul-1"`
SummaryVersion string `json:"summaryVersion" example:"1.0"`
}
SourceSummaryMetadata contains source infrastructure summary generation metadata
type SourceSummaryNetworkResources ¶
type SourceSummaryNetworkResources struct {
Networks []SourceNetworkInfo `json:"networks"`
}
SourceSummaryNetworkResources contains source network information
type SourceSummarySecurityResources ¶
type SourceSummarySecurityResources struct {
ServerFirewalls []SourceServerFirewall `json:"serverFirewalls"`
}
SourceSummarySecurityResources contains source security information
type SourceSummaryStorageResources ¶
type SourceSummaryStorageResources struct {
TotalGB int `json:"totalGb" example:"2000"`
UsedGB int `json:"usedGb" example:"1200"`
AvailableGB int `json:"availableGb" example:"800"`
ByType []SourceStorageByType `json:"byType"`
ByServer []SourceStorageByServer `json:"byServer"`
}
SourceSummaryStorageResources contains storage breakdown information
type SummaryComputeResources ¶
type SummaryComputeResources struct {
Specs []SummarySpecInfoWithUsage `json:"specs"`
Images []SummaryImageInfoWithUsage `json:"images"`
Vms []SummaryVmInfo `json:"vms"`
}
SummaryComputeResources contains VM, Spec, and Image information
type SummaryCostByRegion ¶
type SummaryCostByRegion struct {
Csp string `json:"csp" example:"AWS"`
Region string `json:"region" example:"ap-northeast-2"`
VmCount int `json:"vmCount" example:"3"`
CostPerHour float32 `json:"costPerHour" example:"0.4512"`
CostPerMonth float32 `json:"costPerMonth" example:"324.86"`
}
SummaryCostByRegion represents cost breakdown by region
type SummaryCostByVm ¶
type SummaryCostByVm struct {
VmName string `json:"vmName" example:"migrated-server-1"`
SpecName string `json:"specName" example:"t3a.xlarge"`
CostPerHour float32 `json:"costPerHour" example:"0.1504"`
CostPerMonth float32 `json:"costPerMonth" example:"108.29"`
}
SummaryCostByVm represents cost breakdown by individual VM
type SummaryCostEstimation ¶
type SummaryCostEstimation struct {
Currency string `json:"currency" example:"USD"`
TotalCostPerHour float32 `json:"totalCostPerHour" example:"0.4512"`
TotalCostPerDay float32 `json:"totalCostPerDay" example:"10.83"`
TotalCostPerMonth float32 `json:"totalCostPerMonth" example:"324.86"`
ByRegion []SummaryCostByRegion `json:"byRegion"`
ByVm []SummaryCostByVm `json:"byVm"`
}
SummaryCostEstimation provides cost analysis
type SummaryFirewallRule ¶
type SummaryFirewallRule struct {
Direction string `json:"direction" example:"inbound"`
Protocol string `json:"protocol" example:"tcp"`
FromPort string `json:"fromPort" example:"22"`
ToPort string `json:"toPort" example:"22"`
Cidr string `json:"cidr" example:"0.0.0.0/0"`
}
SummaryFirewallRule represents a firewall rule for summary
type SummaryImageInfoWithUsage ¶
type SummaryImageInfoWithUsage struct {
tbmodel.ImageInfo // Embed full ImageInfo from CB-Tumblebug
UsageCount int `json:"usageCount" example:"3"` // Number of VMs using this image
}
SummaryImageInfoWithUsage extends tbmodel.ImageInfo with usage count
type SummaryNetworkResources ¶
type SummaryNetworkResources struct {
VNets []SummaryVNetInfo `json:"vnets"`
}
SummaryNetworkResources contains VNet and Subnet information
type SummarySecurityGroupInfo ¶
type SummarySecurityGroupInfo struct {
Name string `json:"name" example:"mig-sg-01"`
CspSecurityGroupId string `json:"cspSecurityGroupId" example:"sg-065ead8c271abf7a3"`
VNetName string `json:"vnetName" example:"mig-vnet-01"`
Rules []SummaryFirewallRule `json:"rules"`
RuleCount int `json:"ruleCount" example:"5"`
}
SummarySecurityGroupInfo represents Security Group information for summary
type SummarySecurityResources ¶
type SummarySecurityResources struct {
SshKeys []SummarySshKeyInfo `json:"sshKeys"`
SecurityGroups []SummarySecurityGroupInfo `json:"securityGroups"`
}
SummarySecurityResources contains SSH Key and Security Group information
type SummarySpecInfoWithUsage ¶
type SummarySpecInfoWithUsage struct {
tbmodel.SpecInfo // Embed full SpecInfo from CB-Tumblebug
UsageCount int `json:"usageCount" example:"2"` // Number of VMs using this spec
}
SummarySpecInfoWithUsage extends tbmodel.SpecInfo with usage count
type SummarySshKeyInfo ¶
type SummarySshKeyInfo struct {
Name string `json:"name" example:"mig-sshkey-01"`
CspSshKeyId string `json:"cspSshKeyId" example:"d3vkftmqjs728ptbetpg"`
Username string `json:"username" example:"cb-user"`
PublicKey string `json:"publicKey,omitempty"` // Truncated for security
Fingerprint string `json:"fingerprint,omitempty" example:"1a:2b:3c:4d:..."`
}
SummarySshKeyInfo represents SSH Key information for summary
type SummarySubnetInfo ¶
type SummarySubnetInfo struct {
Name string `json:"name" example:"mig-subnet-01"`
CspSubnetId string `json:"cspSubnetId" example:"subnet-047dfd6ca50d6791d"`
CidrBlock string `json:"cidrBlock" example:"192.168.110.0/24"`
Zone string `json:"zone,omitempty" example:"ap-northeast-2a"`
}
SummarySubnetInfo represents Subnet information for summary
type SummaryVNetInfo ¶
type SummaryVNetInfo struct {
Name string `json:"name" example:"mig-vnet-01"`
CspVNetId string `json:"cspVnetId" example:"vpc-06ea213ee81b3e1c4"`
CidrBlock string `json:"cidrBlock" example:"192.168.0.0/16"`
Region string `json:"region" example:"ap-northeast-2"`
Subnets []SummarySubnetInfo `json:"subnets"`
SubnetCount int `json:"subnetCount" example:"2"`
ConnectionName string `json:"connectionName" example:"aws-ap-northeast-2"`
}
SummaryVNetInfo represents VNet information for summary (Name only, no ID duplication)
type SummaryVmImageInfo ¶
type SummaryVmImageInfo struct {
Name string `json:"name" example:"ubuntu22.04"`
Id string `json:"id,omitempty" example:"ami-010be25c3775061c9"`
OsType string `json:"osType,omitempty" example:"Ubuntu 22.04"`
Distribution string `json:"distribution" example:"Ubuntu"`
OsVersion string `json:"osVersion" example:"22.04"`
}
SummaryVmImageInfo represents VM Image summary embedded in VM info
type SummaryVmInfo ¶
type SummaryVmInfo struct {
Name string `json:"name" example:"migrated-server-1"`
CspVmId string `json:"cspVmId" example:"i-0a1b2c3d4e5f6g7h8"`
Status string `json:"status" example:"Running"`
Spec SummaryVmSpecInfo `json:"spec"`
Image SummaryVmImageInfo `json:"image"`
Misc SummaryVmMiscInfo `json:"misc"`
Region string `json:"region" example:"ap-northeast-2"`
Zone string `json:"zone,omitempty" example:"ap-northeast-2a"`
}
SummaryVmInfo represents VM information for summary with restructured format
type SummaryVmMiscInfo ¶
type SummaryVmMiscInfo struct {
VNet string `json:"vnet" example:"mig-vnet-01"`
Subnet string `json:"subnet" example:"mig-subnet-01"`
PublicIp string `json:"publicIp,omitempty" example:"43.201.59.126"`
PrivateIp string `json:"privateIp" example:"192.168.110.10"`
SecurityGroups []string `json:"securityGroups" example:"mig-sg-01"`
SshKey string `json:"sshKey" example:"mig-sshkey-01"`
ConnectionName string `json:"connectionName" example:"aws-ap-northeast-2"`
}
SummaryVmMiscInfo contains network and security details for VM
type SummaryVmSpecInfo ¶
type SummaryVmSpecInfo struct {
Name string `json:"name" example:"t3a.xlarge"`
VCpus int `json:"vcpus" example:"4"`
MemoryGiB float32 `json:"memoryGiB" example:"16"`
Architecture string `json:"architecture,omitempty" example:"x86_64"`
}
SummaryVmSpecInfo represents VM Spec summary embedded in VM info
type TargetInfraOverview ¶
type TargetInfraOverview struct {
MciName string `json:"mciName" example:"mmci01"`
MciDescription string `json:"mciDescription" example:"Migrated infrastructure"`
Status string `json:"status" example:"Running"`
TargetCloud string `json:"targetCloud" example:"AWS"`
TargetRegion string `json:"targetRegion" example:"ap-northeast-2"`
TotalVmCount int `json:"totalVmCount" example:"3"`
RunningVmCount int `json:"runningVmCount" example:"3"`
StoppedVmCount int `json:"stoppedVmCount" example:"0"`
Label map[string]string `json:"label,omitempty"`
InstallMonAgent string `json:"installMonAgent" example:"no"`
}
TargetInfraOverview provides high-level overview of the target infrastructure
type TargetInfraSummary ¶
type TargetInfraSummary struct {
SummaryMetadata TargetSummaryMetadata `json:"summaryMetadata"`
Overview TargetInfraOverview `json:"overview"`
NetworkResources SummaryNetworkResources `json:"networkResources"`
SecurityResources SummarySecurityResources `json:"securityResources"`
ComputeResources SummaryComputeResources `json:"computeResources"`
CostEstimation SummaryCostEstimation `json:"costEstimation"`
}
TargetInfraSummary represents the comprehensive target infrastructure summary Note: This is a summary-specific struct, not modifying existing tbmodel structs
func GenerateInfraSummary ¶
func GenerateInfraSummary(nsId, mciId string) (*TargetInfraSummary, error)
GenerateInfraSummary generates a comprehensive infrastructure summary Note: This function does NOT modify existing tbmodel structs, only reads from them
type TargetSummaryMetadata ¶
type TargetSummaryMetadata struct {
GeneratedAt time.Time `json:"generatedAt" example:"2025-10-31T14:30:00Z"`
Namespace string `json:"namespace" example:"mig01"`
MciId string `json:"mciId" example:"mmci01"`
MciName string `json:"mciName" example:"my-migrated-infrastructure"`
SummaryVersion string `json:"summaryVersion" example:"1.0"`
}
TargetSummaryMetadata contains target infrastructure summary generation metadata