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

Backup Schedule : pointers on fields #145

Merged
merged 2 commits into from
May 10, 2021
Merged
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
8 changes: 6 additions & 2 deletions govultr.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,15 @@ func (c *Client) vultrErrorHandler(resp *http.Response, err error, numTries int)

// BoolToBoolPtr helper function that returns a pointer from your bool value
func BoolToBoolPtr(value bool) *bool {
b := value
return &b
return &value
}

// StringToStringPtr helper function that returns a pointer from your string value
func StringToStringPtr(value string) *string {
return &value
}

// IntToIntPtr helper function that returns a pointer from your string value
func IntToIntPtr(value int) *int {
return &value
}
4 changes: 2 additions & 2 deletions instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ type BackupSchedule struct {
// BackupScheduleReq struct used to create a backup schedule for an instance.
type BackupScheduleReq struct {
Type string `json:"type"`
Hour int `json:"hour,omitempty"`
Dow int `json:"dow,omitempty"`
Hour *int `json:"hour,omitempty"`
Dow *int `json:"dow,omitempty"`
Dom int `json:"dom,omitempty"`
}

Expand Down
4 changes: 2 additions & 2 deletions instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ func TestServerServiceHandler_SetBackupSchedule(t *testing.T) {

bs := &BackupScheduleReq{
Type: "weekly",
Hour: 22,
Dow: 2,
Hour: IntToIntPtr(22),
Dow: IntToIntPtr(2),
Dom: 3,
}

Expand Down