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

add auth_zones in return_fields and UnmarshalJson for LBDN #268

Open
wants to merge 1 commit into
base: Feature/DTC
Choose a base branch
from
Open
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
20 changes: 19 additions & 1 deletion object_manager_dtc_lbdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,24 @@ func (d *DtcLbdn) MarshalJSON() ([]byte, error) {
return json.Marshal(aux)
}

func (d *DtcLbdn) UnmarshalJSON(data []byte) error {
type Alias DtcLbdn
aux := &struct {
AuthZones []string `json:"auth_zones"`
*Alias
}{
Alias: (*Alias)(d),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
d.AuthZones = make([]*ZoneAuth, len(aux.AuthZones))
for i, zone := range aux.AuthZones {
d.AuthZones[i] = &ZoneAuth{Ref: zone}
}
return nil
}

func (objMgr *ObjectManager) CreateDtcLbdn(name string, authZones []string, comment string, disable bool, autoConsolidatedMonitors bool, ea EA,
lbMethod string, patterns []string, persistence uint32, pools []*DtcPoolLink, priority uint32, topology string, types []string, ttl uint32, usettl bool) (*DtcLbdn, error) {

Expand Down Expand Up @@ -187,7 +205,7 @@ func NewDtcLbdn(ref string, name string, authZones []*ZoneAuth, comment string,

func NewEmptyDtcLbdn() *DtcLbdn {
dtcLbdn := &DtcLbdn{}
dtcLbdn.SetReturnFields(append(dtcLbdn.ReturnFields(), "extattrs", "disable", "auto_consolidated_monitors", "lb_method", "patterns", "persistence", "pools", "priority", "topology", "types", "health", "ttl", "use_ttl"))
dtcLbdn.SetReturnFields(append(dtcLbdn.ReturnFields(), "extattrs", "disable", "auth_zones", "auto_consolidated_monitors", "lb_method", "patterns", "persistence", "pools", "priority", "topology", "types", "health", "ttl", "use_ttl"))
return dtcLbdn
}

Expand Down