Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which func to use to get all networks/cidr? #187

Open
tmudalagiri opened this issue Oct 4, 2022 · 5 comments
Open

Which func to use to get all networks/cidr? #187

tmudalagiri opened this issue Oct 4, 2022 · 5 comments

Comments

@tmudalagiri
Copy link

tmudalagiri commented Oct 4, 2022

what is the function to use to get all networks?

@tmudalagiri tmudalagiri changed the title Import go v2 not working - "go get github.com/infobloxopen/infoblox-go-client/v2" Which func to use to get all networks/cidr? Oct 4, 2022
@hemanthKa677
Copy link
Collaborator

Hi @tmudalagiri , there isn't function for this for now. We will add that feature to get the networks, but there are two conditions to get IPv4/v6 networks, and we can add the condition for checking all networks in a specific network_view.

@hemanthKa677
Copy link
Collaborator

Hi @tmudalagiri , there is an go client generator which will add the function that supports and includes this get all networks feature which is under review, so once that gets into the go client, then this function will work as per wapi api documentation.

@Awirbl
Copy link

Awirbl commented Oct 30, 2024

hi @hemanthKa677 any information about this feature?
For the moment, I'm statically declaring the references of my networks in my conf. I don't know if there's a better way without this function available.

@JkhatriInfobox
Copy link
Collaborator

Hi @Awirbl,

You can retrieve data for any object using the following method.

netview2 := "default"
  sf2 := map[string]string{
    "network_view": netview2,
    "comment":      "test comment",
  }

queryParams2 := ibclient.NewQueryParams(false, sf2)

var res2 []ibclient.Network
var nw ibclient.Network
nw.SetReturnFields([]string{"extattrs", "network", "network_view", "comment"})

err = conn.GetObject(&nw, "network", queryParams2, &res2)
if err != nil {
    fmt.Println("Error: ", err)
} else {
    fmt.Println("res:", res2)
}

Outcome for the provided code snippet.
res: [{{[] map[]} network/ZG5zLm5ldHdvcmskMTIuMS4xLjAvMjYvMA:12.1.1.0/26/default default 12.1.1.0/26 map[Site:Uzbekistan] test comment}]

I believe this solution should resolve your concern.

@Awirbl
Copy link

Awirbl commented Nov 6, 2024

Hello @JkhatriInfobox

Super cool, it actually works on the first try! I'm digging a bit deeper because I was missing some elements that weren't very clear in my documentation.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants