File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 2222	ErrParentPrefixExhausted            =  errors .New ("parent prefix exhausted" )
2323	ErrParentPrefixNotFound             =  errors .New ("parent prefix not found" )
2424	ErrWrongMatchingPrefixSubnetFormat  =  errors .New ("wrong matchingPrefix subnet format" )
25+ 	ErrInvalidIpFamily                  =  errors .New ("invalid IP Family" )
2526)
Original file line number Diff line number Diff line change @@ -115,7 +115,15 @@ func (r *NetboxClient) GetAvailablePrefixByParentPrefixSelector(prefixClaimSpec
115115	}
116116
117117	if  family , ok  :=  prefixClaimSpec .ParentPrefixSelector ["family" ]; ok  {
118- 		fieldEntries ["family" ] =  family 
118+ 		familyToInt  :=  - 1 
119+ 		if  family  ==  "IPv4"  {
120+ 			familyToInt  =  4 
121+ 		} else  if  family  ==  "IPv6"  {
122+ 			familyToInt  =  6 
123+ 		} else  {
124+ 			return  nil , ErrInvalidIpFamily 
125+ 		}
126+ 		fieldEntries ["family" ] =  strconv .Itoa (familyToInt )
119127	}
120128
121129	var  conditions  func (co  * runtime.ClientOperation )
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments