Rename Index to ID

This commit is contained in:
Samuel Lorch 2023-04-13 19:28:43 +02:00
parent fb49d32ca9
commit 0573f2a253
2 changed files with 8 additions and 8 deletions

View file

@ -8,7 +8,7 @@ import (
) )
type GetDHCPv4ServerParameters struct { type GetDHCPv4ServerParameters struct {
Index uint ID uint
} }
type GetDHCPv4ServerResult struct { type GetDHCPv4ServerResult struct {
@ -16,12 +16,12 @@ type GetDHCPv4ServerResult struct {
} }
func (f *Service) GetDHCPv4Server(ctx context.Context, params GetDHCPv4ServerParameters) (GetDHCPv4ServerResult, error) { func (f *Service) GetDHCPv4Server(ctx context.Context, params GetDHCPv4ServerParameters) (GetDHCPv4ServerResult, error) {
if int(params.Index) >= len(f.ConfigManager.GetPendingConfig().Service.DHCPv4Servers) { if int(params.ID) >= len(f.ConfigManager.GetPendingConfig().Service.DHCPv4Servers) {
return GetDHCPv4ServerResult{}, fmt.Errorf("DHCPv4Server does not Exist") return GetDHCPv4ServerResult{}, fmt.Errorf("DHCPv4Server does not Exist")
} }
return GetDHCPv4ServerResult{ return GetDHCPv4ServerResult{
DHCPv4Server: f.ConfigManager.GetPendingConfig().Service.DHCPv4Servers[params.Index], DHCPv4Server: f.ConfigManager.GetPendingConfig().Service.DHCPv4Servers[params.ID],
}, nil }, nil
} }
@ -36,7 +36,7 @@ func (f *Service) GetDHCPv4Servers(ctx context.Context, params struct{}) (GetDHC
} }
type CreateDHCPv4ServerParameters struct { type CreateDHCPv4ServerParameters struct {
DHCPv4Server service.DHCPv4Server `json:"dhcp_v4_server"` service.DHCPv4Server
} }
func (f *Service) CreateDHCPv4Server(ctx context.Context, params CreateDHCPv4ServerParameters) (struct{}, error) { func (f *Service) CreateDHCPv4Server(ctx context.Context, params CreateDHCPv4ServerParameters) (struct{}, error) {

View file

@ -8,7 +8,7 @@ import (
) )
type GetDHCPv6ServerParameters struct { type GetDHCPv6ServerParameters struct {
Index uint ID uint
} }
type GetDHCPv6ServerResult struct { type GetDHCPv6ServerResult struct {
@ -16,12 +16,12 @@ type GetDHCPv6ServerResult struct {
} }
func (f *Service) GetDHCPv6Server(ctx context.Context, params GetDHCPv6ServerParameters) (GetDHCPv6ServerResult, error) { func (f *Service) GetDHCPv6Server(ctx context.Context, params GetDHCPv6ServerParameters) (GetDHCPv6ServerResult, error) {
if int(params.Index) >= len(f.ConfigManager.GetPendingConfig().Service.DHCPv6Servers) { if int(params.ID) >= len(f.ConfigManager.GetPendingConfig().Service.DHCPv6Servers) {
return GetDHCPv6ServerResult{}, fmt.Errorf("DHCPv6Server does not Exist") return GetDHCPv6ServerResult{}, fmt.Errorf("DHCPv6Server does not Exist")
} }
return GetDHCPv6ServerResult{ return GetDHCPv6ServerResult{
DHCPv6Server: f.ConfigManager.GetPendingConfig().Service.DHCPv6Servers[params.Index], DHCPv6Server: f.ConfigManager.GetPendingConfig().Service.DHCPv6Servers[params.ID],
}, nil }, nil
} }
@ -36,7 +36,7 @@ func (f *Service) GetDHCPv6Servers(ctx context.Context, params struct{}) (GetDHC
} }
type CreateDHCPv6ServerParameters struct { type CreateDHCPv6ServerParameters struct {
DHCPv6Server service.DHCPv6Server `json:"dhcp_v6_server"` service.DHCPv6Server
} }
func (f *Service) CreateDHCPv6Server(ctx context.Context, params CreateDHCPv6ServerParameters) (struct{}, error) { func (f *Service) CreateDHCPv6Server(ctx context.Context, params CreateDHCPv6ServerParameters) (struct{}, error) {