Skip to content

Commit fba2691

Browse files
authored
fix: Added New ZPA Tag Controller Resource Endpoints (#417)
1 parent e593fda commit fba2691

File tree

16 files changed

+1693
-3
lines changed

16 files changed

+1693
-3
lines changed

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# Changelog
22

3+
# 3.8.26 (March 5, 2026)
4+
5+
## Notes
6+
- Golang: **v1.24**
7+
8+
### Enhancements
9+
10+
- [PR #417](https://github.com/zscaler/zscaler-sdk-go/pull/417) Added the following new ZPA Tag Group Controller Endpoints
11+
- `POST /tagGroup/search` Gets all configured TagGroup for the specified customer.
12+
- `POST /tagGroup` Adds a new TagGroup for the specified customer.
13+
- `GET /tagGroup/{tagGroupId}` Gets the TagGroup details for the specified ID.
14+
- `PUT /tagGroup/{tagGroupId}` Updates the TagGroup for the specified ID.
15+
- `DELETE /tagGroup/{tagGroupId}` Deletes the TagGroup for the specified ID.
16+
17+
- [PR #417](https://github.com/zscaler/zscaler-sdk-go/pull/417) Added the following new ZPA Tag Key Controller Endpoints
18+
- `POST /namespace/{namespaceId}/tagKey/search` Gets all configured Tag Keys for the specified customer.
19+
- `POST /namespace/{namespaceId}/tagKey` Adds a new Tag Key for a given namespace.
20+
- `GET /namespace/{namespaceId}/tagKey/{tagKeyId}` Gets the Tag Key details for the specified ID.
21+
- `PUT /namespace/{namespaceId}/tagKey/{tagKeyId}` Updates the Tag Key for the specified ID.
22+
- `DELETE /namespace/{namespaceId}/tagKey/{tagKeyId}` Deletes the Tag Key for the specified ID.
23+
- `PUT /namespace/{namespaceId}/tagKey/bulkUpdateStatus` Bulk update to enable/disable Tag Keys.
24+
25+
- [PR #417](https://github.com/zscaler/zscaler-sdk-go/pull/417) Added the following new ZPA Tag Namespace Controller Endpoints
26+
- `POST /namespace/search` Gets all Namespace for the specified customer based on given filters.
27+
- `POST /namespace` Adds a new Namespace for the specified customer.
28+
- `GET /namespace/{namespaceId}` Gets the Namespace details for the specified ID.
29+
- `PUT /namespace/{namespaceId}` Updates the Namespace for the specified ID.
30+
- `DELETE /namespace/{namespaceId}` Deletes the Namespace for the specified ID.
31+
- `PUT /namespace/{namespaceId}/status` Enables or disables a predefined Namespace.
32+
33+
- [PR #417](https://github.com/zscaler/zscaler-sdk-go/pull/417) - Added new attribute `dedicatedIPGateway` to ZIA `forwardin_rules` package
34+
335
# 3.8.25 (March 2, 2026)
436

537
## Notes

docs/guides/release-notes.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,42 @@ Track all Zscaler SDK GO releases. New resources, features, and bug fixes will b
1313

1414
---
1515

16-
``Last updated: v3.8.25``
16+
``Last updated: v3.8.26``
1717

1818
---
1919

20+
# 3.8.26 (March 5, 2026)
21+
22+
## Notes
23+
- Golang: **v1.24**
24+
25+
### Enhancements
26+
27+
- [PR #417](https://github.com/zscaler/zscaler-sdk-go/pull/417) Added the following new ZPA Tag Group Controller Endpoints
28+
- `POST /tagGroup/search` Gets all configured TagGroup for the specified customer.
29+
- `POST /tagGroup` Adds a new TagGroup for the specified customer.
30+
- `GET /tagGroup/{tagGroupId}` Gets the TagGroup details for the specified ID.
31+
- `PUT /tagGroup/{tagGroupId}` Updates the TagGroup for the specified ID.
32+
- `DELETE /tagGroup/{tagGroupId}` Deletes the TagGroup for the specified ID.
33+
34+
- [PR #417](https://github.com/zscaler/zscaler-sdk-go/pull/417) Added the following new ZPA Tag Key Controller Endpoints
35+
- `POST /namespace/{namespaceId}/tagKey/search` Gets all configured Tag Keys for the specified customer.
36+
- `POST /namespace/{namespaceId}/tagKey` Adds a new Tag Key for a given namespace.
37+
- `GET /namespace/{namespaceId}/tagKey/{tagKeyId}` Gets the Tag Key details for the specified ID.
38+
- `PUT /namespace/{namespaceId}/tagKey/{tagKeyId}` Updates the Tag Key for the specified ID.
39+
- `DELETE /namespace/{namespaceId}/tagKey/{tagKeyId}` Deletes the Tag Key for the specified ID.
40+
- `PUT /namespace/{namespaceId}/tagKey/bulkUpdateStatus` Bulk update to enable/disable Tag Keys.
41+
42+
- [PR #417](https://github.com/zscaler/zscaler-sdk-go/pull/417) Added the following new ZPA Tag Namespace Controller Endpoints
43+
- `POST /namespace/search` Gets all Namespace for the specified customer based on given filters.
44+
- `POST /namespace` Adds a new Namespace for the specified customer.
45+
- `GET /namespace/{namespaceId}` Gets the Namespace details for the specified ID.
46+
- `PUT /namespace/{namespaceId}` Updates the Namespace for the specified ID.
47+
- `DELETE /namespace/{namespaceId}` Deletes the Namespace for the specified ID.
48+
- `PUT /namespace/{namespaceId}/status` Enables or disables a predefined Namespace.
49+
50+
- [PR #417](https://github.com/zscaler/zscaler-sdk-go/pull/417) - Added new attribute `dedicatedIPGateway` to ZIA `forwardin_rules` package
51+
2052
# 3.8.25 (March 2, 2026)
2153

2254
## Notes
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
// Package unit provides unit tests for ZPA services
2+
package unit
3+
4+
import (
5+
"context"
6+
"net/http"
7+
"testing"
8+
9+
"github.com/stretchr/testify/assert"
10+
"github.com/stretchr/testify/require"
11+
"github.com/zscaler/zscaler-sdk-go/v3/tests/unit/common"
12+
"github.com/zscaler/zscaler-sdk-go/v3/zscaler/zpa/services/tag_controller/tag_group"
13+
)
14+
15+
func TestTagGroup_Get_SDK(t *testing.T) {
16+
server := common.NewTestServer()
17+
defer server.Close()
18+
19+
tagGroupID := "tg-12345"
20+
path := "/zpa/mgmtconfig/v1/admin/customers/" + testCustomerID + "/tagGroup/" + tagGroupID
21+
22+
server.On("GET", path, common.SuccessResponse(tag_group.TagGroup{
23+
ID: tagGroupID,
24+
Name: "Test Tag Group",
25+
Description: "Test description",
26+
}))
27+
28+
service, err := common.CreateTestService(context.Background(), server, testCustomerID)
29+
require.NoError(t, err)
30+
31+
result, resp, err := tag_group.Get(context.Background(), service, tagGroupID)
32+
33+
require.NoError(t, err)
34+
require.NotNil(t, result)
35+
assert.NotNil(t, resp)
36+
assert.Equal(t, tagGroupID, result.ID)
37+
assert.Equal(t, "Test Tag Group", result.Name)
38+
}
39+
40+
func TestTagGroup_GetByName_SDK(t *testing.T) {
41+
server := common.NewTestServer()
42+
defer server.Close()
43+
44+
tagGroupName := "Production Tag Group"
45+
path := "/zpa/mgmtconfig/v1/admin/customers/" + testCustomerID + "/tagGroup/search"
46+
47+
server.On("POST", path, common.SuccessResponse(map[string]interface{}{
48+
"list": []tag_group.TagGroup{
49+
{ID: "tg-001", Name: "Other Group"},
50+
{ID: "tg-002", Name: tagGroupName},
51+
},
52+
"totalPages": 1,
53+
}))
54+
55+
service, err := common.CreateTestService(context.Background(), server, testCustomerID)
56+
require.NoError(t, err)
57+
58+
result, _, err := tag_group.GetByName(context.Background(), service, tagGroupName)
59+
60+
require.NoError(t, err)
61+
require.NotNil(t, result)
62+
assert.Equal(t, "tg-002", result.ID)
63+
assert.Equal(t, tagGroupName, result.Name)
64+
}
65+
66+
func TestTagGroup_Create_SDK(t *testing.T) {
67+
server := common.NewTestServer()
68+
defer server.Close()
69+
70+
path := "/zpa/mgmtconfig/v1/admin/customers/" + testCustomerID + "/tagGroup"
71+
72+
server.On("POST", path, common.SuccessResponse(tag_group.TagGroup{
73+
ID: "new-tg-123",
74+
Name: "New Tag Group",
75+
Description: "Created via unit test",
76+
}))
77+
78+
service, err := common.CreateTestService(context.Background(), server, testCustomerID)
79+
require.NoError(t, err)
80+
81+
result, _, err := tag_group.Create(context.Background(), service, tag_group.TagGroup{
82+
Name: "New Tag Group",
83+
Description: "Created via unit test",
84+
})
85+
86+
require.NoError(t, err)
87+
require.NotNil(t, result)
88+
assert.Equal(t, "new-tg-123", result.ID)
89+
assert.Equal(t, "New Tag Group", result.Name)
90+
}
91+
92+
func TestTagGroup_Update_SDK(t *testing.T) {
93+
server := common.NewTestServer()
94+
defer server.Close()
95+
96+
tagGroupID := "tg-12345"
97+
path := "/zpa/mgmtconfig/v1/admin/customers/" + testCustomerID + "/tagGroup/" + tagGroupID
98+
99+
server.On("PUT", path, common.NoContentResponse())
100+
101+
service, err := common.CreateTestService(context.Background(), server, testCustomerID)
102+
require.NoError(t, err)
103+
104+
resp, err := tag_group.Update(context.Background(), service, tagGroupID, &tag_group.TagGroup{
105+
ID: tagGroupID,
106+
Name: "Updated Tag Group",
107+
Description: "Updated description",
108+
})
109+
110+
require.NoError(t, err)
111+
assert.NotNil(t, resp)
112+
}
113+
114+
func TestTagGroup_Delete_SDK(t *testing.T) {
115+
server := common.NewTestServer()
116+
defer server.Close()
117+
118+
tagGroupID := "tg-12345"
119+
path := "/zpa/mgmtconfig/v1/admin/customers/" + testCustomerID + "/tagGroup/" + tagGroupID
120+
121+
server.On("DELETE", path, common.NoContentResponse())
122+
123+
service, err := common.CreateTestService(context.Background(), server, testCustomerID)
124+
require.NoError(t, err)
125+
126+
resp, err := tag_group.Delete(context.Background(), service, tagGroupID)
127+
128+
require.NoError(t, err)
129+
assert.NotNil(t, resp)
130+
}
131+
132+
func TestTagGroup_GetAll_SDK(t *testing.T) {
133+
server := common.NewTestServer()
134+
defer server.Close()
135+
136+
path := "/zpa/mgmtconfig/v1/admin/customers/" + testCustomerID + "/tagGroup/search"
137+
138+
server.On("POST", path, common.SuccessResponse(map[string]interface{}{
139+
"list": []tag_group.TagGroup{
140+
{ID: "tg-001", Name: "Group 1"},
141+
{ID: "tg-002", Name: "Group 2"},
142+
{ID: "tg-003", Name: "Group 3"},
143+
},
144+
"totalPages": 1,
145+
}))
146+
147+
service, err := common.CreateTestService(context.Background(), server, testCustomerID)
148+
require.NoError(t, err)
149+
150+
result, _, err := tag_group.GetAll(context.Background(), service)
151+
152+
require.NoError(t, err)
153+
require.NotNil(t, result)
154+
assert.Len(t, result, 3)
155+
}
156+
157+
func TestTagGroup_GetByName_NotFound_SDK(t *testing.T) {
158+
server := common.NewTestServer()
159+
defer server.Close()
160+
161+
path := "/zpa/mgmtconfig/v1/admin/customers/" + testCustomerID + "/tagGroup/search"
162+
163+
server.On("POST", path, common.SuccessResponse(map[string]interface{}{
164+
"list": []tag_group.TagGroup{},
165+
"totalPages": 0,
166+
}))
167+
168+
service, err := common.CreateTestService(context.Background(), server, testCustomerID)
169+
require.NoError(t, err)
170+
171+
result, _, err := tag_group.GetByName(context.Background(), service, "NonExistent")
172+
173+
assert.Error(t, err)
174+
assert.Nil(t, result)
175+
assert.Contains(t, err.Error(), "no tag group named")
176+
}
177+
178+
func TestTagGroup_Get_NotFound_SDK(t *testing.T) {
179+
server := common.NewTestServer()
180+
defer server.Close()
181+
182+
tagGroupID := "nonexistent-id"
183+
path := "/zpa/mgmtconfig/v1/admin/customers/" + testCustomerID + "/tagGroup/" + tagGroupID
184+
185+
server.On("GET", path, common.MockResponse{
186+
StatusCode: http.StatusNotFound,
187+
Body: `{"id": "resource.not.found", "message": "Resource not found"}`,
188+
})
189+
190+
service, err := common.CreateTestService(context.Background(), server, testCustomerID)
191+
require.NoError(t, err)
192+
193+
result, _, err := tag_group.Get(context.Background(), service, tagGroupID)
194+
195+
assert.Error(t, err)
196+
assert.Nil(t, result)
197+
}

0 commit comments

Comments
 (0)