-
| Hello, Thanks for the job done to change this library to use openapi. I have several questions: 
 Thanks. | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            jqueuniet
          
      
      
        Jan 31, 2024 
      
    
    Replies: 1 comment 11 replies
-
| I posted a creation example earlier in the OpenAPI discussion, but here it is for convenience: // Create an IP address
req := netbox.WritableIPAddressRequest{
	Address: address,
}
req.SetTenant(tenant.Id)
req.SetStatus("active")
if vrf != nil {
	req.SetVrf(vrf.Id)
}
ipAddress, resp, err := client.
	IpamApi.
	IpamIpAddressesCreate(ctx).
	WritableIPAddressRequest(req).
	Execute()Here is another for a VM interface with slightly different calls: req := netbox.NewWritableVMInterfaceRequestWithDefaults()
req.SetName(fmt.Sprintf("net%d", vif.Index))
req.SetVirtualMachine(vm.Id)
if vif.MTU != 0 {
	req.SetMtu(vif.MTU)
}
nbvif, resp, err := client.
	VirtualizationAPI.
	VirtualizationInterfacesCreate(ctx).
	WritableVMInterfaceRequest(*req).
	Execute()Skipping TLS certificate validation is done by tweaking the  configuration := netbox.NewConfiguration()
configuration.HTTPClient = &http.Client{
	Transport: &http.Transport{
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: true,
		},
	},
}
apiClient = netbox.NewAPIClient(configuration) | 
Beta Was this translation helpful? Give feedback.
                  
                    11 replies
                  
                
            
      Answer selected by
        smutel
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
I posted a creation example earlier in the OpenAPI discussion, but here it is for convenience:
Here is another for a VM interface with slightly different calls: