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

Added search fields in apps object #223

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions object_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ type IBObjectManager interface {
UpdateTXTRecord(ref string, recordName string, text string, ttl uint32, useTtl bool, comment string, eas EA) (*RecordTXT, error)
UpdateARecord(ref string, name string, ipAddr string, cidr string, netview string, ttl uint32, useTTL bool, comment string, eas EA) (*RecordA, error)
UpdateZoneDelegated(ref string, delegate_to []NameServer) (*ZoneDelegated, error)
GetDnsMember(ref string) ([]Dns, error)
GetDnsMember(searchFields map[string]string, ref string) ([]Dns, error)
UpdateDnsStatus(ref string, status bool) (Dns, error)
GetDhcpMember(ref string) ([]Dhcp, error)
GetDhcpMember(searchFields map[string]string, ref string) ([]Dhcp, error)
UpdateDhcpStatus(ref string, status bool) (Dhcp, error)
}

Expand Down
8 changes: 4 additions & 4 deletions object_manager_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package ibclient

import "fmt"

func (objMgr *ObjectManager) GetDnsMember(ref string) ([]Dns, error) {
func (objMgr *ObjectManager) GetDnsMember(searchFields map[string]string, ref string) ([]Dns, error) {
var res []Dns
queryParams := NewQueryParams(false, nil)
queryParams := NewQueryParams(false, searchFields)
dns := NewDns(Dns{})
err := objMgr.connector.GetObject(dns, ref, queryParams, &res)
if err != nil {
Expand All @@ -17,9 +17,9 @@ func (objMgr *ObjectManager) GetDnsMember(ref string) ([]Dns, error) {
return res, nil
}

func (objMgr *ObjectManager) GetDhcpMember(ref string) ([]Dhcp, error) {
func (objMgr *ObjectManager) GetDhcpMember(searchFields map[string]string, ref string) ([]Dhcp, error) {
var res []Dhcp
queryParams := NewQueryParams(false, nil)
queryParams := NewQueryParams(false, searchFields)
dhcp := NewDhcp(Dhcp{})
err := objMgr.connector.GetObject(dhcp, ref, queryParams, &res)
if err != nil {
Expand Down
14 changes: 7 additions & 7 deletions object_manager_apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

var _ = Describe("Object Manager: apps", func() {

sf := map[string]string{"host_name": "infoblox.localdomain"}
Describe("Get DNS member by reference", func() {
cmpType := "Docker"
tenantID := "01234567890abcdef01234567890abcdef"
Expand All @@ -18,7 +18,7 @@ var _ = Describe("Object Manager: apps", func() {
ncFakeConnector := &fakeConnector{
getObjectObj: NewDns(Dns{}),
getObjectRef: fakeRefReturn,
getObjectQueryParams: NewQueryParams(false, nil),
getObjectQueryParams: NewQueryParams(false, sf),
resultObject: resObj,
}

Expand All @@ -27,7 +27,7 @@ var _ = Describe("Object Manager: apps", func() {
var actualDns []Dns
var err error
It("should pass expected Dns Object to GetObject", func() {
actualDns, err = objMgr.GetDnsMember(fakeRefReturn)
actualDns, err = objMgr.GetDnsMember(sf, fakeRefReturn)
})
It("should return expected Dns Object", func() {
Expect(err).To(BeNil())
Expand All @@ -46,7 +46,7 @@ var _ = Describe("Object Manager: apps", func() {
ncFakeConnector := &fakeConnector{
getObjectObj: NewDns(Dns{}),
getObjectRef: fakeRefReturn,
getObjectQueryParams: NewQueryParams(false, nil),
getObjectQueryParams: NewQueryParams(false, sf),
resultObject: resObj,
}

Expand All @@ -55,7 +55,7 @@ var _ = Describe("Object Manager: apps", func() {
var actualDns []Dns
var err error
It("should pass expected Dns Object to GetObject", func() {
actualDns, err = objMgr.GetDnsMember(fakeRefReturn)
actualDns, err = objMgr.GetDnsMember(sf, fakeRefReturn)
})
It("should return expected Dns Object", func() {
Expect(err).To(BeNil())
Expand All @@ -74,7 +74,7 @@ var _ = Describe("Object Manager: apps", func() {
ncFakeConnector := &fakeConnector{
getObjectObj: NewDhcp(Dhcp{}),
getObjectRef: fakeRefReturn,
getObjectQueryParams: NewQueryParams(false, nil),
getObjectQueryParams: NewQueryParams(false, sf),
resultObject: resObj,
}

Expand All @@ -83,7 +83,7 @@ var _ = Describe("Object Manager: apps", func() {
var actualDhcp []Dhcp
var err error
It("should pass expected Dhcp Object to GetObject", func() {
actualDhcp, err = objMgr.GetDhcpMember(fakeRefReturn)
actualDhcp, err = objMgr.GetDhcpMember(sf, fakeRefReturn)
})
It("should return expected Dhcp Object", func() {
Expect(err).To(BeNil())
Expand Down