forked from mmussett/ems
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
49 lines (38 loc) · 767 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package ems
import "net/url"
type ClientOptions struct {
serverUrl url.URL
username string
password string
}
func NewClientOptions() *ClientOptions {
o := &ClientOptions{
username: "",
password: "",
}
return o
}
func (o *ClientOptions) SetServerUrl(p string) *ClientOptions {
url, err := url.Parse(p)
if err == nil {
o.serverUrl = *url
}
return o
}
func (o *ClientOptions) SetUsername(p string) *ClientOptions {
o.username = p
return o
}
func (o *ClientOptions) SetPassword(p string) *ClientOptions {
o.password = p
return o
}
func (o *ClientOptions) GetServerUrl() url.URL {
return o.serverUrl
}
func (o *ClientOptions) GetUsername() string {
return o.username
}
func (o *ClientOptions) GetPassword() string {
return o.password
}