Skip to content

Commit

Permalink
feat(userid): add timeout as optional attribute (PaloAltoNetworks#94)
Browse files Browse the repository at this point in the history
* add timeout as optional attribute

* switch to int
  • Loading branch information
pschou authored Oct 23, 2022
1 parent e0ca6ed commit 9b8cc73
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions userid/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ type Message struct {
UntagUsers []UntagUser
}

// Login logs a user in.
// Login logs a user in. Note that `Timeout` is in Minutes.
type Login struct {
User string
Ip string
User string
Ip string
Timeout int
}

// Logout logs a user out.
Expand Down Expand Up @@ -143,6 +144,7 @@ type inOut struct {
XMLName xml.Name `xml:"entry"`
Name string `xml:"name,attr"`
Ip string `xml:"ip,attr"`
Timeout int `xml:"timeout,attr,omitempty"`
}

type tagUntagIpSpec struct {
Expand Down Expand Up @@ -201,8 +203,9 @@ func encode(m *Message) (*uid, string) {
msg.Payload.Login.Entry = make([]inOut, 0, len(m.Logins))
for i := range m.Logins {
x := inOut{
Name: m.Logins[i].User,
Ip: m.Logins[i].Ip,
Name: m.Logins[i].User,
Ip: m.Logins[i].Ip,
Timeout: m.Logins[i].Timeout,
}
msg.Payload.Login.Entry = append(msg.Payload.Login.Entry, x)
}
Expand Down

0 comments on commit 9b8cc73

Please sign in to comment.