diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/README.rst b/sdk/appconfiguration/azure-mgmt-appconfiguration/README.rst index d048b80fff05..d609f27c53ac 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/README.rst +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/README.rst @@ -6,7 +6,7 @@ This is the Microsoft Azure App Configuration Management Client Library. Azure Resource Manager (ARM) is the next generation of management APIs that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. +This package has been tested with Python 2.7, 3.5, 3.6 and 3.7. For the older Azure Service Management (ASM) libraries, see `azure-servicemanagement-legacy `__ library. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/__init__.py index 77b139b97b94..efa072039e5f 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/__init__.py @@ -15,6 +15,8 @@ from ._models_py3 import ConfigurationStore from ._models_py3 import ConfigurationStoreUpdateParameters from ._models_py3 import Error, ErrorException + from ._models_py3 import KeyValue + from ._models_py3 import ListKeyValueParameters from ._models_py3 import NameAvailabilityStatus from ._models_py3 import OperationDefinition from ._models_py3 import OperationDefinitionDisplay @@ -26,6 +28,8 @@ from ._models import ConfigurationStore from ._models import ConfigurationStoreUpdateParameters from ._models import Error, ErrorException + from ._models import KeyValue + from ._models import ListKeyValueParameters from ._models import NameAvailabilityStatus from ._models import OperationDefinition from ._models import OperationDefinitionDisplay @@ -44,6 +48,8 @@ 'ConfigurationStore', 'ConfigurationStoreUpdateParameters', 'Error', 'ErrorException', + 'KeyValue', + 'ListKeyValueParameters', 'NameAvailabilityStatus', 'OperationDefinition', 'OperationDefinitionDisplay', diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models.py index c6c9f8a31ee9..749c0f1957d4 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models.py @@ -261,6 +261,99 @@ def __init__(self, deserialize, response, *args): super(ErrorException, self).__init__(deserialize, response, 'Error', *args) +class KeyValue(Model): + """The result of a request to retrieve a key-value from the specified + configuration store. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar key: The primary identifier of a key-value. + The key is used in unison with the label to uniquely identify a key-value. + :vartype key: str + :ivar label: A value used to group key-values. + The label is used in unison with the key to uniquely identify a key-value. + :vartype label: str + :ivar value: The value of the key-value. + :vartype value: str + :ivar content_type: The content type of the key-value's value. + Providing a proper content-type can enable transformations of values when + they are retrieved by applications. + :vartype content_type: str + :ivar e_tag: An ETag indicating the state of a key-value within a + configuration store. + :vartype e_tag: str + :ivar last_modified: The last time a modifying operation was performed on + the given key-value. + :vartype last_modified: datetime + :ivar locked: A value indicating whether the key-value is locked. + A locked key-value may not be modified until it is unlocked. + :vartype locked: bool + :ivar tags: A dictionary of tags that can help identify what a key-value + may be applicable for. + :vartype tags: dict[str, str] + """ + + _validation = { + 'key': {'readonly': True}, + 'label': {'readonly': True}, + 'value': {'readonly': True}, + 'content_type': {'readonly': True}, + 'e_tag': {'readonly': True}, + 'last_modified': {'readonly': True}, + 'locked': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, + 'locked': {'key': 'locked', 'type': 'bool'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(KeyValue, self).__init__(**kwargs) + self.key = None + self.label = None + self.value = None + self.content_type = None + self.e_tag = None + self.last_modified = None + self.locked = None + self.tags = None + + +class ListKeyValueParameters(Model): + """The parameters used to list a configuration store key-value. + + All required parameters must be populated in order to send to Azure. + + :param key: Required. The key to retrieve. + :type key: str + :param label: The label of the key. + :type label: str + """ + + _validation = { + 'key': {'required': True}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ListKeyValueParameters, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.label = kwargs.get('label', None) + + class NameAvailabilityStatus(Model): """The result of a request to check the availability of a resource name. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models_py3.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models_py3.py index 3af279a8cb0b..8d4faa52c78b 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models_py3.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models_py3.py @@ -261,6 +261,99 @@ def __init__(self, deserialize, response, *args): super(ErrorException, self).__init__(deserialize, response, 'Error', *args) +class KeyValue(Model): + """The result of a request to retrieve a key-value from the specified + configuration store. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar key: The primary identifier of a key-value. + The key is used in unison with the label to uniquely identify a key-value. + :vartype key: str + :ivar label: A value used to group key-values. + The label is used in unison with the key to uniquely identify a key-value. + :vartype label: str + :ivar value: The value of the key-value. + :vartype value: str + :ivar content_type: The content type of the key-value's value. + Providing a proper content-type can enable transformations of values when + they are retrieved by applications. + :vartype content_type: str + :ivar e_tag: An ETag indicating the state of a key-value within a + configuration store. + :vartype e_tag: str + :ivar last_modified: The last time a modifying operation was performed on + the given key-value. + :vartype last_modified: datetime + :ivar locked: A value indicating whether the key-value is locked. + A locked key-value may not be modified until it is unlocked. + :vartype locked: bool + :ivar tags: A dictionary of tags that can help identify what a key-value + may be applicable for. + :vartype tags: dict[str, str] + """ + + _validation = { + 'key': {'readonly': True}, + 'label': {'readonly': True}, + 'value': {'readonly': True}, + 'content_type': {'readonly': True}, + 'e_tag': {'readonly': True}, + 'last_modified': {'readonly': True}, + 'locked': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, + 'locked': {'key': 'locked', 'type': 'bool'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs) -> None: + super(KeyValue, self).__init__(**kwargs) + self.key = None + self.label = None + self.value = None + self.content_type = None + self.e_tag = None + self.last_modified = None + self.locked = None + self.tags = None + + +class ListKeyValueParameters(Model): + """The parameters used to list a configuration store key-value. + + All required parameters must be populated in order to send to Azure. + + :param key: Required. The key to retrieve. + :type key: str + :param label: The label of the key. + :type label: str + """ + + _validation = { + 'key': {'required': True}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + } + + def __init__(self, *, key: str, label: str=None, **kwargs) -> None: + super(ListKeyValueParameters, self).__init__(**kwargs) + self.key = key + self.label = label + + class NameAvailabilityStatus(Model): """The result of a request to check the availability of a resource name. diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_configuration_stores_operations.py index 8df4aa075fed..cd82238a54f6 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_configuration_stores_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_configuration_stores_operations.py @@ -693,3 +693,74 @@ def regenerate_key( return deserialized regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/RegenerateKey'} + + def list_key_value( + self, resource_group_name, config_store_name, key, label=None, custom_headers=None, raw=False, **operation_config): + """Lists a configuration store key-value. + + :param resource_group_name: The name of the resource group to which + the container registry belongs. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. + :type config_store_name: str + :param key: The key to retrieve. + :type key: str + :param label: The label of the key. + :type label: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: KeyValue or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.appconfiguration.models.KeyValue or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + list_key_value_parameters = models.ListKeyValueParameters(key=key, label=label) + + # Construct URL + url = self.list_key_value.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'configStoreName': self._serialize.url("config_store_name", config_store_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9_-]*$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(list_key_value_parameters, 'ListKeyValueParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('KeyValue', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_key_value.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeyValue'} diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py index 85e0c58bbf93..1eee328efe1d 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py @@ -64,7 +64,6 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7',