Skip to content

Commit 082b8e1

Browse files
authored
App Config: Update README to recent API changes (Azure#17787)
Co-authored-by: Anton Kolesnyk <[email protected]>
1 parent 3a06d6f commit 082b8e1

File tree

2 files changed

+30
-35
lines changed

2 files changed

+30
-35
lines changed

sdk/appconfig/azappconfig/README.md

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,11 @@ func ExampleAddConfigurationSetting() {
105105
// Create configuration setting
106106
resp, err := client.AddSetting(
107107
context.TODO(),
108-
azappconfig.Setting{
109-
Key: to.StringPtr("key"),
110-
Label: to.StringPtr("label"),
111-
Value: to.StringPtr("value")
112-
},
113-
nil)
108+
"key",
109+
to.Ptr("value"),
110+
&azappconfig.AddSettingOptions{
111+
Label: to.Ptr("label"),
112+
})
114113

115114
if err != nil {
116115
panic(err)
@@ -143,11 +142,10 @@ func ExampleGetConfigurationSetting() {
143142
// Get configuration setting
144143
resp, err := client.GetSetting(
145144
context.TODO(),
146-
azappconfig.Setting{
147-
Key: to.StringPtr("key"),
148-
Label: to.StringPtr("label")
149-
},
150-
nil)
145+
"key"
146+
&azappconfig.GetSettingOptions{
147+
Label: to.Ptr("label")
148+
})
151149

152150
if err != nil {
153151
panic(err)
@@ -180,12 +178,11 @@ func ExampleSetConfigurationSetting() {
180178
// Set configuration setting
181179
resp, err := client.SetSetting(
182180
context.TODO(),
183-
azappconfig.Setting{
184-
Key: to.StringPtr("key"),
185-
Label: to.StringPtr("label"),
186-
Value: to.StringPtr("new_value")
187-
},
188-
nil)
181+
"key",
182+
to.Ptr("new_value"),
183+
&azappconfig.SetSettingOptions{
184+
Label: to.Ptr("label"),
185+
})
189186

190187
if err != nil {
191188
panic(err)
@@ -218,12 +215,11 @@ func ExampleSetConfigurationSettingReadOnly() {
218215
// Set configuration setting read only
219216
resp, err := client.SetReadOnly(
220217
context.TODO(),
221-
azappconfig.Setting{
222-
Key: to.StringPtr("key"),
223-
Label: to.StringPtr("label")
224-
},
218+
"key",
225219
true,
226-
nil)
220+
&azappconfig.SetReadOnlyOptions{
221+
Label: to.Ptr("label")
222+
})
227223

228224
if err != nil {
229225
panic(err)
@@ -237,12 +233,11 @@ func ExampleSetConfigurationSettingReadOnly() {
237233
// Remove read only status
238234
resp, err := client.SetReadOnly(
239235
context.TODO(),
240-
azappconfig.Setting{
241-
Key: to.StringPtr("key"),
242-
Label: to.StringPtr("label")
243-
},
236+
"key",
244237
false,
245-
nil)
238+
&azappconfig.SetReadOnlyOptions{
239+
Label: to.Ptr("label")
240+
})
246241

247242
if err != nil {
248243
panic(err)
@@ -273,10 +268,10 @@ func ExampleListRevisions() {
273268
panic(err)
274269
}
275270

276-
revPgr := client.ListRevisions(
271+
revPgr := client.NewListRevisionsPager(
277272
azappconfig.SettingSelector{
278-
KeyFilter: to.StringPtr("*"),
279-
LabelFilter: to.StringPtr("*"),
273+
KeyFilter: to.Ptr("*"),
274+
LabelFilter: to.Ptr("*"),
280275
Fields: azappconfig.AllSettingFields()
281276
},
282277
nil)
@@ -315,11 +310,10 @@ func ExampleDeleteConfigurationSetting() {
315310
// Delete configuration setting
316311
resp, err := client.DeleteSetting(
317312
context.TODO(),
318-
azappconfig.Setting{
319-
Key: to.StringPtr("key"),
320-
Label: to.StringPtr("label")
321-
},
322-
nil)
313+
"key",
314+
&azappconfig.DeleteSettingOptions{
315+
Label: to.Ptr("label")
316+
})
323317

324318
if err != nil {
325319
panic(err)

sdk/appconfig/azappconfig/setting_selector.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type SettingSelector struct {
5858
Fields []SettingFields
5959
}
6060

61+
// AllSettingFields returns a collection of all setting fields to use in SettingSelector.
6162
func AllSettingFields() []SettingFields {
6263
return []SettingFields{
6364
SettingFieldsKey,

0 commit comments

Comments
 (0)