@@ -15,7 +15,7 @@ import (
1515type AccountManager interface {
1616 SummaryByDatacenter () (map [string ]map [string ]int , error )
1717 GetBandwidthPools () ([]datatypes.Network_Bandwidth_Version1_Allotment , error )
18- GetBandwidthPoolServers (identifier int ) (int , error )
18+ GetBandwidthPoolServers (identifier int ) (uint , error )
1919 GetBillingItems (objectMask string , objectFilter string ) ([]datatypes.Billing_Item , error )
2020 GetEvents (typeEvent string , mask string , dateFilter string ) ([]datatypes.Notification_Occurrence_Event , error )
2121 GetEventDetail (identifier int , mask string ) (datatypes.Notification_Occurrence_Event , error )
@@ -65,16 +65,16 @@ func (a accountManager) SummaryByDatacenter() (map[string]map[string]int, error)
6565 }
6666 datacenters [name ]["vlan_count" ]++
6767 if vlan .TotalPrimaryIpAddressCount != nil {
68- datacenters [name ]["public_ip_count" ] += int (* vlan .TotalPrimaryIpAddressCount )
68+ datacenters [name ]["public_ip_count" ] += int (* vlan .TotalPrimaryIpAddressCount ) // #nosec G115 -- Should never be > 2^32
6969 }
7070 if vlan .SubnetCount != nil {
71- datacenters [name ]["subnet_count" ] += int (* vlan .SubnetCount )
71+ datacenters [name ]["subnet_count" ] += int (* vlan .SubnetCount ) // #nosec G115 -- Should never be > 2^32
7272 }
7373 if vlan .HardwareCount != nil {
74- datacenters [name ]["hardware_count" ] += int (* vlan .HardwareCount )
74+ datacenters [name ]["hardware_count" ] += int (* vlan .HardwareCount ) // #nosec G115 -- Should never be > 2^32
7575 }
7676 if vlan .VirtualGuestCount != nil {
77- datacenters [name ]["virtual_guest_count" ] += int (* vlan .VirtualGuestCount )
77+ datacenters [name ]["virtual_guest_count" ] += int (* vlan .VirtualGuestCount ) // #nosec G115 -- Should never be > 2^32
7878 }
7979 }
8080 }
@@ -93,19 +93,20 @@ Gets a count of all servers in a bandwidth pool
9393Getting the server counts individually is significantly faster than pulling them in
9494with the GetBandwidthPools api call.
9595*/
96- func (a accountManager ) GetBandwidthPoolServers (identifier int ) (int , error ) {
96+ func (a accountManager ) GetBandwidthPoolServers (identifier int ) (uint , error ) {
9797 mask := "mask[id, bareMetalInstanceCount, hardwareCount, virtualGuestCount]"
9898 allotmentService := services .GetNetworkBandwidthVersion1AllotmentService (a .Session )
9999 counts , err := allotmentService .Mask (mask ).Id (identifier ).GetObject ()
100- total := 0
100+ var total uint
101+ total = 0
101102 if counts .BareMetalInstanceCount != nil {
102- total += int ( * counts .BareMetalInstanceCount )
103+ total += * counts .BareMetalInstanceCount
103104 }
104105 if counts .HardwareCount != nil {
105- total += int ( * counts .HardwareCount )
106+ total += * counts .HardwareCount
106107 }
107108 if counts .VirtualGuestCount != nil {
108- total += int ( * counts .VirtualGuestCount )
109+ total += * counts .VirtualGuestCount
109110 }
110111 return total , err
111112}
0 commit comments