Skip to content

Commit 514c4cc

Browse files
authored
Add samples for AppConfig Pageable GetLabels with comparisons of what we'd expect the user experience to be. (#6338)
1 parent a6beedc commit 514c4cc

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

sdk/appconfiguration/azure-data-appconfiguration/samples/appconfig_basic_operation.cpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,66 @@
1414
using namespace Azure::Data::AppConfiguration;
1515
using namespace Azure::Identity;
1616

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+
1777
int main()
1878
{
1979
try
@@ -120,6 +180,9 @@ int main()
120180
}
121181
#endif
122182

183+
// Retreive labels based on filters
184+
RetreiveLabels(configurationClient);
185+
123186
// Delete a configuration setting
124187

125188
// Current

0 commit comments

Comments
 (0)