|
14 | 14 | using namespace Azure::Data::AppConfiguration;
|
15 | 15 | using namespace Azure::Identity;
|
16 | 16 |
|
| 17 | +// Retreive labels based on filters |
| 18 | +static void RetreiveLabels(ConfigurationClient& configurationClient) |
| 19 | +{ |
| 20 | + // Current |
| 21 | + |
| 22 | + { |
| 23 | + GetLabelsOptions options; |
| 24 | + // To get all labels, don't set Name or use the any wildcard ("*"). |
| 25 | + options.Name = "production*"; |
| 26 | + options.AcceptDatetime = "Fri, 10 Jan 2025 00:00:00 GMT"; |
| 27 | + |
| 28 | + for (GetLabelsPagedResponse labelsPage = configurationClient.GetLabels("accept", options); |
| 29 | + labelsPage.HasPage(); |
| 30 | + labelsPage.MoveToNextPage()) |
| 31 | + { |
| 32 | + if (labelsPage.Items.HasValue()) |
| 33 | + { |
| 34 | + std::vector<Label> list = labelsPage.Items.Value(); |
| 35 | + std::cout << "Label List Size: " << list.size() << std::endl; |
| 36 | + for (Label label : list) |
| 37 | + { |
| 38 | + if (label.Name.HasValue()) |
| 39 | + { |
| 40 | + std::cout << label.Name.Value() << std::endl; |
| 41 | + } |
| 42 | + } |
| 43 | + } |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | + // Expected |
| 48 | + |
| 49 | +#if 0 |
| 50 | + { |
| 51 | + GetLabelsOptions options; |
| 52 | + // To get all labels, don't set Name or use the any wildcard ("*"). |
| 53 | + options.Name = "production*"; |
| 54 | + options.AcceptDatetime = Azure::DateTime(2025, 01, 10, 0, 0, 0); |
| 55 | + |
| 56 | + for (GetLabelsPagedResponse labelsPage = configurationClient.GetLabels(options); |
| 57 | + labelsPage.HasPage(); |
| 58 | + labelsPage.MoveToNextPage()) |
| 59 | + { |
| 60 | + if (labelsPage.Items.HasValue()) |
| 61 | + { |
| 62 | + std::vector<Label> list = labelsPage.Items.Value(); |
| 63 | + std::cout << "Label List Size: " << list.size() << std::endl; |
| 64 | + for (Label label : list) |
| 65 | + { |
| 66 | + if (label.Name.HasValue()) |
| 67 | + { |
| 68 | + std::cout << label.Name.Value() << std::endl; |
| 69 | + } |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | + } |
| 74 | +#endif |
| 75 | +} |
| 76 | + |
17 | 77 | int main()
|
18 | 78 | {
|
19 | 79 | try
|
@@ -120,6 +180,9 @@ int main()
|
120 | 180 | }
|
121 | 181 | #endif
|
122 | 182 |
|
| 183 | + // Retreive labels based on filters |
| 184 | + RetreiveLabels(configurationClient); |
| 185 | + |
123 | 186 | // Delete a configuration setting
|
124 | 187 |
|
125 | 188 | // Current
|
|
0 commit comments