Giter Club home page Giter Club logo

Comments (15)

chinmayb avatar chinmayb commented on July 28, 2024

You'll have to use 'eaSearch' while creating RecordA object

from infoblox-go-client.

sjberman avatar sjberman commented on July 28, 2024

Can you provide an example? I'm not sure what you mean.

from infoblox-go-client.

sjberman avatar sjberman commented on July 28, 2024

If you're referring to setting the obj.eaSearch to something, the field is not exported, so I don't have access to setting the variable.

from infoblox-go-client.

chinmayb avatar chinmayb commented on July 28, 2024

I'll raise a PR soon

Corresponding WAPI URL would look like :

/v2.7/record:a?*<eakey>:=<eavalue>

from infoblox-go-client.

sjberman avatar sjberman commented on July 28, 2024

Thanks.

I did try to adjust the URL to have the EAKey and EAvalue in it (similar to how you mentioned), but it returned every object with the EA, and seemed to ignore the http body which had the details about the specific object I wanted. In this case I then had to loop through all those objects until I got the one that I cared about.

from infoblox-go-client.

chinmayb avatar chinmayb commented on July 28, 2024

PR Raised #49
Can you check whether that works for you ?

from infoblox-go-client.

sjberman avatar sjberman commented on July 28, 2024

In briefly glancing at the code, I see a few things.

  1. I need to be able to get both A and CNAME records.
  2. The method you added, GetRecordA, accepts an EA and returns all A records. Which means I'll have to parse through and find the one I want (unless I want all of them, which I do in some cases). One of the nice things about the current GetObject method is that I can specify an A or CNAME record with specific fields, and I'll get back just that record. Being able to simply add an EA to the object I've constructed, and calling GetObject on that should return just that object.

Ideally I would like to be able to construct an A/CNAME record like the one above, and call GetObject and just get that object, or I could also construct an object like this:

obj := ibclient.NewRecordA(
		ibclient.RecordA{
			View:     "default",
			Ea:      ibclient.EA{eaKey: eaVal},
		},
	)

and get all A records in the "default" view with my EA, by using GetObject on that. This is the current way of getting objects without specifying an EA.

from infoblox-go-client.

chinmayb avatar chinmayb commented on July 28, 2024

The method you added, GetRecordA, accepts an EA and returns all A records.

It returns all A records with the associated EA tag. You just have to pass it to the GetRecordA method, if not it will return all the A records

from infoblox-go-client.

sjberman avatar sjberman commented on July 28, 2024

Right, I meant it returns all A records with the EA. What I would like is to simply call GetObject with an A/CNAME record that has an EA in its spec (along with other fields), and just get that single object back. That way I don't need to parse through all the returned objects to try and find the one that I wanted. Also, if I wanted to, I could create some generic A record like the one in my last comment, still use GetObject on it, and that would return me multiple A records. That is how I am currently using GetObject, it simply returns any objects that match the constructed object I passed in.

from infoblox-go-client.

yuewko avatar yuewko commented on July 28, 2024

@chinmayb , have you tried implementing GetRecordA() in a similar fashion as GetNetwork()? i.e. allow GetRecordA() to pass in commonly used search parameters such as netview, name, ipaddr etc, in addition to EA?

from infoblox-go-client.

sjberman avatar sjberman commented on July 28, 2024

Ideally what I would prefer is to continue using GetObject. It is convenient in that I can construct any record (A or CNAME), with whatever fields I want, and it will return to me any objects (or a single object) that match my passed in record. The enhancement that I'm asking for is to also be able to provide an EA
field in the record that I pass to GetObject (maybe this is as simple as setting the EASearch field while in the GetObject method).

from infoblox-go-client.

yuewko avatar yuewko commented on July 28, 2024

@sjberman Yes, that would be the way to do it. I haven't been working on this code for a while, so @chinmayb please see what the implication is.

So, basically, what we can do is, instead of doing, for example, the following in the GetNetwork() method:

    if ea != nil && len(ea) > 0 {                                                               
        network.eaSearch = EASearch(ea)                                                         
    }

move that functionality into the GetObject() method.

from infoblox-go-client.

chinmayb avatar chinmayb commented on July 28, 2024

@sjberman @yuewko should be doable. Will have a look at it as soon as I get some spare time.

from infoblox-go-client.

chinmayb avatar chinmayb commented on July 28, 2024

For some objects EA field wouldnt be there. I feel why not use SetEaSearch field (which i included in the latest PR) explicitly to set the EAs ?

from infoblox-go-client.

yuewko avatar yuewko commented on July 28, 2024

Based on the comment #48 (comment), the expectation is to be able to construct an object with the desired search fields, and pass that to GetObject() to perform search accordingly.

If EA field is set, the GetObject() method should recognize it and set eaSearch field accordingly.

from infoblox-go-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.