Skip to content

Commit 7864ba9

Browse files
Feature/fix docs (#2199)
* fix docs * fix go fmt
1 parent 8cfc14a commit 7864ba9

File tree

4 files changed

+41
-44
lines changed

4 files changed

+41
-44
lines changed

docs/resources/outbound_digitalruleset.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,11 @@ resource "genesyscloud_outbound_digitalruleset" "test_ruleset_sample" {
6363
<!-- schema generated by tfplugindocs -->
6464
## Schema
6565

66-
### Required
67-
68-
- `rules` (Block List, Min: 1) The list of rules. (see [below for nested schema](#nestedblock--rules))
69-
7066
### Optional
7167

7268
- `contact_list_id` (String) A ContactList to provide suggestions for contact columns on relevant conditions and actions.
7369
- `name` (String) The name of the digital rule set
70+
- `rules` (Block List) The list of rules. (see [below for nested schema](#nestedblock--rules))
7471

7572
### Read-Only
7673

genesyscloud/bcp_tf_exporter/genesyscloud_bcp_tf_exporter_proxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func getFlowDependenciesFn(ctx context.Context, p *BcpExporterProxy, resourceInf
6565
freshConfig.BasePath = p.ClientConfig.BasePath
6666
freshConfig.AccessToken = p.ClientConfig.AccessToken
6767
freshConfig.DefaultHeader = p.ClientConfig.DefaultHeader // Direct assignment is safe for read-only use
68-
68+
6969
depConsumerProxy := dependentconsumers.GetDependentConsumerProxy(freshConfig)
7070
resources, dependsMap, _, err := depConsumerProxy.GetDependentConsumers(ctx, resourceInfo, []string{})
7171
if err != nil {

genesyscloud/dependent_consumers/genesyscloud_dependent_consumer_proxy_test.go

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package dependent_consumers
33
import (
44
"testing"
55

6-
resourceExporter "github.com/mypurecloud/terraform-provider-genesyscloud/genesyscloud/resource_exporter"
76
"github.com/mypurecloud/platform-client-sdk-go/v179/platformclientv2"
7+
resourceExporter "github.com/mypurecloud/terraform-provider-genesyscloud/genesyscloud/resource_exporter"
88
"github.com/stretchr/testify/assert"
99
)
1010

@@ -15,13 +15,13 @@ func TestBuildDependsMap(t *testing.T) {
1515
"id3": {BlockLabel: "genesyscloud_flow::::id3"},
1616
}
1717
dependsMap := make(map[string][]string)
18-
18+
1919
result := buildDependsMap(resources, dependsMap, "main-id")
20-
20+
2121
assert.NotNil(t, result)
2222
assert.Contains(t, result, "main-id")
2323
assert.Len(t, result["main-id"], 3)
24-
24+
2525
// Verify all expected dependencies are present
2626
deps := result["main-id"]
2727
assert.Contains(t, deps, "genesyscloud_user.id1")
@@ -35,19 +35,19 @@ func TestBuildDependsMap_ExcludesSelf(t *testing.T) {
3535
"id2": {BlockLabel: "genesyscloud_queue::::id2"},
3636
}
3737
dependsMap := make(map[string][]string)
38-
38+
3939
result := buildDependsMap(resources, dependsMap, "id1")
40-
40+
4141
assert.Len(t, result["id1"], 1)
4242
assert.Equal(t, "genesyscloud_queue.id2", result["id1"][0])
4343
}
4444

4545
func TestBuildDependsMap_EmptyResources(t *testing.T) {
4646
resources := resourceExporter.ResourceIDMetaMap{}
4747
dependsMap := make(map[string][]string)
48-
48+
4949
result := buildDependsMap(resources, dependsMap, "main-id")
50-
50+
5151
assert.NotNil(t, result)
5252
assert.Contains(t, result, "main-id")
5353
assert.Empty(t, result["main-id"])
@@ -59,15 +59,15 @@ func TestBuildDependsMap_Deterministic(t *testing.T) {
5959
"a-id": {BlockLabel: "genesyscloud_queue::::a-id"},
6060
"m-id": {BlockLabel: "genesyscloud_flow::::m-id"},
6161
}
62-
62+
6363
// Run multiple times to verify consistent ordering
6464
results := make([][]string, 5)
6565
for i := 0; i < 5; i++ {
6666
dependsMap := make(map[string][]string)
6767
result := buildDependsMap(resources, dependsMap, "main-id")
6868
results[i] = result["main-id"]
6969
}
70-
70+
7171
// All results should be identical
7272
for i := 1; i < 5; i++ {
7373
assert.Equal(t, results[0], results[i])
@@ -76,7 +76,7 @@ func TestBuildDependsMap_Deterministic(t *testing.T) {
7676

7777
func TestGetResourceType(t *testing.T) {
7878
dependentConsumerMap := SetDependentObjectMaps()
79-
79+
8080
tests := []struct {
8181
name string
8282
varType string
@@ -88,15 +88,15 @@ func TestGetResourceType(t *testing.T) {
8888
{"valid flow", "BOTFLOW", "genesyscloud_flow", true},
8989
{"invalid type", "INVALID_TYPE", "", false},
9090
}
91-
91+
9292
for _, tt := range tests {
9393
t.Run(tt.name, func(t *testing.T) {
9494
consumer := platformclientv2.Dependency{
9595
VarType: &tt.varType,
9696
}
97-
97+
9898
resourceType, ok := getResourceType(consumer, dependentConsumerMap)
99-
99+
100100
assert.Equal(t, tt.expectedOk, ok)
101101
assert.Equal(t, tt.expectedType, resourceType)
102102
})
@@ -107,35 +107,35 @@ func TestGetResourceFilter(t *testing.T) {
107107
varType := "QUEUE"
108108
id := "test-id-123"
109109
name := "Test Queue"
110-
110+
111111
consumer := platformclientv2.Dependency{
112112
VarType: &varType,
113113
Id: &id,
114114
Name: &name,
115115
}
116-
116+
117117
result := getResourceFilter(consumer, "genesyscloud_routing_queue")
118-
118+
119119
assert.Equal(t, "genesyscloud_routing_queue::::test-id-123", result)
120120
}
121121

122122
func TestProcessResource(t *testing.T) {
123123
varType := "QUEUE"
124124
id := "queue-123"
125125
name := "Test Queue"
126-
126+
127127
consumer := platformclientv2.Dependency{
128128
VarType: &varType,
129129
Id: &id,
130130
Name: &name,
131131
}
132-
132+
133133
resources := make(resourceExporter.ResourceIDMetaMap)
134134
architectDependencies := make(map[string][]string)
135135
key := "flow-123"
136-
136+
137137
resources, architectDependencies = processResource(consumer, "genesyscloud_routing_queue", resources, architectDependencies, key)
138-
138+
139139
assert.Contains(t, resources, "queue-123")
140140
assert.Equal(t, "genesyscloud_routing_queue::::queue-123", resources["queue-123"].BlockLabel)
141141
assert.Contains(t, architectDependencies, key)
@@ -146,20 +146,20 @@ func TestProcessResource_DoesNotDuplicate(t *testing.T) {
146146
varType := "QUEUE"
147147
id := "queue-123"
148148
name := "Test Queue"
149-
149+
150150
consumer := platformclientv2.Dependency{
151151
VarType: &varType,
152152
Id: &id,
153153
Name: &name,
154154
}
155-
155+
156156
resources := make(resourceExporter.ResourceIDMetaMap)
157157
resources["queue-123"] = &resourceExporter.ResourceMeta{BlockLabel: "existing"}
158158
architectDependencies := make(map[string][]string)
159159
key := "flow-123"
160-
160+
161161
resources, architectDependencies = processResource(consumer, "genesyscloud_routing_queue", resources, architectDependencies, key)
162-
162+
163163
// Should not overwrite existing resource
164164
assert.Equal(t, "existing", resources["queue-123"].BlockLabel)
165165
}
@@ -169,7 +169,7 @@ func TestIsDependencyPresent(t *testing.T) {
169169
"flow1": {"dep1", "dep2", "dep3"},
170170
"flow2": {"dep4", "dep5"},
171171
}
172-
172+
173173
assert.True(t, isDependencyPresent(architectDependencies, "flow1", "dep2"))
174174
assert.False(t, isDependencyPresent(architectDependencies, "flow2", "dep2"))
175175
assert.False(t, isDependencyPresent(architectDependencies, "flow1", "dep6"))
@@ -181,51 +181,51 @@ func TestSearchForKeyValue(t *testing.T) {
181181
"key1": {"value1", "value2", "value3"},
182182
"key2": {"value4", "value5"},
183183
}
184-
184+
185185
assert.True(t, searchForKeyValue(m, "key1", "value2"))
186186
assert.False(t, searchForKeyValue(m, "key1", "value4"))
187187
assert.False(t, searchForKeyValue(m, "key3", "value1"))
188188
}
189189

190190
func TestStringInSlice(t *testing.T) {
191191
slice := []string{"apple", "banana", "cherry"}
192-
192+
193193
assert.True(t, stringInSlice("banana", slice))
194194
assert.False(t, stringInSlice("grape", slice))
195195
assert.False(t, stringInSlice("", slice))
196196
}
197197

198198
func TestGetDependentConsumerProxy_Singleton(t *testing.T) {
199199
config := &platformclientv2.Configuration{}
200-
200+
201201
proxy1 := GetDependentConsumerProxy(config)
202202
proxy2 := GetDependentConsumerProxy(config)
203-
203+
204204
// Should return same instance
205205
assert.Equal(t, proxy1, proxy2)
206206
}
207207

208208
func TestNewDependentConsumerProxy_ThreadSafe(t *testing.T) {
209209
// Reset singleton for test
210210
InternalProxy = nil
211-
211+
212212
config := &platformclientv2.Configuration{}
213213
done := make(chan *DependentConsumerProxy, 10)
214-
214+
215215
// Run concurrent initializations
216216
for i := 0; i < 10; i++ {
217217
go func() {
218218
proxy := newDependentConsumerProxy(config)
219219
done <- proxy
220220
}()
221221
}
222-
222+
223223
// Collect all proxies
224224
proxies := make([]*DependentConsumerProxy, 10)
225225
for i := 0; i < 10; i++ {
226226
proxies[i] = <-done
227227
}
228-
228+
229229
// All should be the same instance
230230
for i := 1; i < 10; i++ {
231231
assert.Equal(t, proxies[0], proxies[i])
@@ -235,9 +235,9 @@ func TestNewDependentConsumerProxy_ThreadSafe(t *testing.T) {
235235
func TestGetDependentConsumerProxy_NilConfig(t *testing.T) {
236236
// Reset singleton
237237
InternalProxy = nil
238-
238+
239239
proxy := GetDependentConsumerProxy(nil)
240-
240+
241241
assert.NotNil(t, proxy)
242242
assert.NotNil(t, proxy.GetPooledClientAttr)
243243
}

genesyscloud/tfexporter/genesyscloud_resource_exporter_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,12 @@ func TestUnitTfExportBuildDependsOnResources(t *testing.T) {
376376

377377
dependentconsumers.InternalProxy = dependencyProxy
378378
defer func() { dependentconsumers.InternalProxy = nil }()
379-
379+
380380
ctx := context.Background()
381381

382382
gre := &GenesysCloudResourceExporter{
383-
ctx: ctx,
384-
dependsList: make(map[string][]string),
383+
ctx: ctx,
384+
dependsList: make(map[string][]string),
385385
flowResourcesList: []string{},
386386
}
387387

0 commit comments

Comments
 (0)