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
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
+52-3Lines changed: 52 additions & 3 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
@@ -104,8 +140,6 @@ apis:
104
140
105
141
### Workspace sub-resource filters
106
142
107
-
> **Note:** Workspace sub-resource filtering is parsed but not yet applied at runtime. Currently, including a workspace extracts all resources within it. This matches the Toolkit's configuration format for forward compatibility. See [#119](https://github.com/Azure/apiops-cli/issues/119) for tracking.
108
-
109
143
The configuration format supports specifying which workspace-scoped resources to extract:
110
144
111
145
```yaml
@@ -121,7 +155,7 @@ workspaces:
121
155
- team-b-workspace # Simple: extract all resources
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
304
305
+
### Pattern-Based Team Filtering
306
+
307
+
Using wildcard patterns to extract resources by naming convention:
308
+
309
+
```yaml
310
+
# configuration.extractor.yaml
311
+
apis:
312
+
- 'team-payments-*' # All APIs owned by the payments team
313
+
namedValues:
314
+
- 'payments-*' # All named values for payments
315
+
backends:
316
+
- '*-payments-*' # All backends related to payments
317
+
```
318
+
271
319
---
272
320
273
321
## Tips
@@ -276,6 +324,7 @@ There is no "exclude" syntax. To extract everything except certain resources, li
276
324
- **One filter per team** — In multi-team setups, each team maintains its own `configuration.extractor.yaml`
277
325
- **Commit the filter file** — Keep it in version control alongside your artifacts so CI/CD pipelines can use it
278
326
- **Case-insensitive matching** — Filter values are matched case-insensitively against APIM resource names
327
+
- **Use wildcard patterns** — `*` and `?` patterns let you match resources by naming convention instead of listing each name individually
279
328
- **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