You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add wildcard pattern matching to filter docs and templates
Update filter documentation, getting-started guide, extract command
reference, and the filter config template to document wildcard
pattern support (* and ? characters). Fix getting-started.md using
the old apiNames key instead of apis.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/commands/extract.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,17 +95,19 @@ For local development, `az login` is the simplest option. For CI/CD pipelines, u
95
95
96
96
By default, `apiops extract` exports **all** resources from the APIM instance (34 resource types including APIs, products, backends, named values, tags, policies, and more).
97
97
98
-
To extract only specific resources, pass a YAML filter file with `--filter`:
98
+
To extract only specific resources, pass a YAML filter file with `--filter`. Filter entries support exact names and wildcard patterns (`*` for any characters, `?` for a single character):
99
99
100
100
```yaml
101
101
# configuration.extractor.yaml
102
102
apis:
103
103
- echo-api
104
104
- petstore-api
105
+
- prod-* # Wildcard: all APIs starting with prod-
105
106
products:
106
107
- starter
107
108
backends:
108
109
- backend-api
110
+
- '*-internal'# Wildcard: all backends ending with -internal
Copy file name to clipboardExpand all lines: docs/guides/filtering-resources.md
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,11 +72,47 @@ namedValues:
72
72
- Simple fields must be an array of strings
73
73
-`apis` and `workspaces` also accept nested object entries for sub-resource filtering (see below)
74
74
- Names are matched case-insensitively against APIM resource names
75
+
- Wildcard patterns are supported — `*` matches any characters, `?` matches a single character (see below)
76
+
- Exact names and wildcard patterns can be mixed in the same array
75
77
- An empty file extracts everything (same as no filter)
76
78
- An empty array (`[]`) excludes ALL resources of that type
77
79
78
80
---
79
81
82
+
## Wildcard Pattern Matching
83
+
84
+
Filter entries support glob-style wildcard patterns for matching multiple resources by naming convention:
85
+
86
+
| Wildcard | Meaning | Example |
87
+
|----------|---------|---------|
88
+
|`*`| Matches zero or more characters |`prod-*` matches `prod-api`, `prod-users`|
89
+
|`?`| Matches exactly one character |`api-v?` matches `api-v1`, `api-v2` but not `api-v10`|
90
+
91
+
### Examples
92
+
93
+
```yaml
94
+
apis:
95
+
- '*-test'# All APIs ending with -test
96
+
- 'prod-*'# All APIs starting with prod-
97
+
- '*-internal-*'# All APIs containing -internal-
98
+
- 'v2-*-api'# APIs following v2-{name}-api pattern
99
+
- 'echo-api'# Exact names and patterns can be mixed
100
+
101
+
products:
102
+
- 'test-*'# All test products
103
+
- '*-starter'# All starter tier products
104
+
105
+
backends:
106
+
- 'backend-*-prod'# All production backends
107
+
108
+
namedValues:
109
+
- '*-connection-string'# All connection string named values
110
+
```
111
+
112
+
Wildcard matching is case-insensitive, just like exact matching. Special characters in resource names (e.g., dots in `my.api.v1`) are treated literally — `my.api.*` matches `my.api.test` but not `myXapiXtest`.
113
+
114
+
---
115
+
80
116
## Nested Sub-Resource Filtering
81
117
82
118
### API sub-resource filters
@@ -268,6 +304,20 @@ backends:
268
304
269
305
There is no "exclude" syntax. To extract everything except certain resources, list all the resources you _do_ want. For large instances, it's often easier to extract everything and use `.gitignore` or separate branches to manage visibility.
270
306
307
+
### Pattern-Based Team Filtering
308
+
309
+
Using wildcard patterns to extract resources by naming convention:
310
+
311
+
```yaml
312
+
# configuration.extractor.yaml
313
+
apis:
314
+
- 'team-payments-*' # All APIs owned by the payments team
315
+
namedValues:
316
+
- 'payments-*' # All named values for payments
317
+
backends:
318
+
- '*-payments-*' # All backends related to payments
319
+
```
320
+
271
321
---
272
322
273
323
## Tips
@@ -276,6 +326,7 @@ There is no "exclude" syntax. To extract everything except certain resources, li
276
326
- **One filter per team** — In multi-team setups, each team maintains its own `configuration.extractor.yaml`
277
327
- **Commit the filter file** — Keep it in version control alongside your artifacts so CI/CD pipelines can use it
278
328
- **Case-insensitive matching** — Filter values are matched case-insensitively against APIM resource names
329
+
- **Use wildcard patterns** — `*` and `?` patterns let you match resources by naming convention instead of listing each name individually
279
330
- **Validate early** — The config loader validates filter entries and will throw `Failed to load filter config` on invalid YAML. Unknown top-level keys produce a warning.
0 commit comments