1212from azure .core .pipeline .policies import BearerTokenCredentialPolicy
1313from azure .core .polling import LROPoller
1414from azure .core .tracing .decorator import distributed_trace
15- from azure .core .exceptions import (
16- ResourceExistsError ,
17- ResourceNotFoundError ,
18- ResourceModifiedError ,
19- ResourceNotModifiedError ,
20- )
15+ from azure .core .exceptions import ResourceNotModifiedError
2116from azure .core .rest import HttpRequest , HttpResponse
2217from ._azure_appconfiguration_error import ResourceReadOnlyError
2318from ._azure_appconfiguration_requests import AppConfigRequestsCredentialsPolicy
24- from ._generated import AzureAppConfiguration
19+ from ._generated import AzureAppConfigurationClient as AzureAppConfigurationClientGenerated
2520from ._generated .models import (
26- SnapshotUpdateParameters ,
2721 SnapshotStatus ,
2822 SnapshotFields ,
2923 SnapshotComposition ,
3024 LabelFields ,
3125 ConfigurationSettingFields ,
26+ SnapshotUpdateParameters ,
3227)
3328from ._models import (
3429 ConfigurationSetting ,
3833 ConfigurationSettingLabel ,
3934)
4035from ._utils import (
41- prep_if_match ,
42- prep_if_none_match ,
4336 get_key_filter ,
4437 get_label_filter ,
4538 parse_connection_string ,
@@ -91,8 +84,8 @@ def __init__(self, base_url: str, credential: TokenCredential, **kwargs: Any) ->
9184 f"Unsupported credential: { type (credential )} . Use an instance of token credential from azure.identity"
9285 )
9386 # mypy doesn't compare the credential type hint with the API surface in patch.py
94- self ._impl = AzureAppConfiguration (
95- credential , base_url , per_call_policies = self ._sync_token_policy , ** kwargs # type: ignore[arg-type]
87+ self ._impl = AzureAppConfigurationClientGenerated (
88+ base_url , credential , per_call_policies = self ._sync_token_policy , ** kwargs # type: ignore[arg-type]
9689 )
9790
9891 @classmethod
@@ -138,7 +131,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
138131 :return: The response of your network call. Does not do error handling on your response.
139132 :rtype: ~azure.core.rest.HttpResponse
140133 """
141- return self ._impl ._send_request (request , stream = stream , ** kwargs )
134+ return self ._impl .send_request (request , stream = stream , ** kwargs )
142135
143136 @overload
144137 def list_configuration_settings (
@@ -285,23 +278,13 @@ def get_configuration_setting(
285278 """
286279 if isinstance (accept_datetime , datetime ):
287280 accept_datetime = str (accept_datetime )
288-
289- error_map : Dict [int , Any ] = {}
290- if match_condition == MatchConditions .IfNotModified :
291- error_map .update ({412 : ResourceModifiedError })
292- if match_condition == MatchConditions .IfPresent :
293- error_map .update ({412 : ResourceNotFoundError })
294- if match_condition == MatchConditions .IfMissing :
295- error_map .update ({412 : ResourceExistsError })
296-
297281 try :
298282 key_value = self ._impl .get_key_value (
299283 key = key ,
300284 label = label ,
301285 accept_datetime = accept_datetime ,
302- if_match = prep_if_match (etag , match_condition ),
303- if_none_match = prep_if_none_match (etag , match_condition ),
304- error_map = error_map ,
286+ etag = etag ,
287+ match_condition = match_condition ,
305288 ** kwargs ,
306289 )
307290 return ConfigurationSetting ._from_generated (key_value )
@@ -336,13 +319,11 @@ def add_configuration_setting(
336319 added_config_setting = client.add_configuration_setting(config_setting)
337320 """
338321 key_value = configuration_setting ._to_generated ()
339- error_map = {412 : ResourceExistsError }
340- key_value_added = self ._impl .put_key_value (
322+ key_value_added = self ._impl ._put_key_value (
341323 entity = key_value ,
342324 key = key_value .key , # type: ignore
343325 label = key_value .label ,
344- if_none_match = "*" ,
345- error_map = error_map ,
326+ match_condition = MatchConditions .IfMissing ,
346327 ** kwargs ,
347328 )
348329 return ConfigurationSetting ._from_generated (key_value_added )
@@ -393,21 +374,12 @@ def set_configuration_setting(
393374 """
394375 key_value = configuration_setting ._to_generated ()
395376 error_map : Dict [int , Any ] = {409 : ResourceReadOnlyError }
396- if match_condition == MatchConditions .IfNotModified :
397- error_map .update ({412 : ResourceModifiedError })
398- if match_condition == MatchConditions .IfModified :
399- error_map .update ({412 : ResourceNotModifiedError })
400- if match_condition == MatchConditions .IfPresent :
401- error_map .update ({412 : ResourceNotFoundError })
402- if match_condition == MatchConditions .IfMissing :
403- error_map .update ({412 : ResourceExistsError })
404-
405- key_value_set = self ._impl .put_key_value (
377+ key_value_set = self ._impl ._put_key_value (
406378 entity = key_value ,
407379 key = key_value .key , # type: ignore
408380 label = key_value .label ,
409- if_match = prep_if_match ( configuration_setting .etag , match_condition ) ,
410- if_none_match = prep_if_none_match ( etag or configuration_setting . etag , match_condition ) ,
381+ etag = etag or configuration_setting .etag ,
382+ match_condition = match_condition ,
411383 error_map = error_map ,
412384 ** kwargs ,
413385 )
@@ -452,19 +424,11 @@ def delete_configuration_setting( # pylint:disable=delete-operation-wrong-retur
452424 )
453425 """
454426 error_map : Dict [int , Any ] = {409 : ResourceReadOnlyError }
455- if match_condition == MatchConditions .IfNotModified :
456- error_map .update ({412 : ResourceModifiedError })
457- if match_condition == MatchConditions .IfModified :
458- error_map .update ({412 : ResourceNotModifiedError })
459- if match_condition == MatchConditions .IfPresent :
460- error_map .update ({412 : ResourceNotFoundError })
461- if match_condition == MatchConditions .IfMissing :
462- error_map .update ({412 : ResourceExistsError })
463-
464427 key_value_deleted = self ._impl .delete_key_value (
465428 key = key ,
466429 label = label ,
467- if_match = prep_if_match (etag , match_condition ),
430+ etag = etag ,
431+ match_condition = match_condition ,
468432 error_map = error_map ,
469433 ** kwargs ,
470434 )
@@ -573,32 +537,20 @@ def set_read_only(
573537 read_only_config_setting = client.set_read_only(config_setting)
574538 read_only_config_setting = client.set_read_only(config_setting, read_only=False)
575539 """
576- error_map : Dict [int , Any ] = {}
577- if match_condition == MatchConditions .IfNotModified :
578- error_map .update ({412 : ResourceModifiedError })
579- if match_condition == MatchConditions .IfModified :
580- error_map .update ({412 : ResourceNotModifiedError })
581- if match_condition == MatchConditions .IfPresent :
582- error_map .update ({412 : ResourceNotFoundError })
583- if match_condition == MatchConditions .IfMissing :
584- error_map .update ({412 : ResourceExistsError })
585-
586540 if read_only :
587541 key_value = self ._impl .put_lock (
588542 key = configuration_setting .key ,
589543 label = configuration_setting .label ,
590- if_match = prep_if_match (configuration_setting .etag , match_condition ),
591- if_none_match = prep_if_none_match (configuration_setting .etag , match_condition ),
592- error_map = error_map ,
544+ etag = configuration_setting .etag ,
545+ match_condition = match_condition ,
593546 ** kwargs ,
594547 )
595548 else :
596549 key_value = self ._impl .delete_lock (
597550 key = configuration_setting .key ,
598551 label = configuration_setting .label ,
599- if_match = prep_if_match (configuration_setting .etag , match_condition ),
600- if_none_match = prep_if_none_match (configuration_setting .etag , match_condition ),
601- error_map = error_map ,
552+ etag = configuration_setting .etag ,
553+ match_condition = match_condition ,
602554 ** kwargs ,
603555 )
604556 return ConfigurationSetting ._from_generated (key_value )
@@ -710,21 +662,11 @@ def archive_snapshot(
710662 :rtype: ~azure.appconfiguration.ConfigurationSnapshot
711663 :raises: :class:`~azure.core.exceptions.HttpResponseError`
712664 """
713- error_map : Dict [int , Any ] = {}
714- if match_condition == MatchConditions .IfNotModified :
715- error_map .update ({412 : ResourceModifiedError })
716- if match_condition == MatchConditions .IfModified :
717- error_map .update ({412 : ResourceNotModifiedError })
718- if match_condition == MatchConditions .IfPresent :
719- error_map .update ({412 : ResourceNotFoundError })
720- if match_condition == MatchConditions .IfMissing :
721- error_map .update ({412 : ResourceExistsError })
722- generated_snapshot = self ._impl .update_snapshot (
665+ generated_snapshot = self ._impl ._update_snapshot (
723666 name = name ,
724667 entity = SnapshotUpdateParameters (status = SnapshotStatus .ARCHIVED ),
725- if_match = prep_if_match (etag , match_condition ),
726- if_none_match = prep_if_none_match (etag , match_condition ),
727- error_map = error_map ,
668+ etag = etag ,
669+ match_condition = match_condition ,
728670 ** kwargs ,
729671 )
730672 return ConfigurationSnapshot ._from_generated (generated_snapshot )
@@ -750,21 +692,11 @@ def recover_snapshot(
750692 :rtype: ~azure.appconfiguration.ConfigurationSnapshot
751693 :raises: :class:`~azure.core.exceptions.HttpResponseError`
752694 """
753- error_map : Dict [int , Any ] = {}
754- if match_condition == MatchConditions .IfNotModified :
755- error_map .update ({412 : ResourceModifiedError })
756- if match_condition == MatchConditions .IfModified :
757- error_map .update ({412 : ResourceNotModifiedError })
758- if match_condition == MatchConditions .IfPresent :
759- error_map .update ({412 : ResourceNotFoundError })
760- if match_condition == MatchConditions .IfMissing :
761- error_map .update ({412 : ResourceExistsError })
762- generated_snapshot = self ._impl .update_snapshot (
695+ generated_snapshot = self ._impl ._update_snapshot (
763696 name = name ,
764697 entity = SnapshotUpdateParameters (status = SnapshotStatus .READY ),
765- if_match = prep_if_match (etag , match_condition ),
766- if_none_match = prep_if_none_match (etag , match_condition ),
767- error_map = error_map ,
698+ etag = etag ,
699+ match_condition = match_condition ,
768700 ** kwargs ,
769701 )
770702 return ConfigurationSnapshot ._from_generated (generated_snapshot )
@@ -784,9 +716,7 @@ def get_snapshot(
784716 :rtype: ~azure.appconfiguration.ConfigurationSnapshot
785717 :raises: :class:`~azure.core.exceptions.HttpResponseError`
786718 """
787- generated_snapshot = self ._impl .get_snapshot (
788- name = name , if_match = None , if_none_match = None , select = fields , ** kwargs
789- )
719+ generated_snapshot = self ._impl .get_snapshot (name = name , select = fields , ** kwargs )
790720 return ConfigurationSnapshot ._from_generated (generated_snapshot )
791721
792722 @distributed_trace
0 commit comments