From 0812cc61b9e718ba9d7c63d94835c5a5ad238ed5 Mon Sep 17 00:00:00 2001 From: Pascal Fischer <32096965+pascal-fischer@users.noreply.github.com> Date: Tue, 10 Dec 2024 10:51:18 +0100 Subject: [PATCH] [management] Add name attr to network resource (#3011) --- .../server/networks/network_resource.go | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/management/server/networks/network_resource.go b/management/server/networks/network_resource.go index d8c10f20d..2a86cb0d7 100644 --- a/management/server/networks/network_resource.go +++ b/management/server/networks/network_resource.go @@ -23,25 +23,29 @@ func (p NetworkResourceType) String() string { } type NetworkResource struct { - ID string `gorm:"index"` - NetworkID string `gorm:"index"` - AccountID string `gorm:"index"` - Type NetworkResourceType - Address string + ID string `gorm:"index"` + NetworkID string `gorm:"index"` + AccountID string `gorm:"index"` + Name string + Description string + Type NetworkResourceType + Address string } -func NewNetworkResource(accountID, networkID, address string) (*NetworkResource, error) { +func NewNetworkResource(accountID, networkID, name, description, address string) (*NetworkResource, error) { resourceType, err := getResourceType(address) if err != nil { return nil, fmt.Errorf("invalid address: %w", err) } return &NetworkResource{ - ID: xid.New().String(), - AccountID: accountID, - NetworkID: networkID, - Type: resourceType, - Address: address, + ID: xid.New().String(), + AccountID: accountID, + NetworkID: networkID, + Name: name, + Description: description, + Type: resourceType, + Address: address, }, nil }