refactor(domain): Decompose domain.go into individual entity files
Decomposes the monolithic `internal/core/domain/domain.go` file into separate files for each domain entity (`app.go`, `app_instance.go`, `cloudlet.go`, `flavor.go`). - `SecurityRule` struct moved into `app.go` as it is a value object specific to the App entity. - `Location` struct moved into `cloudlet.go` as it is a value object specific to the Cloudlet entity. - `Flavor` remains a separate file as it is a shared entity used by App, AppInstance, and Cloudlet. This refactoring improves modularity and makes the domain model easier to navigate and understand.
This commit is contained in:
parent
65e3daeee5
commit
cb6bb5fb75
6 changed files with 81 additions and 79 deletions
Binary file not shown.
31
internal/core/domain/app.go
Normal file
31
internal/core/domain/app.go
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package domain
|
||||
|
||||
// AppKey uniquely identifies an application
|
||||
type AppKey struct {
|
||||
Organization string
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
|
||||
// App represents an application definition
|
||||
type App struct {
|
||||
Key AppKey
|
||||
Deployment string
|
||||
ImageType string
|
||||
ImagePath string
|
||||
AllowServerless bool
|
||||
DefaultFlavor Flavor
|
||||
ServerlessConfig interface{}
|
||||
DeploymentGenerator string
|
||||
DeploymentManifest string
|
||||
RequiredOutboundConnections []SecurityRule
|
||||
Fields []string
|
||||
}
|
||||
|
||||
// SecurityRule defines network access rules
|
||||
type SecurityRule struct {
|
||||
PortRangeMax int
|
||||
PortRangeMin int
|
||||
Protocol string
|
||||
RemoteCIDR string
|
||||
}
|
||||
18
internal/core/domain/app_instance.go
Normal file
18
internal/core/domain/app_instance.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package domain
|
||||
|
||||
// AppInstanceKey uniquely identifies an application instance
|
||||
type AppInstanceKey struct {
|
||||
Organization string
|
||||
Name string
|
||||
CloudletKey CloudletKey
|
||||
}
|
||||
|
||||
// AppInstance represents a deployed application instance
|
||||
type AppInstance struct {
|
||||
Key AppInstanceKey
|
||||
AppKey AppKey
|
||||
Flavor Flavor
|
||||
State string
|
||||
PowerState string
|
||||
Fields []string
|
||||
}
|
||||
26
internal/core/domain/cloudlet.go
Normal file
26
internal/core/domain/cloudlet.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package domain
|
||||
|
||||
// CloudletKey uniquely identifies a cloudlet
|
||||
type CloudletKey struct {
|
||||
Organization string
|
||||
Name string
|
||||
}
|
||||
|
||||
// Cloudlet represents edge infrastructure
|
||||
type Cloudlet struct {
|
||||
Key CloudletKey
|
||||
Location Location
|
||||
IpSupport string
|
||||
NumDynamicIps int32
|
||||
State string
|
||||
Flavor Flavor
|
||||
PhysicalName string
|
||||
Region string
|
||||
NotifySrvAddr string
|
||||
}
|
||||
|
||||
// Location represents geographical coordinates
|
||||
type Location struct {
|
||||
Latitude float64
|
||||
Longitude float64
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
|
||||
package domain
|
||||
|
||||
// AppKey uniquely identifies an application
|
||||
type AppKey struct {
|
||||
Organization string
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
|
||||
// CloudletKey uniquely identifies a cloudlet
|
||||
type CloudletKey struct {
|
||||
Organization string
|
||||
Name string
|
||||
}
|
||||
|
||||
// AppInstanceKey uniquely identifies an application instance
|
||||
type AppInstanceKey struct {
|
||||
Organization string
|
||||
Name string
|
||||
CloudletKey CloudletKey
|
||||
}
|
||||
|
||||
// Flavor defines resource allocation for instances
|
||||
type Flavor struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
// SecurityRule defines network access rules
|
||||
type SecurityRule struct {
|
||||
PortRangeMax int
|
||||
PortRangeMin int
|
||||
Protocol string
|
||||
RemoteCIDR string
|
||||
}
|
||||
|
||||
// App represents an application definition
|
||||
type App struct {
|
||||
Key AppKey
|
||||
Deployment string
|
||||
ImageType string
|
||||
ImagePath string
|
||||
AllowServerless bool
|
||||
DefaultFlavor Flavor
|
||||
ServerlessConfig interface{}
|
||||
DeploymentGenerator string
|
||||
DeploymentManifest string
|
||||
RequiredOutboundConnections []SecurityRule
|
||||
Fields []string
|
||||
}
|
||||
|
||||
// AppInstance represents a deployed application instance
|
||||
type AppInstance struct {
|
||||
Key AppInstanceKey
|
||||
AppKey AppKey
|
||||
Flavor Flavor
|
||||
State string
|
||||
PowerState string
|
||||
Fields []string
|
||||
}
|
||||
|
||||
// Cloudlet represents edge infrastructure
|
||||
type Cloudlet struct {
|
||||
Key CloudletKey
|
||||
Location Location
|
||||
IpSupport string
|
||||
NumDynamicIps int32
|
||||
State string
|
||||
Flavor Flavor
|
||||
PhysicalName string
|
||||
Region string
|
||||
NotifySrvAddr string
|
||||
}
|
||||
|
||||
// Location represents geographical coordinates
|
||||
type Location struct {
|
||||
Latitude float64
|
||||
Longitude float64
|
||||
}
|
||||
6
internal/core/domain/flavor.go
Normal file
6
internal/core/domain/flavor.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
package domain
|
||||
|
||||
// Flavor defines resource allocation for instances
|
||||
type Flavor struct {
|
||||
Name string
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue