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

use pointer instead of int #75

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
7 changes: 7 additions & 0 deletions bigip.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ func (b *BigIP) APICall(options *APIRequest) ([]byte, error) {
return data, nil
}

// modifies int to *int, needed if we want use 0 values in int and encode to json
func (b *BigIP) IntToPointer(integer int) *int {
var i int
i = integer
return &i
}

func (b *BigIP) iControlPath(parts []string) string {
var buffer bytes.Buffer
var lastPath int
Expand Down
2 changes: 1 addition & 1 deletion ltm.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ type Pool struct {
QueueTimeLimit int `json:"queueTimeLimit,omitempty"`
ReselectTries int `json:"reselectTries,omitempty"`
ServiceDownAction string `json:"serviceDownAction,omitempty"`
SlowRampTime int `json:"slowRampTime,omitempty"`
SlowRampTime *int `json:"slowRampTime,omitempty"`

// Setting this field atomically updates all members.
Members *[]PoolMember `json:"members,omitempty"`
Expand Down
3 changes: 2 additions & 1 deletion ltm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,13 +636,14 @@ func (s *LTMTestSuite) TestModifyPool() {
LoadBalancingMode: "round-robin",
AllowSNAT: "yes",
AllowNAT: "yes",
SlowRampTime: s.Client.IntToPointer(0),
}

s.Client.ModifyPool("/Common/test-pool", config)

assert.Equal(s.T(), "PUT", s.LastRequest.Method)
assert.Equal(s.T(), fmt.Sprintf("/mgmt/tm/%s/%s/%s", uriLtm, uriPool, "~Common~test-pool"), s.LastRequest.URL.Path)
assert.JSONEq(s.T(), `{"name":"test-pool","partition":"Common","allowNat":"yes","allowSnat":"yes","loadBalancingMode":"round-robin","monitor":"/Common/http"}`, s.LastRequestBody)
assert.JSONEq(s.T(), `{"name":"test-pool","partition":"Common","allowNat":"yes","allowSnat":"yes","loadBalancingMode":"round-robin","monitor":"/Common/http","slowRampTime":0}`, s.LastRequestBody)
}

func (s *LTMTestSuite) TestModifyPoolWithMembers() {
Expand Down