Skip to content

Commit 1a3f2b2

Browse files
authored
fix(cloudflare): Account Filtering (#6154)
#### Summary <!-- Explain what problem this PR addresses --> <!--
1 parent dd773b8 commit 1a3f2b2

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

plugins/source/cloudflare/client/client.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/cloudquery/plugin-sdk/schema"
1111
"github.com/cloudquery/plugin-sdk/specs"
1212
"github.com/rs/zerolog"
13+
"github.com/thoas/go-funk"
1314
)
1415

1516
type AccountZones map[string]struct {
@@ -90,6 +91,10 @@ func Configure(ctx context.Context, logger zerolog.Logger, s specs.Source) (sche
9091
}
9192

9293
for _, account := range accounts {
94+
if len(cfSpec.Accounts) > 0 && !funk.ContainsString(cfSpec.Accounts, account.ID) {
95+
continue
96+
}
97+
9398
// Get available zones for each account
9499
zones, err := clientApi.ListZonesContext(ctx, cloudflare.WithZoneFilters("", account.ID, ""))
95100
if err != nil {

plugins/source/cloudflare/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ require (
99
github.com/golang/mock v1.6.0
1010
github.com/rs/zerolog v1.28.0
1111
github.com/stretchr/testify v1.8.1
12+
github.com/thoas/go-funk v0.9.2
1213
)
1314

1415
require (
@@ -29,7 +30,6 @@ require (
2930
github.com/spf13/cast v1.5.0 // indirect
3031
github.com/spf13/cobra v1.6.1 // indirect
3132
github.com/spf13/pflag v1.0.5 // indirect
32-
github.com/thoas/go-funk v0.9.3-0.20221027085339-5573bc209e28 // indirect
3333
golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9 // indirect
3434
golang.org/x/mod v0.6.0 // indirect
3535
golang.org/x/net v0.2.0 // indirect

plugins/source/cloudflare/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
198198
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
199199
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
200200
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
201-
github.com/thoas/go-funk v0.9.3-0.20221027085339-5573bc209e28 h1:xQnb8OgtW7FLvEtONmA0M13f04+fhhoBiYjWyCkqfDg=
202-
github.com/thoas/go-funk v0.9.3-0.20221027085339-5573bc209e28/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q=
201+
github.com/thoas/go-funk v0.9.2 h1:oKlNYv0AY5nyf9g+/GhMgS/UO2ces0QRdPKwkhY3VCk=
202+
github.com/thoas/go-funk v0.9.2/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q=
203203
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
204204
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
205205
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=

0 commit comments

Comments
 (0)