Skip to content

Commit

Permalink
Merge pull request #237 from ns1/PENG-4708/go_ask_update
Browse files Browse the repository at this point in the history
Add new monitoring permissions support
  • Loading branch information
hmodi-ns1 authored Jul 23, 2024
2 parents a9aa040 + e316263 commit 89eb799
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.12.0 (Jul 19th, 2024)

FEATURES:

* Adds support for new split monitoring permissions create_jobs, update_jobs and delete_jobs

## 2.11.0 (May 23rd, 2024)

FEATURES:
Expand Down
5 changes: 5 additions & 0 deletions rest/account_apikey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"gopkg.in/ns1/ns1-go.v2/rest/model/account"
)

Expand All @@ -22,6 +23,10 @@ func TestCreateAPIKey(t *testing.T) {
assert.Nil(t, k.Permissions.Security)
assert.Nil(t, k.Permissions.DHCP)
assert.Nil(t, k.Permissions.IPAM)
assert.False(t, k.Permissions.Monitoring.ManageJobs)
assert.False(t, k.Permissions.Monitoring.CreateJobs)
assert.False(t, k.Permissions.Monitoring.UpdateJobs)
assert.False(t, k.Permissions.Monitoring.DeleteJobs)

_, err = w.Write(b)
require.NoError(t, err)
Expand Down
5 changes: 5 additions & 0 deletions rest/account_team_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"gopkg.in/ns1/ns1-go.v2/rest/model/account"
)

Expand All @@ -22,6 +23,10 @@ func TestCreateTeam(t *testing.T) {
assert.Nil(t, tm.Permissions.Security)
assert.Nil(t, tm.Permissions.DHCP)
assert.Nil(t, tm.Permissions.IPAM)
assert.False(t, tm.Permissions.Monitoring.ManageJobs)
assert.False(t, tm.Permissions.Monitoring.CreateJobs)
assert.False(t, tm.Permissions.Monitoring.UpdateJobs)
assert.False(t, tm.Permissions.Monitoring.DeleteJobs)

w.Write(b)
}))
Expand Down
5 changes: 5 additions & 0 deletions rest/account_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"gopkg.in/ns1/ns1-go.v2/rest/model/account"
)

Expand All @@ -22,6 +23,10 @@ func TestCreateUser(t *testing.T) {
assert.Nil(t, u.Permissions.Security)
assert.Nil(t, u.Permissions.DHCP)
assert.Nil(t, u.Permissions.IPAM)
assert.False(t, u.Permissions.Monitoring.ManageJobs)
assert.False(t, u.Permissions.Monitoring.CreateJobs)
assert.False(t, u.Permissions.Monitoring.UpdateJobs)
assert.False(t, u.Permissions.Monitoring.DeleteJobs)

w.Write(b)
}))
Expand Down
2 changes: 1 addition & 1 deletion rest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const (
clientVersion = "2.11.0"
clientVersion = "2.12.0"

defaultEndpoint = "https://api.nsone.net/v1/"
defaultShouldFollowPagination = true
Expand Down
3 changes: 3 additions & 0 deletions rest/model/account/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ type PermissionsMonitoring struct {
ManageLists bool `json:"manage_lists"`
ManageJobs bool `json:"manage_jobs"`
ViewJobs bool `json:"view_jobs"`
CreateJobs bool `json:"create_jobs"`
UpdateJobs bool `json:"update_jobs"`
DeleteJobs bool `json:"delete_jobs"`
}

// PermissionsDHCP wraps a User's "permissions.dhcp" attribute for DDI.
Expand Down
3 changes: 3 additions & 0 deletions rest/model/account/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ func TestUnmarshalUsers(t *testing.T) {
ManageLists: false,
ManageJobs: false,
ViewJobs: false,
CreateJobs: false,
UpdateJobs: false,
DeleteJobs: false,
},
},
},
Expand Down

0 comments on commit 89eb799

Please sign in to comment.