Community

How to connect a loadbalancer to public LAN with python SDK>?

I have a loadbalancer with balanced nics. Question, how to grab the NIC of the loadbalancer and connect it to a public LAN?

Best Regards, Wojtek

 
  • **bold**
  • _italics_
  • `code`
  • ```code block```
  • # Heading 1
  • ## Heading 2
  • > Quote
 

Hello Wojtek,

I'll try to test a python code example, but I think you can accomplish what you are asking by updating the LAN that the load balancer is using and setting its value "public" to true. The direct API request would look something like:

Send a PATCH request to:

https://api.profitbricks.com/cloudapi/v4/datacenters/YOUR_VDC_ID/lans/YOUR_LAN_ID

YOUR_LAN_ID should be a single digit, such as "2".

with this JSON body:

{"public":true}

Here is something based on the example from the Python SDK docs, though I haven't gotten to test it just yet:

response = client.update_lan(
    datacenter_id='UUID',
    lan_id=ID,
    name='LB Lan',
    public=True)

Let me know if that helps out or if there is still an issue.

Eric