Skip to content

Commit a1d6f11

Browse files
authored
Revert "fix: project snapshot import exclude list" (#691)
This reverts commit e7f2a2e.
1 parent e7f2a2e commit a1d6f11

File tree

4 files changed

+4
-60
lines changed

4 files changed

+4
-60
lines changed

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,12 +1647,7 @@ if !res.Ok {
16471647
inputSecrets := ...
16481648

16491649
// Import the previously exported snapshot into the current project
1650-
// Optionally specify entity types to exclude from the import (e.g., "connectors", "flows", "roles")
1651-
importReq := &descope.ImportSnapshotRequest{
1652-
Files: files,
1653-
InputSecrets: inputSecrets,
1654-
Excludes: []string{"connectors", "flows"}, // Optional: exclude specific entity types from import
1655-
}
1650+
importReq := &descope.ImportSnapshotRequest{Files: files, InputSecrets: inputSecrets}
16561651
err := descopeClient.Management.Project().ImportSnapshot(context.Background(), importReq)
16571652
if err != nil {
16581653
// handle import failure

descope/internal/mgmt/audit_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func TestCreateAuditWebhookConnector(t *testing.T) {
288288
filter1 := filters[0].(map[string]any)
289289
assert.EqualValues(t, "actions", filter1["filterType"])
290290
assert.EqualValues(t, "includes", filter1["operator"])
291-
assert.EqualValues(t, []any{"AccessKeyExchange", "AuthzNamespaceCreated"}, filter1["values"])
291+
assert.EqualValues(t, []any{"action1", "action2"}, filter1["values"])
292292
filter2 := filters[1].(map[string]any)
293293
assert.EqualValues(t, "tenants", filter2["filterType"])
294294
assert.EqualValues(t, "excludes", filter2["operator"])
@@ -300,7 +300,7 @@ func TestCreateAuditWebhookConnector(t *testing.T) {
300300
{
301301
FilterType: descope.FilterTypeActions,
302302
Operator: descope.OperatorIncludes,
303-
Values: []string{"AccessKeyExchange", "AuthzNamespaceCreated"},
303+
Values: []string{"action1", "action2"},
304304
},
305305
{
306306
FilterType: descope.FilterTypeTenants,

descope/internal/mgmt/project_test.go

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -31,56 +31,8 @@ func TestProjectImport(t *testing.T) {
3131
files, ok := req["files"].(map[string]any)
3232
require.True(t, ok)
3333
require.Equal(t, "bar", files["foo"])
34-
excludes, ok := req["excludes"].([]any)
35-
require.True(t, ok)
36-
require.Len(t, excludes, 2)
37-
require.Equal(t, "connectors", excludes[0])
38-
require.Equal(t, "flows", excludes[1])
39-
}))
40-
req := &descope.ImportSnapshotRequest{
41-
Files: map[string]any{"foo": "bar"},
42-
Excludes: []string{"connectors", "flows"},
43-
}
44-
err := mgmt.Project().ImportSnapshot(context.Background(), req)
45-
require.NoError(t, err)
46-
}
47-
48-
func TestProjectImportWithoutExcludes(t *testing.T) {
49-
mgmt := newTestMgmt(nil, helpers.DoOk(func(r *http.Request) {
50-
require.Equal(t, r.Header.Get("Authorization"), "Bearer a:key")
51-
req := map[string]any{}
52-
require.NoError(t, helpers.ReadBody(r, &req))
53-
files, ok := req["files"].(map[string]any)
54-
require.True(t, ok)
55-
require.Equal(t, "bar", files["foo"])
56-
// Verify excludes field is not present in the JSON when nil
57-
_, excludesPresent := req["excludes"]
58-
require.False(t, excludesPresent, "excludes field should not be present when nil")
59-
}))
60-
req := &descope.ImportSnapshotRequest{
61-
Files: map[string]any{"foo": "bar"},
62-
// Excludes is intentionally nil to test backward compatibility
63-
}
64-
err := mgmt.Project().ImportSnapshot(context.Background(), req)
65-
require.NoError(t, err)
66-
}
67-
68-
func TestProjectImportWithEmptyExcludes(t *testing.T) {
69-
mgmt := newTestMgmt(nil, helpers.DoOk(func(r *http.Request) {
70-
require.Equal(t, r.Header.Get("Authorization"), "Bearer a:key")
71-
req := map[string]any{}
72-
require.NoError(t, helpers.ReadBody(r, &req))
73-
files, ok := req["files"].(map[string]any)
74-
require.True(t, ok)
75-
require.Equal(t, "bar", files["foo"])
76-
// Verify excludes field is not present in the JSON when empty (due to omitempty)
77-
_, excludesPresent := req["excludes"]
78-
require.False(t, excludesPresent, "excludes field should not be present when empty due to omitempty")
7934
}))
80-
req := &descope.ImportSnapshotRequest{
81-
Files: map[string]any{"foo": "bar"},
82-
Excludes: []string{}, // Empty slice to test backward compatibility
83-
}
35+
req := &descope.ImportSnapshotRequest{Files: map[string]any{"foo": "bar"}}
8436
err := mgmt.Project().ImportSnapshot(context.Background(), req)
8537
require.NoError(t, err)
8638
}
@@ -100,7 +52,6 @@ func TestValidateProjectImport(t *testing.T) {
10052
files, ok := req["files"].(map[string]any)
10153
require.True(t, ok)
10254
require.Equal(t, "bar", files["foo"])
103-
10455
secrets, ok := req["inputSecrets"].(map[string]any)
10556
require.True(t, ok)
10657
list, ok := secrets["connectors"].([]any)

descope/types.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,6 @@ type ExportSnapshotResponse struct {
11261126
type ImportSnapshotRequest struct {
11271127
// All project settings and configurations represented as JSON files
11281128
Files map[string]any `json:"files"`
1129-
// An optional list of entity types to exclude from the import
1130-
Excludes []string `json:"excludes,omitempty"`
11311129
// An optional map of project entities and their secrets that will be
11321130
// injected into the snapshot before import (see below)
11331131
InputSecrets *SnapshotSecrets `json:"inputSecrets,omitempty"`

0 commit comments

Comments
 (0)