Skip to content

Commit eed41c1

Browse files
authored
[AppConfig] Merged feature branch to main repo (#41250)
1 parent 9286b6a commit eed41c1

File tree

80 files changed

+4006
-3708
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+4006
-3708
lines changed

sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Release History
22

3+
## 1.7.0-beta.1 (Unreleased)
4+
5+
### Features Added
6+
7+
- Added a new service API support: `2023-11-01`.
8+
- Added a new method `listLabels` to support listing labels capabilities.
9+
- Added new class `SettingLabel` and `SettingLabelSelector`, and a new enum `SettingLabelFields`.
10+
- Added a new property `tagsFilter` to `SettingSelector` to support filtering settings or revisions with tags filter.
11+
- Added a new property `tags` to `ConfigurationSettingsFilter` to support filtering settings with tags filter for snapshot.
12+
13+
### Breaking Changes
14+
15+
### Bugs Fixed
16+
17+
### Other Changes
18+
19+
320
## 1.6.3 (2024-07-26)
421

522
### Bugs Fixed

sdk/appconfiguration/azure-data-appconfiguration/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ For "Feature Flag" and "Secret Reference" configuration settings, see [samples][
241241
* [Recover a snapshot](#recover-a-snapshot)
242242
* [Retrieve all Snapshots](#retrieve-all-snapshots)
243243
* [Retrieve Configuration Settings in a Snapshot](#retrieve-configuration-settings-in-a-snapshot)
244+
* [Retrieve Labels](#retrieve-labels)
244245

245246
### Create a Configuration Client
246247

@@ -400,6 +401,7 @@ configurationClient.setConfigurationSetting(key2, "new_label", "new_value");
400401
SettingSelector selector = new SettingSelector().setKeyFilter(key + "," + key2);
401402
PagedIterable<ConfigurationSetting> settings = configurationClient.listConfigurationSettings(selector);
402403
```
404+
For more filters see class `SettingSelector`, such as `tagsFilter` see [samples][samples].
403405

404406
### List revisions of multiple Configuration Settings
405407

@@ -535,6 +537,18 @@ for (ConfigurationSetting setting : configurationSettings) {
535537
}
536538
```
537539

540+
### Retrieve Labels
541+
List multiple labels in the App Configuration store by calling `listLabels`.
542+
543+
```java readme-sample-listLabels
544+
String labelNameFilter = "{labelNamePrefix}*";
545+
configurationClient.listLabels(new SettingLabelSelector().setNameFilter(labelNameFilter))
546+
.forEach(label -> {
547+
System.out.println("label name = " + label.getName());
548+
});
549+
```
550+
551+
538552
## Troubleshooting
539553

540554
### General

sdk/appconfiguration/azure-data-appconfiguration/assets.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "java",
44
"TagPrefix": "java/appconfiguration/azure-data-appconfiguration",
5-
"Tag": "java/appconfiguration/azure-data-appconfiguration_1d33b52d2b"
5+
"Tag": "java/appconfiguration/azure-data-appconfiguration_5e00bac278"
66
}

sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java

+62-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@
3131
import com.azure.data.appconfiguration.models.ConfigurationSnapshot;
3232
import com.azure.data.appconfiguration.models.ConfigurationSnapshotStatus;
3333
import com.azure.data.appconfiguration.models.FeatureFlagConfigurationSetting;
34+
import com.azure.data.appconfiguration.models.SettingLabelSelector;
3435
import com.azure.data.appconfiguration.models.SecretReferenceConfigurationSetting;
3536
import com.azure.data.appconfiguration.models.SettingFields;
37+
import com.azure.data.appconfiguration.models.SettingLabel;
38+
import com.azure.data.appconfiguration.models.SettingLabelFields;
3639
import com.azure.data.appconfiguration.models.SettingSelector;
3740
import com.azure.data.appconfiguration.models.SnapshotFields;
3841
import com.azure.data.appconfiguration.models.SnapshotSelector;
@@ -1031,10 +1034,11 @@ public PagedFlux<ConfigurationSetting> listConfigurationSettings(SettingSelector
10311034
final String acceptDateTime = selector == null ? null : selector.getAcceptDateTime();
10321035
final List<SettingFields> settingFields = selector == null ? null : toSettingFieldsList(selector.getFields());
10331036
final List<MatchConditions> matchConditionsList = selector == null ? null : selector.getMatchConditions();
1037+
final List<String> tagsFilter = selector == null ? null : selector.getTagsFilter();
10341038
AtomicInteger pageETagIndex = new AtomicInteger(0);
10351039
return new PagedFlux<>(() -> withContext(context -> serviceClient.getKeyValuesSinglePageAsync(keyFilter,
10361040
labelFilter, null, acceptDateTime, settingFields, null, null,
1037-
getPageETag(matchConditionsList, pageETagIndex), context)
1041+
getPageETag(matchConditionsList, pageETagIndex), tagsFilter, context)
10381042
.onErrorResume(HttpResponseException.class,
10391043
(Function<HttpResponseException, Mono<PagedResponse<KeyValue>>>)
10401044
Utility::handleNotModifiedErrorToValidResponse)
@@ -1104,7 +1108,7 @@ public PagedFlux<ConfigurationSetting> listConfigurationSettingsForSnapshot(Stri
11041108
public PagedFlux<ConfigurationSetting> listConfigurationSettingsForSnapshot(String snapshotName,
11051109
List<SettingFields> fields) {
11061110
return new PagedFlux<>(() -> withContext(context -> serviceClient.getKeyValuesSinglePageAsync(null, null, null,
1107-
null, fields, snapshotName, null, null, context)
1111+
null, fields, snapshotName, null, null, null, context)
11081112
.map(ConfigurationSettingDeserializationHelper::toConfigurationSettingWithPagedResponse)),
11091113
nextLink -> withContext(context -> serviceClient.getKeyValuesNextSinglePageAsync(nextLink, null, null, null,
11101114
context)
@@ -1143,8 +1147,9 @@ public PagedFlux<ConfigurationSetting> listRevisions(SettingSelector selector) {
11431147
final String labelFilter = selector == null ? null : selector.getLabelFilter();
11441148
final String acceptDateTime = selector == null ? null : selector.getAcceptDateTime();
11451149
final List<SettingFields> settingFields = selector == null ? null : toSettingFieldsList(selector.getFields());
1150+
List<String> tags = selector == null ? null : selector.getTagsFilter();
11461151
return new PagedFlux<>(() -> withContext(context -> serviceClient.getRevisionsSinglePageAsync(keyFilter,
1147-
labelFilter, null, acceptDateTime, settingFields, context)
1152+
labelFilter, null, acceptDateTime, settingFields, tags, context)
11481153
.map(ConfigurationSettingDeserializationHelper::toConfigurationSettingWithPagedResponse)),
11491154
nextLink -> withContext(context -> serviceClient.getRevisionsNextSinglePageAsync(nextLink, acceptDateTime,
11501155
context)
@@ -1403,6 +1408,60 @@ public PagedFlux<ConfigurationSnapshot> listSnapshots(SnapshotSelector selector)
14031408
}
14041409
}
14051410

1411+
/**
1412+
* Gets all labels.
1413+
*
1414+
* <p><strong>Code Samples</strong></p>
1415+
*
1416+
* <!-- src_embed com.azure.data.appconfiguration.configurationasyncclient.listAllLabels -->
1417+
* <pre>
1418+
* client.listLabels&#40;&#41;
1419+
* .subscribe&#40;label -&gt; &#123;
1420+
* System.out.println&#40;&quot;label name = &quot; + label&#41;;
1421+
* &#125;&#41;;
1422+
* </pre>
1423+
* <!-- end com.azure.data.appconfiguration.configurationasyncclient.listAllLabels -->
1424+
*
1425+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1426+
* @throws HttpResponseException thrown if the request is rejected by server.
1427+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
1428+
* @return a list of labels as paginated response with {@link PagedFlux}.
1429+
*/
1430+
@ServiceMethod(returns = ReturnType.COLLECTION)
1431+
public PagedFlux<SettingLabel> listLabels() {
1432+
return listLabels(null);
1433+
}
1434+
1435+
/**
1436+
* Gets a list of labels by given {@link SettingLabelSelector}
1437+
*
1438+
* <p><strong>Code Samples</strong></p>
1439+
*
1440+
* <!-- src_embed com.azure.data.appconfiguration.configurationasyncclient.listLabels -->
1441+
* <pre>
1442+
* String labelNameFilter = &quot;&#123;labelNamePrefix&#125;*&quot;;
1443+
* client.listLabels&#40;new SettingLabelSelector&#40;&#41;.setNameFilter&#40;labelNameFilter&#41;&#41;
1444+
* .subscribe&#40;label -&gt; &#123;
1445+
* System.out.println&#40;&quot;label name = &quot; + label&#41;;
1446+
* &#125;&#41;;
1447+
* </pre>
1448+
* <!-- end com.azure.data.appconfiguration.configurationasyncclient.listLabels -->
1449+
*
1450+
* @param selector Optional. Selector to filter labels from the service.
1451+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1452+
* @throws HttpResponseException thrown if the request is rejected by server.
1453+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
1454+
* @return a list of labels as paginated response with {@link PagedFlux}.
1455+
*/
1456+
@ServiceMethod(returns = ReturnType.COLLECTION)
1457+
public PagedFlux<SettingLabel> listLabels(SettingLabelSelector selector) {
1458+
final String labelNameFilter = selector == null ? null : selector.getNameFilter();
1459+
final String acceptDatetime = selector == null ? null
1460+
: selector.getAcceptDateTime() == null ? null : selector.getAcceptDateTime().toString();
1461+
final List<SettingLabelFields> labelFields = selector == null ? null : selector.getFields();
1462+
return serviceClient.getLabelsAsync(labelNameFilter, null, acceptDatetime, labelFields);
1463+
}
1464+
14061465
/**
14071466
* Adds an external synchronization token to ensure service requests receive up-to-date values.
14081467
*

sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java

+112-21
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@
3333
import com.azure.data.appconfiguration.models.ConfigurationSnapshot;
3434
import com.azure.data.appconfiguration.models.ConfigurationSnapshotStatus;
3535
import com.azure.data.appconfiguration.models.FeatureFlagConfigurationSetting;
36+
import com.azure.data.appconfiguration.models.SettingLabelSelector;
3637
import com.azure.data.appconfiguration.models.SecretReferenceConfigurationSetting;
3738
import com.azure.data.appconfiguration.models.SettingFields;
39+
import com.azure.data.appconfiguration.models.SettingLabel;
40+
import com.azure.data.appconfiguration.models.SettingLabelFields;
3841
import com.azure.data.appconfiguration.models.SettingSelector;
3942
import com.azure.data.appconfiguration.models.SnapshotFields;
4043
import com.azure.data.appconfiguration.models.SnapshotSelector;
@@ -1056,27 +1059,31 @@ public PagedIterable<ConfigurationSetting> listConfigurationSettings(SettingSele
10561059
final String acceptDateTime = selector == null ? null : selector.getAcceptDateTime();
10571060
final List<SettingFields> settingFields = selector == null ? null : toSettingFieldsList(selector.getFields());
10581061
final List<MatchConditions> matchConditionsList = selector == null ? null : selector.getMatchConditions();
1062+
final List<String> tagsFilter = selector == null ? null : selector.getTagsFilter();
1063+
10591064
AtomicInteger pageETagIndex = new AtomicInteger(0);
1060-
return new PagedIterable<>(() -> {
1061-
PagedResponse<KeyValue> pagedResponse;
1062-
try {
1063-
pagedResponse = serviceClient.getKeyValuesSinglePage(keyFilter, labelFilter, null, acceptDateTime,
1064-
settingFields, null, null, getPageETag(matchConditionsList, pageETagIndex), context);
1065-
} catch (HttpResponseException ex) {
1066-
return handleNotModifiedErrorToValidResponse(ex, LOGGER);
1067-
}
1068-
return toConfigurationSettingWithPagedResponse(pagedResponse);
1069-
},
1070-
nextLink -> {
1071-
PagedResponse<KeyValue> pagedResponse;
1072-
try {
1073-
pagedResponse = serviceClient.getKeyValuesNextSinglePage(nextLink, acceptDateTime, null,
1074-
getPageETag(matchConditionsList, pageETagIndex), context);
1075-
} catch (HttpResponseException ex) {
1076-
return handleNotModifiedErrorToValidResponse(ex, LOGGER);
1065+
return new PagedIterable<>(
1066+
() -> {
1067+
PagedResponse<KeyValue> pagedResponse;
1068+
try {
1069+
pagedResponse = serviceClient.getKeyValuesSinglePage(keyFilter, labelFilter, null, acceptDateTime,
1070+
settingFields, null, null, getPageETag(matchConditionsList, pageETagIndex),
1071+
tagsFilter, context);
1072+
} catch (HttpResponseException ex) {
1073+
return handleNotModifiedErrorToValidResponse(ex, LOGGER);
1074+
}
1075+
return toConfigurationSettingWithPagedResponse(pagedResponse);
1076+
},
1077+
nextLink -> {
1078+
PagedResponse<KeyValue> pagedResponse;
1079+
try {
1080+
pagedResponse = serviceClient.getKeyValuesNextSinglePage(nextLink, acceptDateTime, null,
1081+
getPageETag(matchConditionsList, pageETagIndex), context);
1082+
} catch (HttpResponseException ex) {
1083+
return handleNotModifiedErrorToValidResponse(ex, LOGGER);
1084+
}
1085+
return toConfigurationSettingWithPagedResponse(pagedResponse);
10771086
}
1078-
return toConfigurationSettingWithPagedResponse(pagedResponse);
1079-
}
10801087
);
10811088
}
10821089

@@ -1138,7 +1145,7 @@ public PagedIterable<ConfigurationSetting> listConfigurationSettingsForSnapshot(
11381145
List<SettingFields> fields, Context context) {
11391146
return new PagedIterable<>(() -> {
11401147
final PagedResponse<KeyValue> pagedResponse = serviceClient.getKeyValuesSinglePage(null, null, null, null,
1141-
fields, snapshotName, null, null, context);
1148+
fields, snapshotName, null, null, null, context);
11421149
return toConfigurationSettingWithPagedResponse(pagedResponse);
11431150
}, nextLink -> {
11441151
final PagedResponse<KeyValue> pagedResponse = serviceClient.getKeyValuesNextSinglePage(nextLink, null, null,
@@ -1216,7 +1223,8 @@ public PagedIterable<ConfigurationSetting> listRevisions(SettingSelector selecto
12161223
return new PagedIterable<>(() -> {
12171224
final PagedResponse<KeyValue> pagedResponse = serviceClient.getRevisionsSinglePage(
12181225
selector == null ? null : selector.getKeyFilter(), selector == null ? null : selector.getLabelFilter(),
1219-
null, acceptDateTime, selector == null ? null : toSettingFieldsList(selector.getFields()), context);
1226+
null, acceptDateTime, selector == null ? null : toSettingFieldsList(selector.getFields()),
1227+
selector == null ? null : selector.getTagsFilter(), context);
12201228
return toConfigurationSettingWithPagedResponse(pagedResponse);
12211229
}, nextLink -> {
12221230
final PagedResponse<KeyValue> pagedResponse = serviceClient.getRevisionsNextSinglePage(nextLink,
@@ -1494,6 +1502,89 @@ public PagedIterable<ConfigurationSnapshot> listSnapshots(SnapshotSelector selec
14941502
nextLink -> serviceClient.getSnapshotsNextSinglePage(nextLink, context));
14951503
}
14961504

1505+
/**
1506+
* Gets all labels
1507+
*
1508+
* <p><strong>Code Samples</strong></p>
1509+
*
1510+
* <!-- src_embed com.azure.data.appconfiguration.configurationclient.listAllLabels -->
1511+
* <pre>
1512+
* client.listLabels&#40;&#41;
1513+
* .forEach&#40;label -&gt; &#123;
1514+
* System.out.println&#40;&quot;label name = &quot; + label.getName&#40;&#41;&#41;;
1515+
* &#125;&#41;;
1516+
* </pre>
1517+
* <!-- end com.azure.data.appconfiguration.configurationclient.listAllLabels -->
1518+
*
1519+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1520+
* @throws HttpResponseException thrown if the request is rejected by server.
1521+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
1522+
* @return a list of labels as paginated response with {@link PagedIterable}.
1523+
*/
1524+
@ServiceMethod(returns = ReturnType.COLLECTION)
1525+
public PagedIterable<SettingLabel> listLabels() {
1526+
return listLabels(null);
1527+
}
1528+
1529+
/**
1530+
* Gets a list of labels by given {@link SettingLabelSelector}.
1531+
*
1532+
* <p><strong>Code Samples</strong></p>
1533+
*
1534+
* <!-- src_embed com.azure.data.appconfiguration.configurationclient.listLabels -->
1535+
* <pre>
1536+
* String labelNameFilter = &quot;&#123;labelNamePrefix&#125;*&quot;;
1537+
* client.listLabels&#40;new SettingLabelSelector&#40;&#41;.setNameFilter&#40;labelNameFilter&#41;&#41;
1538+
* .forEach&#40;label -&gt; &#123;
1539+
* System.out.println&#40;&quot;label name = &quot; + label.getName&#40;&#41;&#41;;
1540+
* &#125;&#41;;
1541+
* </pre>
1542+
* <!-- end com.azure.data.appconfiguration.configurationclient.listLabels -->
1543+
*
1544+
* @param selector Optional. Selector to filter labels from the service.
1545+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1546+
* @throws HttpResponseException thrown if the request is rejected by server.
1547+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
1548+
* @return a list of labels as paginated response with {@link PagedIterable}.
1549+
*/
1550+
@ServiceMethod(returns = ReturnType.COLLECTION)
1551+
public PagedIterable<SettingLabel> listLabels(SettingLabelSelector selector) {
1552+
return listLabels(selector, Context.NONE);
1553+
}
1554+
1555+
/**
1556+
* Gets a list of labels by given {@link SettingLabelSelector}.
1557+
*
1558+
* <p><strong>Code Samples</strong></p>
1559+
*
1560+
* <!-- src_embed com.azure.data.appconfiguration.configurationclient.listLabelsMaxOverload -->
1561+
* <pre>
1562+
* String labelNameFilter = &quot;&#123;labelNamePrefix&#125;*&quot;;
1563+
* Context ctx = new Context&#40;key2, value2&#41;;
1564+
*
1565+
* client.listLabels&#40;new SettingLabelSelector&#40;&#41;.setNameFilter&#40;labelNameFilter&#41;, ctx&#41;
1566+
* .forEach&#40;label -&gt; &#123;
1567+
* System.out.println&#40;&quot;label name = &quot; + label.getName&#40;&#41;&#41;;
1568+
* &#125;&#41;;
1569+
* </pre>
1570+
* <!-- end com.azure.data.appconfiguration.configurationclient.listLabelsMaxOverload -->
1571+
*
1572+
* @param selector Optional. Selector to filter labels from the service.
1573+
* @param context The context to associate with this operation.
1574+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1575+
* @throws HttpResponseException thrown if the request is rejected by server.
1576+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
1577+
* @return a list of labels as paginated response with {@link PagedIterable}.
1578+
*/
1579+
@ServiceMethod(returns = ReturnType.COLLECTION)
1580+
public PagedIterable<SettingLabel> listLabels(SettingLabelSelector selector, Context context) {
1581+
final String labelNameFilter = selector == null ? null : selector.getNameFilter();
1582+
final String acceptDatetime = selector == null
1583+
? null : selector.getAcceptDateTime() == null ? null : selector.getAcceptDateTime().toString();
1584+
final List<SettingLabelFields> labelFields = selector == null ? null : selector.getFields();
1585+
return serviceClient.getLabels(labelNameFilter, null, acceptDatetime, labelFields, context);
1586+
}
1587+
14971588
/**
14981589
* Adds an external synchronization token to ensure service requests receive up-to-date values.
14991590
*

sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationServiceVersion.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ public enum ConfigurationServiceVersion implements ServiceVersion {
1717
/**
1818
* Service version {@code 2023-10-01}.
1919
*/
20-
V2023_10_01("2023-10-01");
20+
V2023_10_01("2023-10-01"),
21+
22+
/**
23+
* Service version {@code 2023-11-01}.
24+
*/
25+
V2023_11_01("2023-11-01");
2126

2227
private final String version;
2328

@@ -39,6 +44,6 @@ public String getVersion() {
3944
* @return the latest {@link ConfigurationServiceVersion}
4045
*/
4146
public static ConfigurationServiceVersion getLatest() {
42-
return V2023_10_01;
47+
return V2023_11_01;
4348
}
4449
}

0 commit comments

Comments
 (0)