@@ -218,6 +218,8 @@ async def get_configuration_setting(
218
218
label : Optional [str ] = None ,
219
219
etag : Optional [str ] = "*" ,
220
220
match_condition : MatchConditions = MatchConditions .Unconditionally ,
221
+ * ,
222
+ accept_datetime : Optional [Union [datetime , str ]] = None ,
221
223
** kwargs ,
222
224
) -> Union [None , ConfigurationSetting ]:
223
225
@@ -250,7 +252,6 @@ async def get_configuration_setting(
250
252
key="MyKey", label="MyLabel"
251
253
)
252
254
"""
253
- accept_datetime = kwargs .pop ("accept_datetime" , None )
254
255
if isinstance (accept_datetime , datetime ):
255
256
accept_datetime = str (accept_datetime )
256
257
@@ -329,6 +330,8 @@ async def set_configuration_setting(
329
330
self ,
330
331
configuration_setting : ConfigurationSetting ,
331
332
match_condition : MatchConditions = MatchConditions .Unconditionally ,
333
+ * ,
334
+ etag : Optional [str ] = None ,
332
335
** kwargs ,
333
336
) -> ConfigurationSetting :
334
337
@@ -341,7 +344,8 @@ async def set_configuration_setting(
341
344
:type configuration_setting: ~azure.appconfiguration.ConfigurationSetting
342
345
:param match_condition: The match condition to use upon the etag
343
346
:type match_condition: ~azure.core.MatchConditions
344
- :keyword str etag: check if the ConfigurationSetting is changed. Set None to skip checking etag
347
+ :keyword str etag: check if the ConfigurationSetting is changed. \
348
+ Will use the value from param configuration_setting if not set.
345
349
:return: The ConfigurationSetting returned from the service
346
350
:rtype: ~azure.appconfiguration.ConfigurationSetting
347
351
:raises: :class:`~azure.core.exceptions.HttpResponseError`, \
@@ -366,8 +370,6 @@ async def set_configuration_setting(
366
370
)
367
371
returned_config_setting = await async_client.set_configuration_setting(config_setting)
368
372
"""
369
- etag = kwargs .get ("etag" , configuration_setting .etag )
370
-
371
373
key_value = configuration_setting ._to_generated ()
372
374
custom_headers : Mapping [str , Any ] = CaseInsensitiveDict (kwargs .get ("headers" ))
373
375
error_map : Dict [int , Any ] = {409 : ResourceReadOnlyError }
@@ -386,7 +388,7 @@ async def set_configuration_setting(
386
388
key = key_value .key , # type: ignore
387
389
label = key_value .label ,
388
390
if_match = prep_if_match (configuration_setting .etag , match_condition ),
389
- if_none_match = prep_if_none_match (etag , match_condition ),
391
+ if_none_match = prep_if_none_match (etag or configuration_setting . etag , match_condition ),
390
392
headers = custom_headers ,
391
393
error_map = error_map ,
392
394
)
@@ -396,7 +398,13 @@ async def set_configuration_setting(
396
398
397
399
@distributed_trace_async
398
400
async def delete_configuration_setting (
399
- self , key : str , label : Optional [str ] = None , ** kwargs
401
+ self ,
402
+ key : str ,
403
+ label : Optional [str ] = None ,
404
+ * ,
405
+ etag : Optional [str ] = None ,
406
+ match_condition : MatchConditions = MatchConditions .Unconditionally ,
407
+ ** kwargs ,
400
408
) -> ConfigurationSetting :
401
409
"""Delete a ConfigurationSetting if it exists
402
410
@@ -426,8 +434,6 @@ async def delete_configuration_setting(
426
434
key="MyKey", label="MyLabel"
427
435
)
428
436
"""
429
- etag = kwargs .pop ("etag" , None )
430
- match_condition = kwargs .pop ("match_condition" , MatchConditions .Unconditionally )
431
437
custom_headers : Mapping [str , Any ] = CaseInsensitiveDict (kwargs .get ("headers" ))
432
438
error_map : Dict [int , Any ] = {409 : ResourceReadOnlyError }
433
439
if match_condition == MatchConditions .IfNotModified :
@@ -453,7 +459,13 @@ async def delete_configuration_setting(
453
459
454
460
@distributed_trace
455
461
def list_revisions (
456
- self , key_filter : Optional [str ] = None , label_filter : Optional [str ] = None , ** kwargs
462
+ self ,
463
+ key_filter : Optional [str ] = None ,
464
+ label_filter : Optional [str ] = None ,
465
+ * ,
466
+ accept_datetime : Optional [Union [datetime , str ]] = None ,
467
+ fields : Optional [List [str ]] = None ,
468
+ ** kwargs ,
457
469
) -> AsyncItemPaged [ConfigurationSetting ]:
458
470
459
471
"""
@@ -492,19 +504,17 @@ def list_revisions(
492
504
async for item in filtered_revisions:
493
505
pass # do something
494
506
"""
495
- accept_datetime = kwargs .pop ("accept_datetime" , None )
496
507
if isinstance (accept_datetime , datetime ):
497
508
accept_datetime = str (accept_datetime )
498
- select = kwargs .pop ("fields" , None )
499
- if select :
500
- select = ["locked" if x == "read_only" else x for x in select ]
509
+ if fields :
510
+ fields = ["locked" if x == "read_only" else x for x in fields ]
501
511
502
512
try :
503
513
return self ._impl .get_revisions ( # type: ignore
504
514
label = label_filter ,
505
515
key = key_filter ,
506
516
accept_datetime = accept_datetime ,
507
- select = select ,
517
+ select = fields ,
508
518
cls = lambda objs : [ConfigurationSetting ._from_generated (x ) for x in objs ],
509
519
** kwargs ,
510
520
)
@@ -513,7 +523,12 @@ def list_revisions(
513
523
514
524
@distributed_trace_async
515
525
async def set_read_only (
516
- self , configuration_setting : ConfigurationSetting , read_only : bool = True , ** kwargs
526
+ self ,
527
+ configuration_setting : ConfigurationSetting ,
528
+ read_only : bool = True ,
529
+ * ,
530
+ match_condition : MatchConditions = MatchConditions .Unconditionally ,
531
+ ** kwargs ,
517
532
) -> ConfigurationSetting :
518
533
519
534
"""Set a configuration setting read only
@@ -542,7 +557,6 @@ async def set_read_only(
542
557
read_only_config_setting = await client.set_read_only(config_setting, read_only=False)
543
558
"""
544
559
error_map : Dict [int , Any ] = {}
545
- match_condition = kwargs .pop ("match_condition" , MatchConditions .Unconditionally )
546
560
if match_condition == MatchConditions .IfNotModified :
547
561
error_map .update ({412 : ResourceModifiedError })
548
562
if match_condition == MatchConditions .IfModified :
0 commit comments