|
33 | 33 | import com.azure.data.appconfiguration.models.ConfigurationSnapshot;
|
34 | 34 | import com.azure.data.appconfiguration.models.ConfigurationSnapshotStatus;
|
35 | 35 | import com.azure.data.appconfiguration.models.FeatureFlagConfigurationSetting;
|
| 36 | +import com.azure.data.appconfiguration.models.SettingLabelSelector; |
36 | 37 | import com.azure.data.appconfiguration.models.SecretReferenceConfigurationSetting;
|
37 | 38 | import com.azure.data.appconfiguration.models.SettingFields;
|
| 39 | +import com.azure.data.appconfiguration.models.SettingLabel; |
| 40 | +import com.azure.data.appconfiguration.models.SettingLabelFields; |
38 | 41 | import com.azure.data.appconfiguration.models.SettingSelector;
|
39 | 42 | import com.azure.data.appconfiguration.models.SnapshotFields;
|
40 | 43 | import com.azure.data.appconfiguration.models.SnapshotSelector;
|
@@ -1056,27 +1059,31 @@ public PagedIterable<ConfigurationSetting> listConfigurationSettings(SettingSele
|
1056 | 1059 | final String acceptDateTime = selector == null ? null : selector.getAcceptDateTime();
|
1057 | 1060 | final List<SettingFields> settingFields = selector == null ? null : toSettingFieldsList(selector.getFields());
|
1058 | 1061 | final List<MatchConditions> matchConditionsList = selector == null ? null : selector.getMatchConditions();
|
| 1062 | + final List<String> tagsFilter = selector == null ? null : selector.getTagsFilter(); |
| 1063 | + |
1059 | 1064 | 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); |
1077 | 1086 | }
|
1078 |
| - return toConfigurationSettingWithPagedResponse(pagedResponse); |
1079 |
| - } |
1080 | 1087 | );
|
1081 | 1088 | }
|
1082 | 1089 |
|
@@ -1138,7 +1145,7 @@ public PagedIterable<ConfigurationSetting> listConfigurationSettingsForSnapshot(
|
1138 | 1145 | List<SettingFields> fields, Context context) {
|
1139 | 1146 | return new PagedIterable<>(() -> {
|
1140 | 1147 | final PagedResponse<KeyValue> pagedResponse = serviceClient.getKeyValuesSinglePage(null, null, null, null,
|
1141 |
| - fields, snapshotName, null, null, context); |
| 1148 | + fields, snapshotName, null, null, null, context); |
1142 | 1149 | return toConfigurationSettingWithPagedResponse(pagedResponse);
|
1143 | 1150 | }, nextLink -> {
|
1144 | 1151 | final PagedResponse<KeyValue> pagedResponse = serviceClient.getKeyValuesNextSinglePage(nextLink, null, null,
|
@@ -1216,7 +1223,8 @@ public PagedIterable<ConfigurationSetting> listRevisions(SettingSelector selecto
|
1216 | 1223 | return new PagedIterable<>(() -> {
|
1217 | 1224 | final PagedResponse<KeyValue> pagedResponse = serviceClient.getRevisionsSinglePage(
|
1218 | 1225 | 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); |
1220 | 1228 | return toConfigurationSettingWithPagedResponse(pagedResponse);
|
1221 | 1229 | }, nextLink -> {
|
1222 | 1230 | final PagedResponse<KeyValue> pagedResponse = serviceClient.getRevisionsNextSinglePage(nextLink,
|
@@ -1494,6 +1502,89 @@ public PagedIterable<ConfigurationSnapshot> listSnapshots(SnapshotSelector selec
|
1494 | 1502 | nextLink -> serviceClient.getSnapshotsNextSinglePage(nextLink, context));
|
1495 | 1503 | }
|
1496 | 1504 |
|
| 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() |
| 1513 | + * .forEach(label -> { |
| 1514 | + * System.out.println("label name = " + label.getName()); |
| 1515 | + * }); |
| 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 = "{labelNamePrefix}*"; |
| 1537 | + * client.listLabels(new SettingLabelSelector().setNameFilter(labelNameFilter)) |
| 1538 | + * .forEach(label -> { |
| 1539 | + * System.out.println("label name = " + label.getName()); |
| 1540 | + * }); |
| 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 = "{labelNamePrefix}*"; |
| 1563 | + * Context ctx = new Context(key2, value2); |
| 1564 | + * |
| 1565 | + * client.listLabels(new SettingLabelSelector().setNameFilter(labelNameFilter), ctx) |
| 1566 | + * .forEach(label -> { |
| 1567 | + * System.out.println("label name = " + label.getName()); |
| 1568 | + * }); |
| 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 | + |
1497 | 1588 | /**
|
1498 | 1589 | * Adds an external synchronization token to ensure service requests receive up-to-date values.
|
1499 | 1590 | *
|
|
0 commit comments