From 91071a9141fddd5c6bc146a70f1d6cf760812f86 Mon Sep 17 00:00:00 2001 From: Albert Ofori Date: Tue, 1 Apr 2025 14:10:05 -0700 Subject: [PATCH 1/5] Initial changes. --- .../azure/appconfiguration/__init__.py | 18 + .../_azure_appconfiguration_client.py | 287 +++ .../_generated/_configuration.py | 11 +- .../_generated/_model_base.py | 16 + .../_generated/_operations/_operations.py | 2175 ++++++++++++++--- .../appconfiguration/_generated/_vendor.py | 11 + .../_generated/models/__init__.py | 24 + .../_generated/models/_enums.py | 49 + .../_generated/models/_models.py | 389 +++ .../azure/appconfiguration/_utils.py | 12 + .../azure/appconfiguration/aio/__init__.py | 9 +- 11 files changed, 2607 insertions(+), 394 deletions(-) diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/__init__.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/__init__.py index 4dd855d6d711..34ae1af8c5d6 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/__init__.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/__init__.py @@ -25,6 +25,15 @@ SnapshotFields, ConfigurationSettingFields, SnapshotComposition, + FeatureFlag, + FeatureFlagFields, + Allocation, + UserAllocation, + PercentileAllocation, + GroupAllocation, + Conditions, + Variant, + Telemetry ) from ._version import VERSION from ._azure_appconfiguration_error import ResourceReadOnlyError @@ -41,6 +50,15 @@ "SnapshotFields", "SnapshotComposition", "LabelFields", + "FeatureFlag", + "FeatureFlagFields", + "Allocation", + "UserAllocation", + "PercentileAllocation", + "GroupAllocation", + "Conditions", + "Variant", + "Telemetry", "ConfigurationSettingFields", "ConfigurationSettingsFilter", "ConfigurationSettingLabel", diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_azure_appconfiguration_client.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_azure_appconfiguration_client.py index 538b507114fc..5e632281ffc0 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_azure_appconfiguration_client.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_azure_appconfiguration_client.py @@ -24,6 +24,8 @@ LabelFields, ConfigurationSettingFields, SnapshotUpdateParameters, + FeatureFlag, + FeatureFlagFields ) from ._models import ( ConfigurationSetting, @@ -34,6 +36,7 @@ ) from ._utils import ( get_key_filter, + get_name_filter, get_label_filter, parse_connection_string, ) @@ -772,3 +775,287 @@ def __enter__(self) -> "AzureAppConfigurationClient": def __exit__(self, *args: Any) -> None: self._impl.__exit__(*args) + + @overload + def list_feature_flags( + self, + *, + name_filter: Optional[str] = None, + label_filter: Optional[str] = None, + tags_filter: Optional[List[str]] = None, + accept_datetime: Optional[Union[datetime, str]] = None, + fields: Optional[List[Union[str, FeatureFlagFields]]] = None, + **kwargs: Any, + ) -> ItemPaged[FeatureFlagFields]: + """List the feature flags stored in the configuration service, optionally filtered by + key, label, tags and accept_datetime. For more information about supported filters, see + https://learn.microsoft.com/azure/azure-app-configuration/rest-api-key-value?pivots=v23-11#supported-filters. + + :keyword name_filter: Filter results based on their names. '*' can be used as wildcard in the beginning or end + of the filter. + :paramtype name_filter: str or None + :keyword label_filter: Filter results based on their labels. '*' can be used as wildcard in the beginning or end + of the filter. + :paramtype label_filter: str or None + :keyword tags_filter: Filter results based on their tags. + :paramtype tags_filter: list[str] or None + :keyword accept_datetime: Retrieve FeatureFlag that existed at this datetime + :paramtype accept_datetime: ~datetime.datetime or str or None + :keyword fields: Specify which fields to include in the results. If not specified, will include all fields. + Available fields see :class:`~azure.appconfiguration.FeatureFlagFields`. + :paramtype fields: list[str] or list[~azure.appconfiguration.FeatureFlagFields] or None + :return: An iterator of :class:`~azure.appconfiguration.FeatureFlag` + :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.FeatureFlag] + :raises: :class:`~azure.core.exceptions.HttpResponseError`, \ + :class:`~azure.core.exceptions.ClientAuthenticationError` + + Example + + .. code-block:: python + + from datetime import datetime, timedelta + + accept_datetime = datetime.utcnow() + timedelta(days=-1) + + all_listed = client.list_feature_flags() + for item in all_listed: + pass # do something + + filtered_listed = client.list_feature_flags( + label_filter="Labe*", name_filter="Na*", accept_datetime=str(accept_datetime) + ) + for item in filtered_listed: + pass # do something + """ + + @overload + def list_feature_flags( + self, + *, + label: Optional[str] = None, + tags: Optional[List[str]] = None, + select: Optional[List[Union[str, FeatureFlagFields]]] = None, + name: Optional[str] = None, + after: Optional[str] = None, + sync_token: Optional[str] = None, + accept_datetime: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> ItemPaged[FeatureFlag]: + """List feature flags. + + :param label: Filter results based on their label. + :type label: Optional[str] + :param tags: Filter results based on their tags. + :type tags: Optional[List[str]] + :param select: Fields to include in the results. + :type select: Optional[List[Union[str, ~azure.appconfiguration.models.FeatureFlagFields]]] + :param name: Filter results based on their name. + :type name: Optional[str] + :param after: Identifier of the last item in previous results. + :type after: Optional[str] + :param sync_token: Used to guarantee real-time consistency between requests. + :type sync_token: Optional[str] + :param accept_datetime: Get values as they existed at specified time. + :type accept_datetime: Optional[str] + :param etag: For optimistic concurrency control. + :type etag: Optional[str] + :param match_condition: Match condition for etag. + :type match_condition: Optional[~azure.core.MatchConditions] + :return: An iterator of FeatureFlag objects. + :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.models.FeatureFlag] + :raises: ~azure.core.exceptions.HttpResponseError + """ + + @distributed_trace + def list_feature_flags(self, *args: Optional[str], **kwargs: Any) -> ItemPaged[FeatureFlag]: + accept_datetime = kwargs.pop("accept_datetime", None) + if isinstance(accept_datetime, datetime): + accept_datetime = str(accept_datetime) + select = kwargs.pop("fields", None) + if select: + select = ["locked" if x == "read_only" else x for x in select] + + tags = kwargs.pop("tags_filter", None) + name_filter, kwargs = get_name_filter(*args, **kwargs) + label_filter, kwargs = get_label_filter(*args, **kwargs) + + return self._impl.get_feature_flags( # type: ignore[return-value] + name=name_filter, + label=label_filter, + tags=tags, + accept_datetime=accept_datetime, + select=select, + **kwargs) + + @distributed_trace + def get_feature_flag( + self, + name: str, + *, + label: Optional[str] = None, + accept_datetime: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Union[None, FeatureFlag]: + """Get a feature flag. + + :param name: Name of the feature flag. + :type name: str + :param label: Feature flag's label. + :type label: Optional[str] + :param tags: Filter by tags. + :type tags: Optional[List[str]] + :param select: Fields to include in results. + :type select: Optional[List[Union[str, ~azure.appconfiguration.models.FeatureFlagFields]]] + :param sync_token: For consistency between requests. + :type sync_token: Optional[str] + :param accept_datetime: Get value as it existed at specified time. + :type accept_datetime: Optional[str] + :param etag: For optimistic concurrency control. + :type etag: Optional[str] + :param match_condition: Match condition for etag. + :type match_condition: Optional[~azure.core.MatchConditions] + :return: The requested feature flag. + :rtype: ~azure.appconfiguration.models.FeatureFlag + :raises: ~azure.core.exceptions.HttpResponseError + """ + if isinstance(accept_datetime, datetime): + accept_datetime = str(accept_datetime) + try: + return self._impl.get_feature_flag( + name=name, + label=label, + accept_datetime=accept_datetime, + etag=etag, + match_condition=match_condition, + **kwargs, + ) + except ResourceNotModifiedError: + return None + + @distributed_trace + def add_feature_flag( + self, + feature_flag: FeatureFlag, + **kwargs: Any + ) -> FeatureFlag: + """Create or update a feature flag. + + :param name: Name of the feature flag. + :type name: str + :param resource: The feature flag to create or update. + :type resource: Union[~azure.appconfiguration.models.FeatureFlag, dict, IO[bytes]] + :param label: Feature flag's label. + :type label: Optional[str] + :param sync_token: For consistency between requests. + :type sync_token: Optional[str] + :param etag: For optimistic concurrency control. + :type etag: Optional[str] + :param match_condition: Match condition for etag. + :type match_condition: Optional[~azure.core.MatchConditions] + :return: The created or updated feature flag. + :rtype: ~azure.appconfiguration.models.FeatureFlag + :raises: ~azure.core.exceptions.HttpResponseError + """ + return self._impl.put_feature_flag( + name=feature_flag.name, + resource=feature_flag, + label=feature_flag.label, + match_condition=MatchConditions.IfMissing, + **kwargs, + ) + + @distributed_trace + def set_feature_flag( + self, + feature_flag: FeatureFlag, + match_condition: MatchConditions = MatchConditions.Unconditionally, + *, + etag: Optional[str] = None, + **kwargs: Any, + ) -> FeatureFlag: + """Add or update a FeatureFlag. + If the feature flag identified by name and label does not exist, this is a create. + Otherwise this is an update. + + :param feature_flag: The FeatureFlag to be added (if not exists) \ + or updated (if exists) to the service + :type feature_flag: ~azure.appconfiguration.FeatureFlag + :param match_condition: The match condition to use upon the etag + :type match_condition: ~azure.core.MatchConditions + :keyword etag: Check if the FeatureFlag is changed. \ + Will use the value from param feature_flag if not set. + :paramtype etag: str or None + :return: The FeatureFlag returned from the service + :rtype: ~azure.appconfiguration.FeatureFlag + :raises: :class:`~azure.appconfiguration.ResourceReadOnlyError`, \ + :class:`~azure.core.exceptions.HttpResponseError`, \ + :class:`~azure.core.exceptions.ClientAuthenticationError`, \ + :class:`~azure.core.exceptions.ResourceModifiedError`, \ + :class:`~azure.core.exceptions.ResourceNotModifiedError`, \ + :class:`~azure.core.exceptions.ResourceNotFoundError`, \ + :class:`~azure.core.exceptions.ResourceExistsError` + + Example + + .. code-block:: python + + feature_flag = FeatureFlag( + name="MyName", + label="MyLabel", + enabled=true, + tags={"my set tag": "my set tag value"} + ) + returned_feature_flag = client.set_Feature_flag(feature_flag) + """ + error_map: Dict[int, Any] = {409: ResourceReadOnlyError} + + return self._impl.put_feature_flag( + name=feature_flag.name, + resource=feature_flag, + label=feature_flag.label, + match_condition=match_condition, + error_map=error_map, + **kwargs, + ) + + @distributed_trace + def delete_feature_flag( # pylint:disable=delete-operation-wrong-return-type + self, + name: str, + label: Optional[str] = None, + *, + etag: Optional[str] = None, + match_condition: MatchConditions = MatchConditions.Unconditionally, + **kwargs: Any, + ) -> Union[None, FeatureFlag]: + """Delete a feature flag. + + :param name: Name of the feature flag. + :type name: str + :param label: Feature flag's label. + :type label: Optional[str] + :param tags: Filter by tags. + :type tags: Optional[List[str]] + :param sync_token: For consistency between requests. + :type sync_token: Optional[str] + :param etag: For optimistic concurrency control. + :type etag: Optional[str] + :param match_condition: Match condition for etag. + :type match_condition: Optional[~azure.core.MatchConditions] + :return: The deleted feature flag or None if it didn't exist. + :rtype: Union[~azure.appconfiguration.models.FeatureFlag, None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map: Dict[int, Any] = {409: ResourceReadOnlyError} + return self._impl.delete_feature_flag( + name=name, + label=label, + etag=etag, + match_condition=match_condition, + error_map=error_map, + **kwargs, + ) \ No newline at end of file diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_configuration.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_configuration.py index 559ee3e9dcbe..4144bcebd1b9 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_configuration.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_configuration.py @@ -25,17 +25,18 @@ class AzureAppConfigurationClientConfiguration: # pylint: disable=too-many-inst :param endpoint: Required. :type endpoint: str - :param credential: Credential used to authenticate requests to the service. Is either a - AzureKeyCredential type or a TokenCredential type. Required. + :param credential: Credential used to authenticate requests to the service. Is either a key + credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Default value is "2023-11-01". - Note that overriding this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is + "2025-07-01-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-11-01") + api_version: str = kwargs.pop("api_version", "2025-07-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_model_base.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_model_base.py index 6a6e1f38b17e..7f73b97b23ef 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_model_base.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_model_base.py @@ -894,6 +894,22 @@ def _deserialize( return _deserialize_with_callable(deserializer, value) +def _failsafe_deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, value, module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + class _RestField: def __init__( self, diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_operations/_operations.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_operations/_operations.py index 919a641512d1..6ac2525a009b 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_operations/_operations.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_operations/_operations.py @@ -12,7 +12,7 @@ from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse -from azure.core import MatchConditions +from azure.core import MatchConditions, PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -33,8 +33,9 @@ from azure.core.utils import case_insensitive_dict from .. import models as _models -from .._model_base import SdkJSONEncoder, _deserialize -from .._serialization import Serializer +from .._configuration import AzureAppConfigurationClientConfiguration +from .._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._serialization import Serializer, Deserializer from .._vendor import AzureAppConfigurationClientMixinABC, prep_if_match, prep_if_none_match if sys.version_info >= (3, 9): @@ -118,16 +119,15 @@ def build_azure_app_configuration_check_keys_request( # pylint: disable=name-to return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_get_key_values_request( # pylint: disable=name-too-long +def build_feature_management_list_feature_flags_request( # pylint: disable=name-too-long *, - key: Optional[str] = None, label: Optional[str] = None, - sync_token: Optional[str] = None, + tags: Optional[List[str]] = None, + select: Optional[List[Union[str, _models.FeatureFlagFields]]] = None, + name: Optional[str] = None, after: Optional[str] = None, + sync_token: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, - snapshot: Optional[str] = None, - tags: Optional[List[str]] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any @@ -135,26 +135,24 @@ def build_azure_app_configuration_get_key_values_request( # pylint: disable=nam _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01-preview")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/kv" + _url = "/feature-management/ff" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if key is not None: - _params["key"] = _SERIALIZER.query("key", key, "str") if label is not None: _params["label"] = _SERIALIZER.query("label", label, "str") - if after is not None: - _params["After"] = _SERIALIZER.query("after", after, "str") - if select is not None: - _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") - if snapshot is not None: - _params["snapshot"] = _SERIALIZER.query("snapshot", snapshot, "str") if tags is not None: _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] + if select is not None: + _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + if after is not None: + _params["After"] = _SERIALIZER.query("after", after, "str") # Construct headers if sync_token is not None: @@ -173,16 +171,14 @@ def build_azure_app_configuration_get_key_values_request( # pylint: disable=nam return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_check_key_values_request( # pylint: disable=name-too-long +def build_feature_management_check_feature_flags_request( # pylint: disable=name-too-long *, - key: Optional[str] = None, label: Optional[str] = None, - sync_token: Optional[str] = None, + tags: Optional[List[str]] = None, + select: Optional[List[Union[str, _models.FeatureFlagFields]]] = None, + name: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, - snapshot: Optional[str] = None, - tags: Optional[List[str]] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any @@ -190,30 +186,26 @@ def build_azure_app_configuration_check_key_values_request( # pylint: disable=n _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/kv" + _url = "/feature-management/ff" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if key is not None: - _params["key"] = _SERIALIZER.query("key", key, "str") if label is not None: _params["label"] = _SERIALIZER.query("label", label, "str") - if after is not None: - _params["After"] = _SERIALIZER.query("after", after, "str") - if select is not None: - _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") - if snapshot is not None: - _params["snapshot"] = _SERIALIZER.query("snapshot", snapshot, "str") if tags is not None: _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] + if select is not None: + _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + if after is not None: + _params["After"] = _SERIALIZER.query("after", after, "str") # Construct headers - if sync_token is not None: - _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") if accept_datetime is not None: _headers["Accept-Datetime"] = _SERIALIZER.header("accept_datetime", accept_datetime, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -227,11 +219,12 @@ def build_azure_app_configuration_check_key_values_request( # pylint: disable=n return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_get_key_value_request( # pylint: disable=name-too-long - key: str, +def build_feature_management_get_feature_flag_request( # pylint: disable=name-too-long + name: str, *, label: Optional[str] = None, - select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, + select: Optional[List[Union[str, _models.FeatureFlagFields]]] = None, sync_token: Optional[str] = None, accept_datetime: Optional[str] = None, etag: Optional[str] = None, @@ -241,13 +234,13 @@ def build_azure_app_configuration_get_key_value_request( # pylint: disable=name _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01-preview")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/kv/{key}" + _url = "/feature-management/ff/{name}" path_format_arguments = { - "key": _SERIALIZER.url("key", key, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -256,6 +249,8 @@ def build_azure_app_configuration_get_key_value_request( # pylint: disable=name _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if label is not None: _params["label"] = _SERIALIZER.query("label", label, "str") + if tags is not None: + _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] if select is not None: _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") @@ -276,11 +271,13 @@ def build_azure_app_configuration_get_key_value_request( # pylint: disable=name return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_put_key_value_request( # pylint: disable=name-too-long - key: str, +def build_feature_management_check_feature_flag_request( # pylint: disable=name-too-long + name: str, *, label: Optional[str] = None, - sync_token: Optional[str] = None, + tags: Optional[List[str]] = None, + select: Optional[List[Union[str, _models.FeatureFlagFields]]] = None, + accept_datetime: Optional[str] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any @@ -288,14 +285,13 @@ def build_azure_app_configuration_put_key_value_request( # pylint: disable=name _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) - accept = _headers.pop("Accept", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01-preview")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/kv/{key}" + _url = "/feature-management/ff/{name}" path_format_arguments = { - "key": _SERIALIZER.url("key", key, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -304,14 +300,15 @@ def build_azure_app_configuration_put_key_value_request( # pylint: disable=name _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if label is not None: _params["label"] = _SERIALIZER.query("label", label, "str") + if tags is not None: + _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] + if select is not None: + _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - if sync_token is not None: - _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") - if accept is not None: - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept_datetime is not None: + _headers["Accept-Datetime"] = _SERIALIZER.header("accept_datetime", accept_datetime, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) if if_match is not None: _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") @@ -319,11 +316,11 @@ def build_azure_app_configuration_put_key_value_request( # pylint: disable=name if if_none_match is not None: _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_delete_key_value_request( # pylint: disable=name-too-long - key: str, +def build_feature_management_put_feature_flag_request( # pylint: disable=name-too-long + name: str, *, label: Optional[str] = None, sync_token: Optional[str] = None, @@ -334,13 +331,14 @@ def build_azure_app_configuration_delete_key_value_request( # pylint: disable=n _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01-preview")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/kv/{key}" + _url = "/feature-management/ff/{name}" path_format_arguments = { - "key": _SERIALIZER.url("key", key, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -353,6 +351,8 @@ def build_azure_app_configuration_delete_key_value_request( # pylint: disable=n # Construct headers if sync_token is not None: _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") if accept is not None: _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) @@ -362,16 +362,15 @@ def build_azure_app_configuration_delete_key_value_request( # pylint: disable=n if if_none_match is not None: _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_check_key_value_request( # pylint: disable=name-too-long - key: str, +def build_feature_management_delete_feature_flag_request( # pylint: disable=name-too-long + name: str, *, label: Optional[str] = None, + tags: Optional[List[str]] = None, sync_token: Optional[str] = None, - accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any @@ -379,13 +378,13 @@ def build_azure_app_configuration_check_key_value_request( # pylint: disable=na _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) - accept = _headers.pop("Accept", "application/json") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01-preview")) + accept = _headers.pop("Accept", None) # Construct URL - _url = "/kv/{key}" + _url = "/feature-management/ff/{name}" path_format_arguments = { - "key": _SERIALIZER.url("key", key, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -394,15 +393,14 @@ def build_azure_app_configuration_check_key_value_request( # pylint: disable=na _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if label is not None: _params["label"] = _SERIALIZER.query("label", label, "str") - if select is not None: - _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if tags is not None: + _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] # Construct headers if sync_token is not None: _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") - if accept_datetime is not None: - _headers["Accept-Datetime"] = _SERIALIZER.header("accept_datetime", accept_datetime, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) if if_match is not None: _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") @@ -410,77 +408,105 @@ def build_azure_app_configuration_check_key_value_request( # pylint: disable=na if if_none_match is not None: _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_get_snapshots_request( # pylint: disable=name-too-long +def build_feature_management_list_feature_flag_revisions_request( # pylint: disable=name-too-long *, name: Optional[str] = None, + label: Optional[str] = None, after: Optional[str] = None, - select: Optional[List[Union[str, _models.SnapshotFields]]] = None, - status: Optional[List[Union[str, _models.SnapshotStatus]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, sync_token: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01-preview")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/snapshots" + _url = "/feature-management/revisions" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if name is not None: _params["name"] = _SERIALIZER.query("name", name, "str") + if label is not None: + _params["label"] = _SERIALIZER.query("label", label, "str") if after is not None: _params["After"] = _SERIALIZER.query("after", after, "str") if select is not None: _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") - if status is not None: - _params["status"] = _SERIALIZER.query("status", status, "[str]", div=",") + if tags is not None: + _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] # Construct headers if sync_token is not None: _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") if accept is not None: _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_check_snapshots_request( # pylint: disable=name-too-long - *, sync_token: Optional[str] = None, after: Optional[str] = None, **kwargs: Any +def build_feature_management_check_feature_flag_revisions_request( # pylint: disable=name-too-long + *, + name: Optional[str] = None, + label: Optional[str] = None, + after: Optional[str] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/snapshots" + _url = "/feature-management/revisions" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + if label is not None: + _params["label"] = _SERIALIZER.query("label", label, "str") if after is not None: _params["After"] = _SERIALIZER.query("after", after, "str") + if select is not None: + _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if tags is not None: + _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] # Construct headers - if sync_token is not None: - _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_get_snapshot_request( # pylint: disable=name-too-long - name: str, +def build_azure_app_configuration_get_key_values_request( # pylint: disable=name-too-long *, - select: Optional[List[Union[str, _models.SnapshotFields]]] = None, + key: Optional[str] = None, + label: Optional[str] = None, sync_token: Optional[str] = None, + after: Optional[str] = None, + accept_datetime: Optional[str] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + snapshot: Optional[str] = None, + tags: Optional[List[str]] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any @@ -492,21 +518,28 @@ def build_azure_app_configuration_get_snapshot_request( # pylint: disable=name- accept = _headers.pop("Accept", None) # Construct URL - _url = "/snapshots/{name}" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/kv" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if key is not None: + _params["key"] = _SERIALIZER.query("key", key, "str") + if label is not None: + _params["label"] = _SERIALIZER.query("label", label, "str") + if after is not None: + _params["After"] = _SERIALIZER.query("after", after, "str") if select is not None: _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if snapshot is not None: + _params["snapshot"] = _SERIALIZER.query("snapshot", snapshot, "str") + if tags is not None: + _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] # Construct headers if sync_token is not None: _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") + if accept_datetime is not None: + _headers["Accept-Datetime"] = _SERIALIZER.header("accept_datetime", accept_datetime, "str") if accept is not None: _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) @@ -519,8 +552,19 @@ def build_azure_app_configuration_get_snapshot_request( # pylint: disable=name- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_get_operation_details_request( # pylint: disable=name-too-long - *, snapshot: str, **kwargs: Any +def build_azure_app_configuration_check_key_values_request( # pylint: disable=name-too-long + *, + key: Optional[str] = None, + label: Optional[str] = None, + sync_token: Optional[str] = None, + after: Optional[str] = None, + accept_datetime: Optional[str] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + snapshot: Optional[str] = None, + tags: Optional[List[str]] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -529,53 +573,92 @@ def build_azure_app_configuration_get_operation_details_request( # pylint: disa accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/operations" + _url = "/kv" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - _params["snapshot"] = _SERIALIZER.query("snapshot", snapshot, "str") + if key is not None: + _params["key"] = _SERIALIZER.query("key", key, "str") + if label is not None: + _params["label"] = _SERIALIZER.query("label", label, "str") + if after is not None: + _params["After"] = _SERIALIZER.query("after", after, "str") + if select is not None: + _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if snapshot is not None: + _params["snapshot"] = _SERIALIZER.query("snapshot", snapshot, "str") + if tags is not None: + _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] # Construct headers + if sync_token is not None: + _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") + if accept_datetime is not None: + _headers["Accept-Datetime"] = _SERIALIZER.header("accept_datetime", accept_datetime, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_create_snapshot_request( # pylint: disable=name-too-long - name: str, *, sync_token: Optional[str] = None, **kwargs: Any +def build_azure_app_configuration_get_key_value_request( # pylint: disable=name-too-long + key: str, + *, + label: Optional[str] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + sync_token: Optional[str] = None, + accept_datetime: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/snapshots/{name}" + _url = "/kv/{key}" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "key": _SERIALIZER.url("key", key, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if label is not None: + _params["label"] = _SERIALIZER.query("label", label, "str") + if select is not None: + _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") if sync_token is not None: _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") + if accept_datetime is not None: + _headers["Accept-Datetime"] = _SERIALIZER.header("accept_datetime", accept_datetime, "str") if accept is not None: _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_update_snapshot_request( # pylint: disable=name-too-long - name: str, +def build_azure_app_configuration_put_key_value_request( # pylint: disable=name-too-long + key: str, *, + label: Optional[str] = None, sync_token: Optional[str] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -589,15 +672,17 @@ def build_azure_app_configuration_update_snapshot_request( # pylint: disable=na accept = _headers.pop("Accept", None) # Construct URL - _url = "/snapshots/{name}" + _url = "/kv/{key}" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "key": _SERIALIZER.url("key", key, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if label is not None: + _params["label"] = _SERIALIZER.query("label", label, "str") # Construct headers if content_type is not None: @@ -613,13 +698,59 @@ def build_azure_app_configuration_update_snapshot_request( # pylint: disable=na if if_none_match is not None: _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_check_snapshot_request( # pylint: disable=name-too-long - name: str, +def build_azure_app_configuration_delete_key_value_request( # pylint: disable=name-too-long + key: str, + *, + label: Optional[str] = None, + sync_token: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/kv/{key}" + path_format_arguments = { + "key": _SERIALIZER.url("key", key, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if label is not None: + _params["label"] = _SERIALIZER.query("label", label, "str") + + # Construct headers + if sync_token is not None: + _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_azure_app_configuration_check_key_value_request( # pylint: disable=name-too-long + key: str, *, + label: Optional[str] = None, sync_token: Optional[str] = None, + accept_datetime: Optional[str] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any @@ -631,19 +762,25 @@ def build_azure_app_configuration_check_snapshot_request( # pylint: disable=nam accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/snapshots/{name}" + _url = "/kv/{key}" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "key": _SERIALIZER.url("key", key, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if label is not None: + _params["label"] = _SERIALIZER.query("label", label, "str") + if select is not None: + _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") # Construct headers if sync_token is not None: _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") + if accept_datetime is not None: + _headers["Accept-Datetime"] = _SERIALIZER.header("accept_datetime", accept_datetime, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) if if_match is not None: @@ -655,13 +792,13 @@ def build_azure_app_configuration_check_snapshot_request( # pylint: disable=nam return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_get_labels_request( # pylint: disable=name-too-long +def build_azure_app_configuration_get_snapshots_request( # pylint: disable=name-too-long *, name: Optional[str] = None, - sync_token: Optional[str] = None, after: Optional[str] = None, - accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.LabelFields]]] = None, + select: Optional[List[Union[str, _models.SnapshotFields]]] = None, + status: Optional[List[Union[str, _models.SnapshotStatus]]] = None, + sync_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -671,7 +808,7 @@ def build_azure_app_configuration_get_labels_request( # pylint: disable=name-to accept = _headers.pop("Accept", None) # Construct URL - _url = "/labels" + _url = "/snapshots" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -681,26 +818,20 @@ def build_azure_app_configuration_get_labels_request( # pylint: disable=name-to _params["After"] = _SERIALIZER.query("after", after, "str") if select is not None: _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if status is not None: + _params["status"] = _SERIALIZER.query("status", status, "[str]", div=",") # Construct headers if sync_token is not None: _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") - if accept_datetime is not None: - _headers["Accept-Datetime"] = _SERIALIZER.header("accept_datetime", accept_datetime, "str") if accept is not None: _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_check_labels_request( # pylint: disable=name-too-long - *, - name: Optional[str] = None, - sync_token: Optional[str] = None, - after: Optional[str] = None, - accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.LabelFields]]] = None, - **kwargs: Any +def build_azure_app_configuration_check_snapshots_request( # pylint: disable=name-too-long + *, sync_token: Optional[str] = None, after: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -709,31 +840,25 @@ def build_azure_app_configuration_check_labels_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/labels" + _url = "/snapshots" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if name is not None: - _params["name"] = _SERIALIZER.query("name", name, "str") if after is not None: _params["After"] = _SERIALIZER.query("after", after, "str") - if select is not None: - _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") # Construct headers if sync_token is not None: _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") - if accept_datetime is not None: - _headers["Accept-Datetime"] = _SERIALIZER.header("accept_datetime", accept_datetime, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_put_lock_request( # pylint: disable=name-too-long - key: str, +def build_azure_app_configuration_get_snapshot_request( # pylint: disable=name-too-long + name: str, *, - label: Optional[str] = None, + select: Optional[List[Union[str, _models.SnapshotFields]]] = None, sync_token: Optional[str] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -746,17 +871,17 @@ def build_azure_app_configuration_put_lock_request( # pylint: disable=name-too- accept = _headers.pop("Accept", None) # Construct URL - _url = "/locks/{key}" + _url = "/snapshots/{name}" path_format_arguments = { - "key": _SERIALIZER.url("key", key, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if label is not None: - _params["label"] = _SERIALIZER.query("label", label, "str") + if select is not None: + _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") # Construct headers if sync_token is not None: @@ -770,105 +895,112 @@ def build_azure_app_configuration_put_lock_request( # pylint: disable=name-too- if if_none_match is not None: _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_delete_lock_request( # pylint: disable=name-too-long - key: str, - *, - label: Optional[str] = None, - sync_token: Optional[str] = None, - etag: Optional[str] = None, - match_condition: Optional[MatchConditions] = None, - **kwargs: Any +def build_azure_app_configuration_get_operation_details_request( # pylint: disable=name-too-long + *, snapshot: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/operations" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["snapshot"] = _SERIALIZER.query("snapshot", snapshot, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_azure_app_configuration_create_snapshot_request( # pylint: disable=name-too-long + name: str, *, sync_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/locks/{key}" + _url = "/snapshots/{name}" path_format_arguments = { - "key": _SERIALIZER.url("key", key, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if label is not None: - _params["label"] = _SERIALIZER.query("label", label, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") if sync_token is not None: _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") if accept is not None: _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - if_match = prep_if_match(etag, match_condition) - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if_none_match = prep_if_none_match(etag, match_condition) - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_get_revisions_request( # pylint: disable=name-too-long +def build_azure_app_configuration_update_snapshot_request( # pylint: disable=name-too-long + name: str, *, - key: Optional[str] = None, - label: Optional[str] = None, sync_token: Optional[str] = None, - after: Optional[str] = None, - accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, - tags: Optional[List[str]] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/revisions" + _url = "/snapshots/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if key is not None: - _params["key"] = _SERIALIZER.query("key", key, "str") - if label is not None: - _params["label"] = _SERIALIZER.query("label", label, "str") - if after is not None: - _params["After"] = _SERIALIZER.query("after", after, "str") - if select is not None: - _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") - if tags is not None: - _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") if sync_token is not None: _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") - if accept_datetime is not None: - _headers["Accept-Datetime"] = _SERIALIZER.header("accept_datetime", accept_datetime, "str") if accept is not None: _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_azure_app_configuration_check_revisions_request( # pylint: disable=name-too-long +def build_azure_app_configuration_check_snapshot_request( # pylint: disable=name-too-long + name: str, *, - key: Optional[str] = None, - label: Optional[str] = None, sync_token: Optional[str] = None, - after: Optional[str] = None, - accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, - tags: Optional[List[str]] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -878,20 +1010,267 @@ def build_azure_app_configuration_check_revisions_request( # pylint: disable=na accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/revisions" + _url = "/snapshots/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if key is not None: - _params["key"] = _SERIALIZER.query("key", key, "str") - if label is not None: - _params["label"] = _SERIALIZER.query("label", label, "str") - if after is not None: - _params["After"] = _SERIALIZER.query("after", after, "str") - if select is not None: - _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") - if tags is not None: - _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] + + # Construct headers + if sync_token is not None: + _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_azure_app_configuration_get_labels_request( # pylint: disable=name-too-long + *, + name: Optional[str] = None, + sync_token: Optional[str] = None, + after: Optional[str] = None, + accept_datetime: Optional[str] = None, + select: Optional[List[Union[str, _models.LabelFields]]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/labels" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + if after is not None: + _params["After"] = _SERIALIZER.query("after", after, "str") + if select is not None: + _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") + + # Construct headers + if sync_token is not None: + _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") + if accept_datetime is not None: + _headers["Accept-Datetime"] = _SERIALIZER.header("accept_datetime", accept_datetime, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_azure_app_configuration_check_labels_request( # pylint: disable=name-too-long + *, + name: Optional[str] = None, + sync_token: Optional[str] = None, + after: Optional[str] = None, + accept_datetime: Optional[str] = None, + select: Optional[List[Union[str, _models.LabelFields]]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/labels" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + if after is not None: + _params["After"] = _SERIALIZER.query("after", after, "str") + if select is not None: + _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") + + # Construct headers + if sync_token is not None: + _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") + if accept_datetime is not None: + _headers["Accept-Datetime"] = _SERIALIZER.header("accept_datetime", accept_datetime, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_azure_app_configuration_put_lock_request( # pylint: disable=name-too-long + key: str, + *, + label: Optional[str] = None, + sync_token: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/locks/{key}" + path_format_arguments = { + "key": _SERIALIZER.url("key", key, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if label is not None: + _params["label"] = _SERIALIZER.query("label", label, "str") + + # Construct headers + if sync_token is not None: + _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_azure_app_configuration_delete_lock_request( # pylint: disable=name-too-long + key: str, + *, + label: Optional[str] = None, + sync_token: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/locks/{key}" + path_format_arguments = { + "key": _SERIALIZER.url("key", key, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if label is not None: + _params["label"] = _SERIALIZER.query("label", label, "str") + + # Construct headers + if sync_token is not None: + _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if_match = prep_if_match(etag, match_condition) + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if_none_match = prep_if_none_match(etag, match_condition) + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_azure_app_configuration_get_revisions_request( # pylint: disable=name-too-long + *, + key: Optional[str] = None, + label: Optional[str] = None, + sync_token: Optional[str] = None, + after: Optional[str] = None, + accept_datetime: Optional[str] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/revisions" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if key is not None: + _params["key"] = _SERIALIZER.query("key", key, "str") + if label is not None: + _params["label"] = _SERIALIZER.query("label", label, "str") + if after is not None: + _params["After"] = _SERIALIZER.query("after", after, "str") + if select is not None: + _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if tags is not None: + _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] + + # Construct headers + if sync_token is not None: + _headers["Sync-Token"] = _SERIALIZER.header("sync_token", sync_token, "str") + if accept_datetime is not None: + _headers["Accept-Datetime"] = _SERIALIZER.header("accept_datetime", accept_datetime, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_azure_app_configuration_check_revisions_request( # pylint: disable=name-too-long + *, + key: Optional[str] = None, + label: Optional[str] = None, + sync_token: Optional[str] = None, + after: Optional[str] = None, + accept_datetime: Optional[str] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/revisions" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if key is not None: + _params["key"] = _SERIALIZER.query("key", key, "str") + if label is not None: + _params["label"] = _SERIALIZER.query("label", label, "str") + if after is not None: + _params["After"] = _SERIALIZER.query("after", after, "str") + if select is not None: + _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if tags is not None: + _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] # Construct headers if sync_token is not None: @@ -1059,11 +1438,731 @@ def check_keys( cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_azure_app_configuration_check_keys_request( - name=name, + _request = build_azure_app_configuration_check_keys_request( + name=name, + sync_token=sync_token, + after=after, + accept_datetime=accept_datetime, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + return 200 <= response.status_code <= 299 + + @distributed_trace + def get_key_values( + self, + *, + key: Optional[str] = None, + label: Optional[str] = None, + sync_token: Optional[str] = None, + after: Optional[str] = None, + accept_datetime: Optional[str] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + snapshot: Optional[str] = None, + tags: Optional[List[str]] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Iterable["_models.KeyValue"]: + """Gets a list of key-values. + + Gets a list of key-values. + + :keyword key: A filter used to match keys. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. + :paramtype key: str + :keyword label: A filter used to match labels. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. + :paramtype label: str + :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is + None. + :paramtype sync_token: str + :keyword after: Instructs the server to return elements that appear after the element referred + to by the specified token. Default value is None. + :paramtype after: str + :keyword accept_datetime: Requests the server to respond with the state of the resource at the + specified + time. Default value is None. + :paramtype accept_datetime: str + :keyword select: Used to select what fields are present in the returned resource(s). Default + value is None. + :paramtype select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] + :keyword snapshot: A filter used get key-values for a snapshot. The value should be the name of + the snapshot. Not valid when used with 'key' and 'label' filters. Default value is None. + :paramtype snapshot: str + :keyword tags: A filter used to query by tags. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. + :paramtype tags: list[str] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: An iterator like instance of KeyValue + :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.models.KeyValue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.KeyValue]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_azure_app_configuration_get_key_values_request( + key=key, + label=label, + sync_token=sync_token, + after=after, + accept_datetime=accept_datetime, + select=select, + snapshot=snapshot, + tags=tags, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.KeyValue], deserialized["items"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("@nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def check_key_values( + self, + *, + key: Optional[str] = None, + label: Optional[str] = None, + sync_token: Optional[str] = None, + after: Optional[str] = None, + accept_datetime: Optional[str] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + snapshot: Optional[str] = None, + tags: Optional[List[str]] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> bool: + """Requests the headers and status of the given resource. + + Requests the headers and status of the given resource. + + :keyword key: A filter used to match keys. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. + :paramtype key: str + :keyword label: A filter used to match labels. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. + :paramtype label: str + :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is + None. + :paramtype sync_token: str + :keyword after: Instructs the server to return elements that appear after the element referred + to by the specified token. Default value is None. + :paramtype after: str + :keyword accept_datetime: Requests the server to respond with the state of the resource at the + specified + time. Default value is None. + :paramtype accept_datetime: str + :keyword select: Used to select what fields are present in the returned resource(s). Default + value is None. + :paramtype select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] + :keyword snapshot: A filter used get key-values for a snapshot. Not valid when used with 'key' + and 'label' filters. Default value is None. + :paramtype snapshot: str + :keyword tags: A filter used to query by tags. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. + :paramtype tags: list[str] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: bool + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_azure_app_configuration_check_key_values_request( + key=key, + label=label, + sync_token=sync_token, + after=after, + accept_datetime=accept_datetime, + select=select, + snapshot=snapshot, + tags=tags, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + return 200 <= response.status_code <= 299 + + @distributed_trace + def get_key_value( + self, + key: str, + *, + label: Optional[str] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + sync_token: Optional[str] = None, + accept_datetime: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.KeyValue: + """Gets a single key-value. + + Gets a single key-value. + + :param key: The key of the key-value. Required. + :type key: str + :keyword label: The label of the key-value to retrieve. Default value is None. + :paramtype label: str + :keyword select: Used to select what fields are present in the returned resource(s). Default + value is None. + :paramtype select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] + :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is + None. + :paramtype sync_token: str + :keyword accept_datetime: Requests the server to respond with the state of the resource at the + specified + time. Default value is None. + :paramtype accept_datetime: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: KeyValue. The KeyValue is compatible with MutableMapping + :rtype: ~azure.appconfiguration.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) + + _request = build_azure_app_configuration_get_key_value_request( + key=key, + label=label, + select=select, + sync_token=sync_token, + accept_datetime=accept_datetime, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) + response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.KeyValue, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def _put_key_value( + self, + key: str, + entity: Optional[_models.KeyValue] = None, + *, + content_type: str, + label: Optional[str] = None, + sync_token: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.KeyValue: ... + @overload + def _put_key_value( + self, + key: str, + entity: Optional[JSON] = None, + *, + content_type: str, + label: Optional[str] = None, + sync_token: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.KeyValue: ... + @overload + def _put_key_value( + self, + key: str, + entity: Optional[IO[bytes]] = None, + *, + content_type: str, + label: Optional[str] = None, + sync_token: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.KeyValue: ... + + @distributed_trace + def _put_key_value( + self, + key: str, + entity: Optional[Union[_models.KeyValue, JSON, IO[bytes]]] = None, + *, + label: Optional[str] = None, + sync_token: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. + + Creates a key-value. + + :param key: The key of the key-value to create. Required. + :type key: str + :param entity: The key-value to create. Is one of the following types: KeyValue, JSON, + IO[bytes] Default value is None. + :type entity: ~azure.appconfiguration.models.KeyValue or JSON or IO[bytes] + :keyword label: The label of the key-value to create. Default value is None. + :paramtype label: str + :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is + None. + :paramtype sync_token: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: KeyValue. The KeyValue is compatible with MutableMapping + :rtype: ~azure.appconfiguration.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(entity, (IOBase, bytes)): + _content = entity + else: + if entity is not None: + _content = json.dumps(entity, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_azure_app_configuration_put_key_value_request( + key=key, + label=label, + sync_token=sync_token, + etag=etag, + match_condition=match_condition, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.KeyValue, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_key_value( + self, + key: str, + *, + label: Optional[str] = None, + sync_token: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> Optional[_models.KeyValue]: + """Deletes a key-value. + + Deletes a key-value. + + :param key: The key of the key-value to delete. Required. + :type key: str + :keyword label: The label of the key-value to delete. Default value is None. + :paramtype label: str + :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is + None. + :paramtype sync_token: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: KeyValue or None. The KeyValue is compatible with MutableMapping + :rtype: ~azure.appconfiguration.models.KeyValue or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.KeyValue]] = kwargs.pop("cls", None) + + _request = build_azure_app_configuration_delete_key_value_request( + key=key, + label=label, + sync_token=sync_token, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error) + + deserialized = None + response_headers = {} + if response.status_code == 200: + response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.KeyValue, response.json()) + + if response.status_code == 204: + response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def check_key_value( + self, + key: str, + *, + label: Optional[str] = None, + sync_token: Optional[str] = None, + accept_datetime: Optional[str] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> bool: + """Requests the headers and status of the given resource. + + Requests the headers and status of the given resource. + + :param key: The key of the key-value to retrieve. Required. + :type key: str + :keyword label: The label of the key-value to retrieve. Default value is None. + :paramtype label: str + :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is + None. + :paramtype sync_token: str + :keyword accept_datetime: Requests the server to respond with the state of the resource at the + specified + time. Default value is None. + :paramtype accept_datetime: str + :keyword select: Used to select what fields are present in the returned resource(s). Default + value is None. + :paramtype select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: bool + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_azure_app_configuration_check_key_value_request( + key=key, + label=label, sync_token=sync_token, - after=after, accept_datetime=accept_datetime, + select=select, + etag=etag, + match_condition=match_condition, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1087,69 +2186,67 @@ def check_keys( response_headers = {} response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 @distributed_trace - def get_key_values( + def get_feature_flags( self, *, - key: Optional[str] = None, label: Optional[str] = None, - sync_token: Optional[str] = None, + tags: Optional[List[str]] = None, + select: Optional[List[Union[str, _models.FeatureFlagFields]]] = None, + name: Optional[str] = None, after: Optional[str] = None, + sync_token: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, - snapshot: Optional[str] = None, - tags: Optional[List[str]] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> Iterable["_models.KeyValue"]: - """Gets a list of key-values. + ) -> Iterable["_models.FeatureFlag"]: + """Gets a list of feature flags. - Gets a list of key-values. + Gets a list of feature flags. - :keyword key: A filter used to match keys. Syntax reference: - https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. - :paramtype key: str :keyword label: A filter used to match labels. Syntax reference: - https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. :paramtype label: str - :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is - None. - :paramtype sync_token: str + :keyword tags: A filter used to query by tags. Syntax reference: + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. + :paramtype tags: list[str] + :keyword select: Used to select what fields are present in the returned resource(s). Default + value is None. + :paramtype select: list[str or ~azure.appconfiguration.models.FeatureFlagFields] + :keyword name: A filter used to match feature flag names. Default value is None. + :paramtype name: str :keyword after: Instructs the server to return elements that appear after the element referred to by the specified token. Default value is None. :paramtype after: str + :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is + None. + :paramtype sync_token: str :keyword accept_datetime: Requests the server to respond with the state of the resource at the specified time. Default value is None. :paramtype accept_datetime: str - :keyword select: Used to select what fields are present in the returned resource(s). Default - value is None. - :paramtype select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] - :keyword snapshot: A filter used get key-values for a snapshot. The value should be the name of - the snapshot. Not valid when used with 'key' and 'label' filters. Default value is None. - :paramtype snapshot: str - :keyword tags: A filter used to query by tags. Syntax reference: - https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. - :paramtype tags: list[str] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: An iterator like instance of KeyValue - :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.models.KeyValue] + :return: An iterator like instance of FeatureFlag + :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.models.FeatureFlag] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.KeyValue]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.FeatureFlag]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1168,15 +2265,14 @@ def get_key_values( def prepare_request(next_link=None): if not next_link: - _request = build_azure_app_configuration_get_key_values_request( - key=key, + _request = build_feature_management_list_feature_flags_request( label=label, - sync_token=sync_token, + tags=tags, + select=select, + name=name, after=after, + sync_token=sync_token, accept_datetime=accept_datetime, - select=select, - snapshot=snapshot, - tags=tags, etag=etag, match_condition=match_condition, api_version=self._config.api_version, @@ -1214,7 +2310,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.KeyValue], deserialized["items"]) + list_of_elem = _deserialize(List[_models.FeatureFlag], deserialized.get("items", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("@nextLink") or None, iter(list_of_elem) @@ -1230,7 +2326,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.Error, response.json()) + error = _failsafe_deserialize(_models.Error, response.json()) raise HttpResponseError(response=response, model=error) return pipeline_response @@ -1238,17 +2334,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def check_key_values( + def check_feature_flags( self, *, - key: Optional[str] = None, label: Optional[str] = None, - sync_token: Optional[str] = None, + tags: Optional[List[str]] = None, + select: Optional[List[Union[str, _models.FeatureFlagFields]]] = None, + name: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, - snapshot: Optional[str] = None, - tags: Optional[List[str]] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any @@ -1257,15 +2351,19 @@ def check_key_values( Requests the headers and status of the given resource. - :keyword key: A filter used to match keys. Syntax reference: - https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. - :paramtype key: str :keyword label: A filter used to match labels. Syntax reference: - https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. :paramtype label: str - :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is - None. - :paramtype sync_token: str + :keyword tags: A filter used to query by tags. Syntax reference: + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. + :paramtype tags: list[str] + :keyword select: Used to select what fields are present in the returned resource(s). Default + value is None. + :paramtype select: list[str or ~azure.appconfiguration.models.FeatureFlagFields] + :keyword name: A filter used to match feature flag names. Default value is None. + :paramtype name: str :keyword after: Instructs the server to return elements that appear after the element referred to by the specified token. Default value is None. :paramtype after: str @@ -1273,15 +2371,6 @@ def check_key_values( specified time. Default value is None. :paramtype accept_datetime: str - :keyword select: Used to select what fields are present in the returned resource(s). Default - value is None. - :paramtype select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] - :keyword snapshot: A filter used get key-values for a snapshot. Not valid when used with 'key' - and 'label' filters. Default value is None. - :paramtype snapshot: str - :keyword tags: A filter used to query by tags. Syntax reference: - https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. - :paramtype tags: list[str] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -1310,15 +2399,13 @@ def check_key_values( cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_azure_app_configuration_check_key_values_request( - key=key, + _request = build_feature_management_check_feature_flags_request( label=label, - sync_token=sync_token, + tags=tags, + select=select, + name=name, after=after, accept_datetime=accept_datetime, - select=select, - snapshot=snapshot, - tags=tags, etag=etag, match_condition=match_condition, api_version=self._config.api_version, @@ -1339,41 +2426,48 @@ def check_key_values( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.Error, response.json()) + error = _failsafe_deserialize(_models.Error, response.json()) raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + response_headers["Link"] = self._deserialize("str", response.headers.get("Link")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore return 200 <= response.status_code <= 299 @distributed_trace - def get_key_value( + def get_feature_flag( self, - key: str, + name: str, *, label: Optional[str] = None, - select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, + select: Optional[List[Union[str, _models.FeatureFlagFields]]] = None, sync_token: Optional[str] = None, accept_datetime: Optional[str] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> _models.KeyValue: - """Gets a single key-value. + ) -> _models.FeatureFlag: + """Gets a single feature flag. - Gets a single key-value. + Gets a single feature flag. - :param key: The key of the key-value. Required. - :type key: str - :keyword label: The label of the key-value to retrieve. Default value is None. + :param name: The name of the feature flag. Required. + :type name: str + :keyword label: A filter used to match labels. Syntax reference: + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. :paramtype label: str + :keyword tags: A filter used to query by tags. Syntax reference: + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. + :paramtype tags: list[str] :keyword select: Used to select what fields are present in the returned resource(s). Default value is None. - :paramtype select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] + :paramtype select: list[str or ~azure.appconfiguration.models.FeatureFlagFields] :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is None. :paramtype sync_token: str @@ -1407,11 +2501,12 @@ def get_key_value( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) + cls: ClsType[_models.FeatureFlag] = kwargs.pop("cls", None) - _request = build_azure_app_configuration_get_key_value_request( - key=key, + _request = build_feature_management_get_feature_flag_request( + name=name, label=label, + tags=tags, select=select, sync_token=sync_token, accept_datetime=accept_datetime, @@ -1440,13 +2535,10 @@ def get_key_value( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.Error, response.json()) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) @@ -1454,75 +2546,259 @@ def get_key_value( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.KeyValue, response.json()) + deserialized = _deserialize(_models.FeatureFlag, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @distributed_trace + def check_feature_flag( + self, + name: str, + *, + label: Optional[str] = None, + tags: Optional[List[str]] = None, + select: Optional[List[Union[str, _models.FeatureFlagFields]]] = None, + accept_datetime: Optional[str] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any + ) -> bool: + """Requests the headers and status of the given resource. + + Requests the headers and status of the given resource. + + :param name: The name of the feature flag to retrieve. Required. + :type name: str + :keyword label: A filter used to match labels. Syntax reference: + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. + :paramtype label: str + :keyword tags: A filter used to query by tags. Syntax reference: + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. + :paramtype tags: list[str] + :keyword select: Used to select what fields are present in the returned resource(s). Default + value is None. + :paramtype select: list[str or ~azure.appconfiguration.models.FeatureFlagFields] + :keyword accept_datetime: Requests the server to respond with the state of the resource at the + specified + time. Default value is None. + :paramtype accept_datetime: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: bool + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + if match_condition == MatchConditions.IfNotModified: + error_map[412] = ResourceModifiedError + elif match_condition == MatchConditions.IfPresent: + error_map[412] = ResourceNotFoundError + elif match_condition == MatchConditions.IfMissing: + error_map[412] = ResourceExistsError + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_feature_management_check_feature_flag_request( + name=name, + label=label, + tags=tags, + select=select, + accept_datetime=accept_datetime, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + response_headers["Link"] = self._deserialize("str", response.headers.get("Link")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + return 200 <= response.status_code <= 299 + @overload - def _put_key_value( + def put_feature_flag( self, - key: str, - entity: Optional[_models.KeyValue] = None, + name: str, + resource: Optional[_models.FeatureFlag], *, - content_type: str, label: Optional[str] = None, sync_token: Optional[str] = None, + content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> _models.KeyValue: ... + ) -> _models.FeatureFlag: + """Creates or replaces a feature flag. + + Creates or replaces a feature flag. + + :param name: The name of the feature flag. Required. + :type name: str + :param resource: The resource instance. Required. + :type resource: ~azure.appconfiguration.models.FeatureFlag + :keyword label: A filter used to match labels. Syntax reference: + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. + :paramtype label: str + :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is + None. + :paramtype sync_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: FeatureFlag. The FeatureFlag is compatible with MutableMapping + :rtype: ~azure.appconfiguration.models.FeatureFlag + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload - def _put_key_value( + def put_feature_flag( self, - key: str, - entity: Optional[JSON] = None, + name: str, + resource: Optional[JSON], *, - content_type: str, label: Optional[str] = None, sync_token: Optional[str] = None, + content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> _models.KeyValue: ... + ) -> _models.FeatureFlag: + """Creates or replaces a feature flag. + + Creates or replaces a feature flag. + + :param name: The name of the feature flag. Required. + :type name: str + :param resource: The resource instance. Required. + :type resource: JSON + :keyword label: A filter used to match labels. Syntax reference: + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. + :paramtype label: str + :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is + None. + :paramtype sync_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: FeatureFlag. The FeatureFlag is compatible with MutableMapping + :rtype: ~azure.appconfiguration.models.FeatureFlag + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload - def _put_key_value( + def put_feature_flag( self, - key: str, - entity: Optional[IO[bytes]] = None, + name: str, + resource: Optional[IO[bytes]], *, - content_type: str, label: Optional[str] = None, sync_token: Optional[str] = None, + content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> _models.KeyValue: ... + ) -> _models.FeatureFlag: + """Creates or replaces a feature flag. + + Creates or replaces a feature flag. + + :param name: The name of the feature flag. Required. + :type name: str + :param resource: The resource instance. Required. + :type resource: IO[bytes] + :keyword label: A filter used to match labels. Syntax reference: + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. + :paramtype label: str + :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is + None. + :paramtype sync_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is + None. + :paramtype etag: str + :keyword match_condition: The match condition to use upon the etag. Default value is None. + :paramtype match_condition: ~azure.core.MatchConditions + :return: FeatureFlag. The FeatureFlag is compatible with MutableMapping + :rtype: ~azure.appconfiguration.models.FeatureFlag + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def _put_key_value( + def put_feature_flag( self, - key: str, - entity: Optional[Union[_models.KeyValue, JSON, IO[bytes]]] = None, + name: str, + resource: Optional[Union[_models.FeatureFlag, JSON, IO[bytes]]], *, label: Optional[str] = None, sync_token: Optional[str] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> _models.KeyValue: - """Creates a key-value. + ) -> _models.FeatureFlag: + """Creates or replaces a feature flag. - Creates a key-value. + Creates or replaces a feature flag. - :param key: The key of the key-value to create. Required. - :type key: str - :param entity: The key-value to create. Is one of the following types: KeyValue, JSON, - IO[bytes] Default value is None. - :type entity: ~azure.appconfiguration.models.KeyValue or JSON or IO[bytes] - :keyword label: The label of the key-value to create. Default value is None. + :param name: The name of the feature flag. Required. + :type name: str + :param resource: The resource instance. Is one of the following types: FeatureFlag, JSON, + IO[bytes] Required. + :type resource: ~azure.appconfiguration.models.FeatureFlag or JSON or IO[bytes] + :keyword label: A filter used to match labels. Syntax reference: + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. :paramtype label: str :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is None. @@ -1532,8 +2808,8 @@ def _put_key_value( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: KeyValue. The KeyValue is compatible with MutableMapping - :rtype: ~azure.appconfiguration.models.KeyValue + :return: FeatureFlag. The FeatureFlag is compatible with MutableMapping + :rtype: ~azure.appconfiguration.models.FeatureFlag :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1554,20 +2830,17 @@ def _put_key_value( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) + cls: ClsType[_models.FeatureFlag] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(entity, (IOBase, bytes)): - _content = entity + if isinstance(resource, (IOBase, bytes)): + _content = resource else: - if entity is not None: - _content = json.dumps(entity, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_azure_app_configuration_put_key_value_request( - key=key, + _request = build_feature_management_put_feature_flag_request( + name=name, label=label, sync_token=sync_token, etag=etag, @@ -1590,25 +2863,26 @@ def _put_key_value( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.Error, response.json()) + error = _failsafe_deserialize(_models.Error, response.json()) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.KeyValue, response.json()) + deserialized = _deserialize(_models.FeatureFlag, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1616,24 +2890,31 @@ def _put_key_value( return deserialized # type: ignore @distributed_trace - def delete_key_value( + def delete_feature_flag( self, - key: str, + name: str, *, label: Optional[str] = None, + tags: Optional[List[str]] = None, sync_token: Optional[str] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> Optional[_models.KeyValue]: - """Deletes a key-value. + ) -> Union[_models.FeatureFlag, Any]: + """Deletes a feature flag. - Deletes a key-value. + Deletes a feature flag. - :param key: The key of the key-value to delete. Required. - :type key: str - :keyword label: The label of the key-value to delete. Default value is None. + :param name: The name of the feature flag to delete. Required. + :type name: str + :keyword label: A filter used to match labels. Syntax reference: + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. :paramtype label: str + :keyword tags: A filter used to query by tags. Syntax reference: + `https://aka.ms/azconfig/docs/keyvaluefiltering + `_. Default value is None. + :paramtype tags: list[str] :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is None. :paramtype sync_token: str @@ -1642,8 +2923,8 @@ def delete_key_value( :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: KeyValue or None. The KeyValue is compatible with MutableMapping - :rtype: ~azure.appconfiguration.models.KeyValue or None + :return: FeatureFlag or any. The FeatureFlag is compatible with MutableMapping + :rtype: ~azure.appconfiguration.models.FeatureFlag or any :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1663,11 +2944,12 @@ def delete_key_value( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Optional[_models.KeyValue]] = kwargs.pop("cls", None) + cls: ClsType[Union[_models.FeatureFlag, Any]] = kwargs.pop("cls", None) - _request = build_azure_app_configuration_delete_key_value_request( - key=key, + _request = build_feature_management_delete_feature_flag_request( + name=name, label=label, + tags=tags, sync_token=sync_token, etag=etag, match_condition=match_condition, @@ -1694,23 +2976,28 @@ def delete_key_value( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.Error, response.json()) + error = _failsafe_deserialize(_models.Error, response.json()) raise HttpResponseError(response=response, model=error) - deserialized = None response_headers = {} if response.status_code == 200: - response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.KeyValue, response.json()) + deserialized = _deserialize(_models.FeatureFlag, response.json()) if response.status_code == 204: response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(Any, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1718,45 +3005,56 @@ def delete_key_value( return deserialized # type: ignore @distributed_trace - def check_key_value( + def list_feature_flag_revisions( self, - key: str, *, + name: Optional[str] = None, label: Optional[str] = None, - sync_token: Optional[str] = None, - accept_datetime: Optional[str] = None, + after: Optional[str] = None, select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, + sync_token: Optional[str] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any - ) -> bool: - """Requests the headers and status of the given resource. + ) -> Iterable["_models.FeatureFlag"]: + """Gets a list of feature flag revisions. - Requests the headers and status of the given resource. + Gets a list of feature flag revisions. - :param key: The key of the key-value to retrieve. Required. - :type key: str - :keyword label: The label of the key-value to retrieve. Default value is None. + :keyword name: A filter used to match names. Default value is None. + :paramtype name: str + :keyword label: A filter used to match labels. Syntax reference: + `https://aka.ms/azconfig/docs/restapirevisions + `_. Default value is None. :paramtype label: str - :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is - None. - :paramtype sync_token: str - :keyword accept_datetime: Requests the server to respond with the state of the resource at the - specified - time. Default value is None. - :paramtype accept_datetime: str + :keyword after: Instructs the server to return elements that appear after the element referred + to by the specified token. Default value is None. + :paramtype after: str :keyword select: Used to select what fields are present in the returned resource(s). Default value is None. :paramtype select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] + :keyword tags: A filter used to query by tags. Syntax reference: + `https://aka.ms/azconfig/docs/restapirevisions + `_. Default value is None. + :paramtype tags: list[str] + :keyword sync_token: Used to guarantee real-time consistency between requests. Default value is + None. + :paramtype sync_token: str :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions - :return: bool - :rtype: bool + :return: An iterator like instance of FeatureFlag + :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.models.FeatureFlag] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FeatureFlag]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1771,19 +3069,130 @@ def check_key_value( error_map[412] = ResourceExistsError error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + _request = build_feature_management_list_feature_flag_revisions_request( + name=name, + label=label, + after=after, + select=select, + tags=tags, + sync_token=sync_token, + etag=etag, + match_condition=match_condition, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FeatureFlag], deserialized.get("items", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("@nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def check_feature_flag_revisions( + self, + *, + name: Optional[str] = None, + label: Optional[str] = None, + after: Optional[str] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, + **kwargs: Any + ) -> bool: + """Requests the headers and status of the given resource. + + Requests the headers and status of the given resource. + + :keyword name: A filter used to match names. Default value is None. + :paramtype name: str + :keyword label: A filter used to match labels. Syntax reference: + `https://aka.ms/azconfig/docs/restapirevisions + `_. Default value is None. + :paramtype label: str + :keyword after: Instructs the server to return elements that appear after the element referred + to by the specified token. Default value is None. + :paramtype after: str + :keyword select: Used to select what fields are present in the returned resource(s). Default + value is None. + :paramtype select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] + :keyword tags: A filter used to query by tags. Syntax reference: + `https://aka.ms/azconfig/docs/restapirevisions + `_. Default value is None. + :paramtype tags: list[str] + :return: bool + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_azure_app_configuration_check_key_value_request( - key=key, + _request = build_feature_management_check_feature_flag_revisions_request( + name=name, label=label, - sync_token=sync_token, - accept_datetime=accept_datetime, + after=after, select=select, - etag=etag, - match_condition=match_condition, + tags=tags, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1802,12 +3211,12 @@ def check_key_value( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.Error, response.json()) + error = _failsafe_deserialize(_models.Error, response.json()) raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) + response_headers["Link"] = self._deserialize("str", response.headers.get("Link")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_vendor.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_vendor.py index cd4cb43c3298..0ffe1b096769 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_vendor.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_vendor.py @@ -27,6 +27,17 @@ class AzureAppConfigurationClientMixinABC(ABC): _deserialize: "Deserializer" +def raise_if_not_implemented(cls, abstract_methods): + not_implemented = [f for f in abstract_methods if not callable(getattr(cls, f, None))] + if not_implemented: + raise NotImplementedError( + "The following methods on operation group '{}' are not implemented: '{}'." + " Please refer to https://aka.ms/azsdk/python/dpcodegen/python/customize to learn how to customize.".format( + cls.__name__, "', '".join(not_implemented) + ) + ) + + def quote_etag(etag: Optional[str]) -> Optional[str]: if not etag or etag == "*": return etag diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/__init__.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/__init__.py index a6a4cb4accbc..a870ed2f7945 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/__init__.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/__init__.py @@ -14,43 +14,67 @@ from ._models import ( # type: ignore + Allocation, + Conditions, Error, + FeatureFlag, + FeatureFlagFilter, + GroupAllocation, Key, KeyValue, KeyValueFilter, Label, OperationDetails, + PercentileAllocation, Snapshot, SnapshotUpdateParameters, + Telemetry, + UserAllocation, + Variant, ) from ._enums import ( # type: ignore ConfigurationSettingFields, + FeatureFlagFields, LabelFields, OperationState, + RequirementType, SnapshotComposition, SnapshotFields, SnapshotStatus, + StatusOverride, ) from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "Allocation", + "Conditions", "Error", + "FeatureFlag", + "FeatureFlagFilter", + "GroupAllocation", "Key", "KeyValue", "KeyValueFilter", "Label", "OperationDetails", + "PercentileAllocation", "Snapshot", "SnapshotUpdateParameters", + "Telemetry", + "UserAllocation", + "Variant", "ConfigurationSettingFields", + "FeatureFlagFields", "LabelFields", "OperationState", + "RequirementType", "SnapshotComposition", "SnapshotFields", "SnapshotStatus", + "StatusOverride", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_enums.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_enums.py index f96f5dadd444..49ecde5bc1f5 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_enums.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_enums.py @@ -31,6 +31,35 @@ class ConfigurationSettingFields(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Etag field.""" +class FeatureFlagFields(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Feature Flag fields.""" + + NAME = "name" + """Name field.""" + ALIAS = "alias" + """Alias field.""" + LABEL = "label" + """Label field.""" + DESCRIPTION = "description" + """Description field.""" + ENABLED = "enabled" + """Enabled field.""" + CONDITIONS = "conditions" + """Conditions field.""" + VARIANTS = "variants" + """Variants field.""" + ALLOCATION = "allocation" + """Allocation field.""" + TELEMETRY = "telemetry" + """Telemetry field.""" + TAGS = "tags" + """Tags field.""" + LAST_MODIFIED = "last_modified" + """Last modified field.""" + ETAG = "etag" + """Etag field.""" + + class LabelFields(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Label fields.""" @@ -53,6 +82,15 @@ class OperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation has been canceled by the user.""" +class RequirementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Requirement Type.""" + + ANY = "Any" + """Any.""" + ALL = "All" + """All.""" + + class SnapshotComposition(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Composition types.""" @@ -100,3 +138,14 @@ class SnapshotStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Archived""" FAILED = "failed" """Failed""" + + +class StatusOverride(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status Override.""" + + NONE = "None" + """None.""" + ENABLED = "Enabled" + """Enabled.""" + DISABLED = "Disabled" + """Disabled.""" \ No newline at end of file diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_models.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_models.py index 5187502a03ec..99e9a3a611a5 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_models.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_models.py @@ -19,6 +19,103 @@ from .. import models as _models +class Allocation(_model_base.Model): + """Defines how to allocate variants based on context. + + :ivar default_when_disabled: The default variant to use when disabled. + :vartype default_when_disabled: str + :ivar default_when_enabled: The default variant to use when enabled but not allocated. + :vartype default_when_enabled: str + :ivar percentile: Allocates percentiles to variants. + :vartype percentile: list[~azure.appconfiguration.models.PercentileAllocation] + :ivar user: Allocates users to variants. + :vartype user: list[~azure.appconfiguration.models.UserAllocation] + :ivar group: Allocates groups to variants. + :vartype group: list[~azure.appconfiguration.models.GroupAllocation] + :ivar seed: The seed used for random allocation. + :vartype seed: str + """ + + default_when_disabled: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The default variant to use when disabled.""" + default_when_enabled: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The default variant to use when enabled but not allocated.""" + percentile: Optional[List["_models.PercentileAllocation"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Allocates percentiles to variants.""" + user: Optional[List["_models.UserAllocation"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Allocates users to variants.""" + group: Optional[List["_models.GroupAllocation"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Allocates groups to variants.""" + seed: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The seed used for random allocation.""" + + @overload + def __init__( + self, + *, + default_when_disabled: Optional[str] = None, + default_when_enabled: Optional[str] = None, + percentile: Optional[List["_models.PercentileAllocation"]] = None, + user: Optional[List["_models.UserAllocation"]] = None, + group: Optional[List["_models.GroupAllocation"]] = None, + seed: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Conditions(_model_base.Model): + """The conditions that must be met for the feature flag to be enabled. + + :ivar requirement_type: The requirement type for the conditions. Known values are: "Any" and + "All". + :vartype requirement_type: str or ~azure.appconfiguration.models.RequirementType + :ivar filters: The filters that will conditionally enable or disable the flag. + :vartype filters: list[~azure.appconfiguration.models.FeatureFlagFilter] + """ + + requirement_type: Optional[Union[str, "_models.RequirementType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The requirement type for the conditions. Known values are: \"Any\" and \"All\".""" + filters: Optional[List["_models.FeatureFlagFilter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The filters that will conditionally enable or disable the flag.""" + + @overload + def __init__( + self, + *, + requirement_type: Optional[Union[str, "_models.RequirementType"]] = None, + filters: Optional[List["_models.FeatureFlagFilter"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class Error(_model_base.Model): """Azure App Configuration error object. @@ -67,6 +164,152 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class FeatureFlag(_model_base.Model): + """A feature flag. + + :ivar name: The name of the feature flag. Required. + :vartype name: str + :ivar alias: The alias of the feature flag. + :vartype alias: str + :ivar label: The label the feature flag belongs to. + :vartype label: str + :ivar description: The description of the feature flag. + :vartype description: str + :ivar enabled: The enabled state of the feature flag. + :vartype enabled: bool + :ivar conditions: The conditions of the feature flag. + :vartype conditions: ~azure.appconfiguration.models.Conditions + :ivar variants: The variants of the feature flag. + :vartype variants: list[~azure.appconfiguration.models.Variant] + :ivar allocation: The allocation of the feature flag. + :vartype allocation: ~azure.appconfiguration.models.Allocation + :ivar telemetry: The telemetry settings of the feature flag. + :vartype telemetry: ~azure.appconfiguration.models.Telemetry + :ivar tags: The tags of the feature flag. + :vartype tags: dict[str, str] + :ivar last_modified: A date representing the last time the feature flag was modified. + :vartype last_modified: ~datetime.datetime + :ivar etag: A value representing the current state of the resource. + :vartype etag: str + """ + + name: str = rest_field(visibility=["read"]) + """The name of the feature flag. Required.""" + alias: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The alias of the feature flag.""" + label: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The label the feature flag belongs to.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of the feature flag.""" + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The enabled state of the feature flag.""" + conditions: Optional["_models.Conditions"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The conditions of the feature flag.""" + variants: Optional[List["_models.Variant"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The variants of the feature flag.""" + allocation: Optional["_models.Allocation"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The allocation of the feature flag.""" + telemetry: Optional["_models.Telemetry"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The telemetry settings of the feature flag.""" + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tags of the feature flag.""" + last_modified: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339") + """A date representing the last time the feature flag was modified.""" + etag: Optional[str] = rest_field(visibility=["read"]) + """A value representing the current state of the resource.""" + + @overload + def __init__( + self, + *, + alias: Optional[str] = None, + label: Optional[str] = None, + description: Optional[str] = None, + enabled: Optional[bool] = None, + conditions: Optional["_models.Conditions"] = None, + variants: Optional[List["_models.Variant"]] = None, + allocation: Optional["_models.Allocation"] = None, + telemetry: Optional["_models.Telemetry"] = None, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FeatureFlagFilter(_model_base.Model): + """Feature Flag Filter object. + + :ivar name: The name of the filter. Required. + :vartype name: str + :ivar parameters: The parameters used by the filter. + :vartype parameters: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the filter. Required.""" + parameters: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The parameters used by the filter.""" + + @overload + def __init__( + self, + *, + name: str, + parameters: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GroupAllocation(_model_base.Model): + """Feature Flag GroupAllocation object. + + :ivar variant: The variant to allocate these percentiles to. Required. + :vartype variant: str + :ivar groups: The groups to get this variant. Required. + :vartype groups: list[str] + """ + + variant: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The variant to allocate these percentiles to. Required.""" + groups: List[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The groups to get this variant. Required.""" + + @overload + def __init__( + self, + *, + variant: str, + groups: List[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class Key(_model_base.Model): """Keys serve as identifiers for key-values and are used to store and retrieve corresponding values. @@ -258,6 +501,44 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class PercentileAllocation(_model_base.Model): + """Feature Flag PercentileAllocation object. + + :ivar variant: The variant to allocate these percentiles to. Required. + :vartype variant: str + :ivar from_property: The lower bounds for this percentile allocation. Required. + :vartype from_property: int + :ivar to: The upper bounds for this percentile allocation. Required. + :vartype to: int + """ + + variant: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The variant to allocate these percentiles to. Required.""" + from_property: int = rest_field(name="from", visibility=["read", "create", "update", "delete", "query"]) + """The lower bounds for this percentile allocation. Required.""" + to: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The upper bounds for this percentile allocation. Required.""" + + @overload + def __init__( + self, + *, + variant: str, + from_property: int, + to: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class Snapshot(_model_base.Model): """A snapshot is a named, immutable subset of an App Configuration store's key-values. @@ -377,3 +658,111 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + + +class Telemetry(_model_base.Model): + """Feature Flag Telemetry object. + + :ivar enabled: The enabled state of the telemetry. Required. + :vartype enabled: bool + :ivar metadata: The metadata to include on outbound telemetry. + :vartype metadata: dict[str, str] + """ + + enabled: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The enabled state of the telemetry. Required.""" + metadata: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The metadata to include on outbound telemetry.""" + + @overload + def __init__( + self, + *, + enabled: bool, + metadata: Optional[Dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserAllocation(_model_base.Model): + """Feature Flag UserAllocation object. + + :ivar variant: The variant to allocate these percentiles to. Required. + :vartype variant: str + :ivar users: The users to get this variant. Required. + :vartype users: list[str] + """ + + variant: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The variant to allocate these percentiles to. Required.""" + users: List[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The users to get this variant. Required.""" + + @overload + def __init__( + self, + *, + variant: str, + users: List[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Variant(_model_base.Model): + """Feature Flag Variants object. + + :ivar name: The name of the variant. Required. + :vartype name: str + :ivar configuration_value: The value of the variant. + :vartype configuration_value: str + :ivar status_override: Determines if the variant should override the status of the flag. Known + values are: "None", "Enabled", and "Disabled". + :vartype status_override: str or ~azure.appconfiguration.models.StatusOverride + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the variant. Required.""" + configuration_value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The value of the variant.""" + status_override: Optional[Union[str, "_models.StatusOverride"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Determines if the variant should override the status of the flag. Known values are: \"None\", + \"Enabled\", and \"Disabled\".""" + + @overload + def __init__( + self, + *, + name: str, + configuration_value: Optional[str] = None, + status_override: Optional[Union[str, "_models.StatusOverride"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) \ No newline at end of file diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_utils.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_utils.py index 9b058b0049fb..93d07cd4ebc3 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_utils.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_utils.py @@ -50,6 +50,18 @@ def get_key_filter(*args: Optional[str], **kwargs: Any) -> Tuple[Optional[str], return key_filter or kwargs.pop("key_filter", None), kwargs +def get_name_filter(*args: Optional[str], **kwargs: Any) -> Tuple[Optional[str], Dict[str, Any]]: + name_filter = None + if len(args) > 0: + name_filter = args[0] + if "name_filter" in kwargs: + raise TypeError( + "AzureAppConfigurationClient.list_configuration_settings() got multiple values for argument " + "'name_filter'" + ) + return name_filter or kwargs.pop("name_filter", None), kwargs + + def get_label_filter(*args: Optional[str], **kwargs: Any) -> Tuple[Optional[str], Dict[str, Any]]: label_filter = None if len(args) > 1: diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/aio/__init__.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/aio/__init__.py index 243f403a5362..583a8cf08abc 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/aio/__init__.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/aio/__init__.py @@ -1,12 +1,9 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._azure_appconfiguration_client_async import AzureAppConfigurationClient From 142f03d98c61f3ef7427824825089a6c2c392300 Mon Sep 17 00:00:00 2001 From: Albert Ofori Date: Tue, 1 Apr 2025 14:46:26 -0700 Subject: [PATCH 2/5] Updating version --- .../azure-appconfiguration/azure/appconfiguration/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_version.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_version.py index 9b3cbd9ff37d..cb87f4aab805 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_version.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_version.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. # ------------------------------------ -VERSION = "1.7.2" +VERSION = "1.8.0b1" From 709a77ea539039f4a688625014783005a83c684d Mon Sep 17 00:00:00 2001 From: Albert Ofori Date: Tue, 1 Apr 2025 14:48:20 -0700 Subject: [PATCH 3/5] Update to alpha --- .../azure-appconfiguration/azure/appconfiguration/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_version.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_version.py index cb87f4aab805..252b34907b0a 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_version.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_version.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. # ------------------------------------ -VERSION = "1.8.0b1" +VERSION = "1.8.0a20240401" From 1eceb7e05752c2c615f28f23e13404d27c286de4 Mon Sep 17 00:00:00 2001 From: Albert Ofori Date: Tue, 1 Apr 2025 16:04:10 -0700 Subject: [PATCH 4/5] Updating changelog --- .../azure-appconfiguration/CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sdk/appconfiguration/azure-appconfiguration/CHANGELOG.md b/sdk/appconfiguration/azure-appconfiguration/CHANGELOG.md index 1b18c4ed2f53..08eff3cbb561 100644 --- a/sdk/appconfiguration/azure-appconfiguration/CHANGELOG.md +++ b/sdk/appconfiguration/azure-appconfiguration/CHANGELOG.md @@ -1,4 +1,14 @@ # Release History +## 1.8.0a20240401 (unreleased) + +### Features Added + - Add support for feature flags endpoint. + +### Breaking Changes + +### Bugs Fixed + +### Other Changes ## 1.7.2 (Unreleased) From e2dc43913bcc45d644156fce4e647973c411e38b Mon Sep 17 00:00:00 2001 From: Albert Ofori Date: Tue, 1 Apr 2025 18:20:33 -0700 Subject: [PATCH 5/5] Exposing Feature filter and renaming telemetry --- .../azure/appconfiguration/__init__.py | 6 ++++-- .../azure/appconfiguration/_generated/models/__init__.py | 4 ++-- .../azure/appconfiguration/_generated/models/_models.py | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/__init__.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/__init__.py index 34ae1af8c5d6..80698d2a6a38 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/__init__.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/__init__.py @@ -27,13 +27,14 @@ SnapshotComposition, FeatureFlag, FeatureFlagFields, + FeatureFlagFilter, Allocation, UserAllocation, PercentileAllocation, GroupAllocation, Conditions, Variant, - Telemetry + FeatureFlagTelemetry ) from ._version import VERSION from ._azure_appconfiguration_error import ResourceReadOnlyError @@ -52,13 +53,14 @@ "LabelFields", "FeatureFlag", "FeatureFlagFields", + "FeatureFlagFilter", "Allocation", "UserAllocation", "PercentileAllocation", "GroupAllocation", "Conditions", "Variant", - "Telemetry", + "FeatureFlagTelemetry", "ConfigurationSettingFields", "ConfigurationSettingsFilter", "ConfigurationSettingLabel", diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/__init__.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/__init__.py index a870ed2f7945..24a008f0ff30 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/__init__.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/__init__.py @@ -28,7 +28,7 @@ PercentileAllocation, Snapshot, SnapshotUpdateParameters, - Telemetry, + FeatureFlagTelemetry, UserAllocation, Variant, ) @@ -63,7 +63,7 @@ "PercentileAllocation", "Snapshot", "SnapshotUpdateParameters", - "Telemetry", + "FeatureFlagTelemetry", "UserAllocation", "Variant", "ConfigurationSettingFields", diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_models.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_models.py index 99e9a3a611a5..0e8555f950d5 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_models.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_models.py @@ -209,7 +209,7 @@ class FeatureFlag(_model_base.Model): """The variants of the feature flag.""" allocation: Optional["_models.Allocation"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The allocation of the feature flag.""" - telemetry: Optional["_models.Telemetry"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + telemetry: Optional["_models.FeatureFlagTelemetry"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The telemetry settings of the feature flag.""" tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The tags of the feature flag.""" @@ -229,7 +229,7 @@ def __init__( conditions: Optional["_models.Conditions"] = None, variants: Optional[List["_models.Variant"]] = None, allocation: Optional["_models.Allocation"] = None, - telemetry: Optional["_models.Telemetry"] = None, + telemetry: Optional["_models.FeatureFlagTelemetry"] = None, tags: Optional[Dict[str, str]] = None, ) -> None: ... @@ -660,7 +660,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Telemetry(_model_base.Model): +class FeatureFlagTelemetry(_model_base.Model): """Feature Flag Telemetry object. :ivar enabled: The enabled state of the telemetry. Required.