diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py index af7a125d5082..144beea4f439 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_base_client.py @@ -52,9 +52,9 @@ StorageLoggingPolicy, StorageHosts, ExponentialRetry, ) -from ._version import VERSION from ._error import _process_table_error from ._models import PartialBatchErrorException +from ._sdk_moniker import SDK_MONIKER _LOGGER = logging.getLogger(__name__) @@ -385,8 +385,8 @@ def create_configuration(**kwargs): # type: (**Any) -> Configuration config = Configuration(**kwargs) config.headers_policy = StorageHeadersPolicy(**kwargs) - config.user_agent_policy = UserAgentPolicy( - sdk_moniker="storage-{}/{}".format(kwargs.pop('storage_sdk'), VERSION), **kwargs) + config.user_agent_policy = UserAgentPolicy(sdk_moniker=SDK_MONIKER, **kwargs) + # sdk_moniker="storage-{}/{}".format(kwargs.pop('storage_sdk'), VERSION), **kwargs) config.retry_policy = kwargs.get("retry_policy") or ExponentialRetry(**kwargs) config.logging_policy = StorageLoggingPolicy(**kwargs) config.proxy_policy = ProxyPolicy(**kwargs) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_constants.py b/sdk/tables/azure-data-tables/azure/data/tables/_constants.py index c8f85fca9e14..7994a03f43ae 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_constants.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_constants.py @@ -3,15 +3,8 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -import platform import sys -from ._generated.version import VERSION - -# UserAgent string sample: 'Azure-Storage/0.37.0-0.38.0 (Python CPython 3.4.2; Windows 8)' -# First version(0.37.0) is the common package, and the second version(0.38.0) is the service package -USER_AGENT_STRING_SUFFIX = '(Python {} {}; {} {})'.format(platform.python_implementation(), - platform.python_version(), platform.system(), - platform.release()) +from ._generated._version import VERSION # default values for common package, in case it is used directly DEFAULT_X_MS_VERSION = '2018-03-28' diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py b/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py index fa65406bcbde..ac82b854d53d 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py @@ -16,7 +16,6 @@ from ._entity import EntityProperty, EdmType, TableEntity from ._common_conversion import _decode_base64_to_bytes -from ._generated.models import TableProperties from ._error import TableErrorCode if TYPE_CHECKING: diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/__init__.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/__init__.py index 38dbb2a7267b..62c47d0d219e 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/__init__.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/__init__.py @@ -1,14 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- from ._azure_table import AzureTable +from ._version import VERSION + +__version__ = VERSION __all__ = ['AzureTable'] try: - from ._patch import patch_sdk + from ._patch import patch_sdk # type: ignore patch_sdk() except ImportError: pass diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/_azure_table.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/_azure_table.py index b9331513f6f5..7d6f16f78721 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/_azure_table.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/_azure_table.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- @@ -23,12 +25,11 @@ class AzureTable(object): """AzureTable. :ivar table: TableOperations operations - :vartype table: azure_table.operations.TableOperations + :vartype table: azure.data.tables.operations.TableOperations :ivar service: ServiceOperations operations - :vartype service: azure_table.operations.ServiceOperations - :param url: The URL of the service account or table that is the targe of the desired operation. + :vartype service: azure.data.tables.operations.ServiceOperations + :param url: The URL of the service account or table that is the target of the desired operation. :type url: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/_configuration.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/_configuration.py index f822bc3d1ad0..833b1374a2a0 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/_configuration.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/_configuration.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- @@ -9,11 +11,12 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any -VERSION = "unknown" class AzureTableConfiguration(Configuration): """Configuration for AzureTable. @@ -21,7 +24,7 @@ class AzureTableConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param url: The URL of the service account or table that is the targe of the desired operation. + :param url: The URL of the service account or table that is the target of the desired operation. :type url: str """ @@ -37,7 +40,7 @@ def __init__( self.url = url self.version = "2019-02-02" - kwargs.setdefault('sdk_moniker', 'azuretable/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'data-tables/{}'.format(VERSION)) self._configure(**kwargs) def _configure( @@ -49,6 +52,7 @@ def _configure( self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/version.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/_version.py similarity index 83% rename from sdk/tables/azure-data-tables/azure/data/tables/_generated/version.py rename to sdk/tables/azure-data-tables/azure/data/tables/_generated/_version.py index 629812170000..0a99d31fccc0 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/version.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/_version.py @@ -1,13 +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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2019-07-07" - +VERSION = "2019-02-02" diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/__init__.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/__init__.py index 4c1512d94a8a..a324ce215e22 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/__init__.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/__init__.py @@ -1,10 +1,10 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - -__all__ = ['AzureTable'] +# 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. +# -------------------------------------------------------------------------- from ._azure_table_async import AzureTable - - +__all__ = ['AzureTable'] diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_azure_table_async.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_azure_table_async.py index 1b3c4d87d19c..59f535c1f3b7 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_azure_table_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_azure_table_async.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- @@ -19,12 +21,11 @@ class AzureTable(object): """AzureTable. :ivar table: TableOperations operations - :vartype table: azure_table.aio.operations_async.TableOperations + :vartype table: azure.data.tables.aio.operations_async.TableOperations :ivar service: ServiceOperations operations - :vartype service: azure_table.aio.operations_async.ServiceOperations - :param url: The URL of the service account or table that is the targe of the desired operation. + :vartype service: azure.data.tables.aio.operations_async.ServiceOperations + :param url: The URL of the service account or table that is the target of the desired operation. :type url: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_configuration_async.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_configuration_async.py index d2581e2463c9..f77481ec1626 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_configuration_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/_configuration_async.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- @@ -9,7 +11,8 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -VERSION = "unknown" +from .._version import VERSION + class AzureTableConfiguration(Configuration): """Configuration for AzureTable. @@ -17,7 +20,7 @@ class AzureTableConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param url: The URL of the service account or table that is the targe of the desired operation. + :param url: The URL of the service account or table that is the target of the desired operation. :type url: str """ @@ -32,7 +35,7 @@ def __init__( self.url = url self.version = "2019-02-02" - kwargs.setdefault('sdk_moniker', 'azuretable/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'data-tables/{}'.format(VERSION)) self._configure(**kwargs) def _configure( @@ -43,6 +46,7 @@ def _configure( self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/__init__.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/__init__.py index 90d9a5059444..4257b1efd611 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/__init__.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/__init__.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_service_operations_async.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_service_operations_async.py index b9a2d2b3d664..770d59c8b8c3 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_service_operations_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_service_operations_async.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Generic, Optional, TypeVar @@ -22,7 +24,7 @@ class ServiceOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_table.models + :type models: ~azure.data.tables.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,10 +46,11 @@ async def set_properties( request_id_parameter: Optional[str] = None, **kwargs ) -> None: - """Sets properties for an account's Table service endpoint, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. + """Sets properties for an account's Table service endpoint, including properties for Analytics and + CORS (Cross-Origin Resource Sharing) rules. :param table_service_properties: The Table Service properties. - :type table_service_properties: ~azure_table.models.TableServiceProperties + :type table_service_properties: ~azure.data.tables.models.TableServiceProperties :param timeout: The timeout parameter is expressed in seconds. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -86,7 +89,6 @@ async def set_properties( header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(table_service_properties, 'TableServiceProperties', is_xml=True) body_content_kwargs['content'] = body_content @@ -116,7 +118,8 @@ async def get_properties( request_id_parameter: Optional[str] = None, **kwargs ) -> "models.TableServiceProperties": - """Gets the properties of an account's Table service, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. + """Gets the properties of an account's Table service, including properties for Analytics and CORS + (Cross-Origin Resource Sharing) rules. :param timeout: The timeout parameter is expressed in seconds. :type timeout: int @@ -125,7 +128,7 @@ async def get_properties( :type request_id_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: TableServiceProperties, or the result of cls(response) - :rtype: ~azure_table.models.TableServiceProperties + :rtype: ~azure.data.tables.models.TableServiceProperties :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TableServiceProperties"] @@ -155,7 +158,6 @@ async def get_properties( header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') header_parameters['Accept'] = 'application/xml' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,7 +185,9 @@ async def get_statistics( request_id_parameter: Optional[str] = None, **kwargs ) -> "models.TableServiceStats": - """Retrieves statistics related to replication for the Table service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the account. + """Retrieves statistics related to replication for the Table service. It is only available on the + secondary location endpoint when read-access geo-redundant replication is enabled for the + account. :param timeout: The timeout parameter is expressed in seconds. :type timeout: int @@ -192,7 +196,7 @@ async def get_statistics( :type request_id_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: TableServiceStats, or the result of cls(response) - :rtype: ~azure_table.models.TableServiceStats + :rtype: ~azure.data.tables.models.TableServiceStats :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TableServiceStats"] @@ -222,7 +226,6 @@ async def get_statistics( header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') header_parameters['Accept'] = 'application/xml' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_table_operations_async.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_table_operations_async.py index 80d2a09252d7..1f22ee2be6b0 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_table_operations_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/aio/operations_async/_table_operations_async.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union @@ -22,7 +24,7 @@ class TableOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_table.models + :type models: ~azure.data.tables.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -52,10 +54,10 @@ async def query( :param next_table_name: A table query continuation token from a previous call. :type next_table_name: str :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: TableQueryResponse, or the result of cls(response) - :rtype: ~azure_table.models.TableQueryResponse + :rtype: ~azure.data.tables.models.TableQueryResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TableQueryResponse"] @@ -101,14 +103,14 @@ async def query( header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') header_parameters['Accept'] = 'application/json;odata=minimalmetadata' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **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) - raise HttpResponseError(response=response) + error = self._deserialize(models.TableServiceError, response) + 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')) @@ -131,25 +133,25 @@ async def create( response_preference: Optional[Union[str, "models.ResponseFormat"]] = None, query_options: Optional["models.QueryOptions"] = None, **kwargs - ) -> "models.TableResponse": + ) -> Optional["models.TableResponse"]: """Creates a new table under the given account. :param table_properties: The Table properties. - :type table_properties: ~azure_table.models.TableProperties + :type table_properties: ~azure.data.tables.models.TableProperties :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled. :type request_id_parameter: str :param response_preference: Specifies whether the response should include the inserted entity in the payload. Possible values are return-no-content and return-content. - :type response_preference: str or ~azure_table.models.ResponseFormat + :type response_preference: str or ~azure.data.tables.models.ResponseFormat :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: TableResponse, or the result of cls(response) - :rtype: ~azure_table.models.TableResponse or None + :rtype: ~azure.data.tables.models.TableResponse or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TableResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TableResponse"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) @@ -182,7 +184,6 @@ async def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json;odata=minimalmetadata' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(table_properties, 'TableProperties') body_content_kwargs['content'] = body_content @@ -258,7 +259,6 @@ async def delete( if request_id_parameter is not None: header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -303,10 +303,10 @@ async def query_entities( :param next_row_key: An entity query continuation token from a previous call. :type next_row_key: str :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: TableEntityQueryResponse, or the result of cls(response) - :rtype: ~azure_table.models.TableEntityQueryResponse + :rtype: ~azure.data.tables.models.TableEntityQueryResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TableEntityQueryResponse"] @@ -357,7 +357,6 @@ async def query_entities( header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') header_parameters['Accept'] = 'application/json;odata=minimalmetadata' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -391,7 +390,7 @@ async def query_entities_with_partition_and_row_key( request_id_parameter: Optional[str] = None, query_options: Optional["models.QueryOptions"] = None, **kwargs - ) -> "models.TableEntityQueryResponse": + ) -> Dict[str, object]: """Queries entities in a table. :param table: The name of the table. @@ -406,13 +405,13 @@ async def query_entities_with_partition_and_row_key( limit that is recorded in the analytics logs when analytics logging is enabled. :type request_id_parameter: str :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response - :return: TableEntityQueryResponse, or the result of cls(response) - :rtype: ~azure_table.models.TableEntityQueryResponse + :return: dict mapping str to object, or the result of cls(response) + :rtype: dict[str, object] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TableEntityQueryResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, object]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) @@ -454,7 +453,6 @@ async def query_entities_with_partition_and_row_key( header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') header_parameters['Accept'] = 'application/json;odata=minimalmetadata' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -472,7 +470,7 @@ async def query_entities_with_partition_and_row_key( response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) response_headers['x-ms-continuation-NextPartitionKey']=self._deserialize('str', response.headers.get('x-ms-continuation-NextPartitionKey')) response_headers['x-ms-continuation-NextRowKey']=self._deserialize('str', response.headers.get('x-ms-continuation-NextRowKey')) - deserialized = self._deserialize('TableEntityQueryResponse', pipeline_response) + deserialized = self._deserialize('{object}', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) @@ -513,7 +511,7 @@ async def update_entity( :param table_entity_properties: The properties for the table entity. :type table_entity_properties: dict[str, object] :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -556,7 +554,6 @@ async def update_entity( header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] if table_entity_properties is not None: body_content = self._serialize.body(table_entity_properties, '{object}') @@ -618,7 +615,7 @@ async def merge_entity( :param table_entity_properties: The properties for the table entity. :type table_entity_properties: dict[str, object] :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -661,7 +658,6 @@ async def merge_entity( header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] if table_entity_properties is not None: body_content = self._serialize.body(table_entity_properties, '{object}') @@ -719,7 +715,7 @@ async def delete_entity( limit that is recorded in the analytics logs when analytics logging is enabled. :type request_id_parameter: str :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -759,7 +755,6 @@ async def delete_entity( header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -789,7 +784,7 @@ async def insert_entity( table_entity_properties: Optional[Dict[str, object]] = None, query_options: Optional["models.QueryOptions"] = None, **kwargs - ) -> Dict[str, object]: + ) -> Optional[Dict[str, object]]: """Insert entity in a table. :param table: The name of the table. @@ -801,17 +796,17 @@ async def insert_entity( :type request_id_parameter: str :param response_preference: Specifies whether the response should include the inserted entity in the payload. Possible values are return-no-content and return-content. - :type response_preference: str or ~azure_table.models.ResponseFormat + :type response_preference: str or ~azure.data.tables.models.ResponseFormat :param table_entity_properties: The properties for the table entity. :type table_entity_properties: dict[str, object] :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: dict mapping str to object, or the result of cls(response) :rtype: dict[str, object] or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, object]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Dict[str, object]]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) @@ -847,7 +842,6 @@ async def insert_entity( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json;odata=minimalmetadata' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] if table_entity_properties is not None: body_content = self._serialize.body(table_entity_properties, '{object}') @@ -898,7 +892,8 @@ async def get_access_policy( request_id_parameter: Optional[str] = None, **kwargs ) -> List["models.SignedIdentifier"]: - """Retrieves details about any stored access policies specified on the table that may be used with Shared Access Signatures. + """Retrieves details about any stored access policies specified on the table that may be used with + Shared Access Signatures. :param table: The name of the table. :type table: str @@ -909,7 +904,7 @@ async def get_access_policy( :type request_id_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier, or the result of cls(response) - :rtype: list[~azure_table.models.SignedIdentifier] + :rtype: list[~azure.data.tables.models.SignedIdentifier] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.SignedIdentifier"]] @@ -938,7 +933,6 @@ async def get_access_policy( header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') header_parameters['Accept'] = 'application/xml' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -979,7 +973,7 @@ async def set_access_policy( limit that is recorded in the analytics logs when analytics logging is enabled. :type request_id_parameter: str :param table_acl: The acls for the table. - :type table_acl: list[~azure_table.models.SignedIdentifier] + :type table_acl: list[~azure.data.tables.models.SignedIdentifier] :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1011,9 +1005,7 @@ async def set_access_policy( if request_id_parameter is not None: header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'wrapped': True, 'itemsName': 'SignedIdentifier'}} if table_acl is not None: diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/__init__.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/__init__.py index 944581fccd98..bec7bb2e5155 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/__init__.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/__init__.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- @@ -19,6 +21,8 @@ from ._models_py3 import TableResponse from ._models_py3 import TableResponseProperties from ._models_py3 import TableServiceError + from ._models_py3 import TableServiceErrorOdataError + from ._models_py3 import TableServiceErrorOdataErrorMessage from ._models_py3 import TableServiceProperties from ._models_py3 import TableServiceStats except (SyntaxError, ImportError): @@ -36,6 +40,8 @@ from ._models import TableResponse # type: ignore from ._models import TableResponseProperties # type: ignore from ._models import TableServiceError # type: ignore + from ._models import TableServiceErrorOdataError # type: ignore + from ._models import TableServiceErrorOdataErrorMessage # type: ignore from ._models import TableServiceProperties # type: ignore from ._models import TableServiceStats # type: ignore @@ -60,6 +66,8 @@ 'TableResponse', 'TableResponseProperties', 'TableServiceError', + 'TableServiceErrorOdataError', + 'TableServiceErrorOdataErrorMessage', 'TableServiceProperties', 'TableServiceStats', 'GeoReplicationStatusType', diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_azure_table_enums.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_azure_table_enums.py index ef8e90bd92c9..7685b428f163 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_azure_table_enums.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_azure_table_enums.py @@ -1,26 +1,46 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- -from enum import Enum +from enum import Enum, EnumMeta +from six import with_metaclass -class GeoReplicationStatusType(str, Enum): +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class GeoReplicationStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The status of the secondary location. """ - live = "live" - bootstrap = "bootstrap" - unavailable = "unavailable" + LIVE = "live" + BOOTSTRAP = "bootstrap" + UNAVAILABLE = "unavailable" -class OdataMetadataFormat(str, Enum): +class OdataMetadataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - application_json_odata_nometadata = "application/json;odata=nometadata" - application_json_odata_minimalmetadata = "application/json;odata=minimalmetadata" - application_json_odata_fullmetadata = "application/json;odata=fullmetadata" + APPLICATION_JSON_ODATA_NOMETADATA = "application/json;odata=nometadata" + APPLICATION_JSON_ODATA_MINIMALMETADATA = "application/json;odata=minimalmetadata" + APPLICATION_JSON_ODATA_FULLMETADATA = "application/json;odata=fullmetadata" -class ResponseFormat(str, Enum): +class ResponseFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - return_no_content = "return-no-content" - return_content = "return-content" + RETURN_NO_CONTENT = "return-no-content" + RETURN_CONTENT = "return-content" diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models.py index 3ca6eee7318e..a3a42b3c7a28 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- @@ -14,9 +16,9 @@ class AccessPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param start: Required. The start datetime from which the policy is active. - :type start: ~datetime.datetime + :type start: str :param expiry: Required. The datetime that the policy expires. - :type expiry: ~datetime.datetime + :type expiry: str :param permission: Required. The permissions for the acl policy. :type permission: str """ @@ -37,8 +39,8 @@ class AccessPolicy(msrest.serialization.Model): } def __init__( - self, - **kwargs + self, + **kwargs ): super(AccessPolicy, self).__init__(**kwargs) self.start = kwargs['start'] @@ -109,7 +111,7 @@ class GeoReplication(msrest.serialization.Model): :param status: Required. The status of the secondary location. Possible values include: "live", "bootstrap", "unavailable". - :type status: str or ~azure_table.models.GeoReplicationStatusType + :type status: str or ~azure.data.tables.models.GeoReplicationStatusType :param last_sync_time: Required. A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads. @@ -152,7 +154,7 @@ class Logging(msrest.serialization.Model): :param write: Required. Indicates whether all write requests should be logged. :type write: bool :param retention_policy: Required. The retention policy. - :type retention_policy: ~azure_table.models.RetentionPolicy + :type retention_policy: ~azure.data.tables.models.RetentionPolicy """ _validation = { @@ -199,7 +201,7 @@ class Metrics(msrest.serialization.Model): API operations. :type include_apis: bool :param retention_policy: The retention policy. - :type retention_policy: ~azure_table.models.RetentionPolicy + :type retention_policy: ~azure.data.tables.models.RetentionPolicy """ _validation = { @@ -233,7 +235,7 @@ class QueryOptions(msrest.serialization.Model): :param format: Specifies the media type for the response. Possible values include: "application/json;odata=nometadata", "application/json;odata=minimalmetadata", "application/json;odata=fullmetadata". - :type format: str or ~azure_table.models.OdataMetadataFormat + :type format: str or ~azure.data.tables.models.OdataMetadataFormat :param top: Maximum number of records to return. :type top: int :param select: Select expression using OData notation. Limits the columns on each record to @@ -306,13 +308,12 @@ class SignedIdentifier(msrest.serialization.Model): :param id: Required. A unique id. :type id: str - :param access_policy: Required. The access policy. - :type access_policy: ~azure_table.models.AccessPolicy + :param access_policy: The access policy. + :type access_policy: ~azure.data.tables.models.AccessPolicy """ _validation = { 'id': {'required': True}, - 'access_policy': {'required': True}, } _attribute_map = { @@ -324,12 +325,12 @@ class SignedIdentifier(msrest.serialization.Model): } def __init__( - self, - **kwargs + self, + **kwargs ): super(SignedIdentifier, self).__init__(**kwargs) self.id = kwargs['id'] - self.access_policy = kwargs['access_policy'] + self.access_policy = kwargs.get('access_policy', None) class TableEntityQueryResponse(msrest.serialization.Model): @@ -380,7 +381,7 @@ class TableQueryResponse(msrest.serialization.Model): :param odata_metadata: The metadata response of the table. :type odata_metadata: str :param value: List of tables. - :type value: list[~azure_table.models.TableResponseProperties] + :type value: list[~azure.data.tables.models.TableResponseProperties] """ _attribute_map = { @@ -462,15 +463,12 @@ def __init__( class TableServiceError(msrest.serialization.Model): """Table Service error. - :param message: The error message. - :type message: str + :param odata_error: The odata error. + :type odata_error: ~azure.data.tables.models.TableServiceErrorOdataError """ _attribute_map = { - 'message': {'key': 'Message', 'type': 'str', 'xml': {'name': 'Message'}}, - } - _xml_map = { - + 'odata_error': {'key': 'odata\\.error', 'type': 'TableServiceErrorOdataError'}, } def __init__( @@ -478,22 +476,69 @@ def __init__( **kwargs ): super(TableServiceError, self).__init__(**kwargs) + self.odata_error = kwargs.get('odata_error', None) + + +class TableServiceErrorOdataError(msrest.serialization.Model): + """The odata error. + + :param code: The service error code. The error codes possible are listed in: + https://docs.microsoft.com/rest/api/storageservices/table-service-error-codes. + :type code: str + :param message: The service error message. + :type message: ~azure.data.tables.models.TableServiceErrorOdataErrorMessage + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'TableServiceErrorOdataErrorMessage'}, + } + + def __init__( + self, + **kwargs + ): + super(TableServiceErrorOdataError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) +class TableServiceErrorOdataErrorMessage(msrest.serialization.Model): + """The service error message. + + :param lang: Language code of the error message. + :type lang: str + :param value: The error message. + :type value: str + """ + + _attribute_map = { + 'lang': {'key': 'lang', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TableServiceErrorOdataErrorMessage, self).__init__(**kwargs) + self.lang = kwargs.get('lang', None) + self.value = kwargs.get('value', None) + + class TableServiceProperties(msrest.serialization.Model): """Table Service Properties. :param logging: Azure Analytics Logging settings. - :type logging: ~azure_table.models.Logging + :type logging: ~azure.data.tables.models.Logging :param hour_metrics: A summary of request statistics grouped by API in hourly aggregates for tables. - :type hour_metrics: ~azure_table.models.Metrics + :type hour_metrics: ~azure.data.tables.models.Metrics :param minute_metrics: A summary of request statistics grouped by API in minute aggregates for tables. - :type minute_metrics: ~azure_table.models.Metrics + :type minute_metrics: ~azure.data.tables.models.Metrics :param cors: The set of CORS rules. - :type cors: list[~azure_table.models.CorsRule] + :type cors: list[~azure.data.tables.models.CorsRule] """ _attribute_map = { @@ -521,7 +566,7 @@ class TableServiceStats(msrest.serialization.Model): """Stats for the service. :param geo_replication: Geo-Replication information for the Secondary Storage Service. - :type geo_replication: ~azure_table.models.GeoReplication + :type geo_replication: ~azure.data.tables.models.GeoReplication """ _attribute_map = { diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models_py3.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models_py3.py index 001b3ff92b4b..8469471af9bc 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models_py3.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/models/_models_py3.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- @@ -19,9 +21,9 @@ class AccessPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param start: Required. The start datetime from which the policy is active. - :type start: ~datetime.datetime + :type start: str :param expiry: Required. The datetime that the policy expires. - :type expiry: ~datetime.datetime + :type expiry: str :param permission: Required. The permissions for the acl policy. :type permission: str """ @@ -44,8 +46,8 @@ class AccessPolicy(msrest.serialization.Model): def __init__( self, *, - start: datetime.datetime, - expiry: datetime.datetime, + start: str, + expiry: str, permission: str, **kwargs ): @@ -124,7 +126,7 @@ class GeoReplication(msrest.serialization.Model): :param status: Required. The status of the secondary location. Possible values include: "live", "bootstrap", "unavailable". - :type status: str or ~azure_table.models.GeoReplicationStatusType + :type status: str or ~azure.data.tables.models.GeoReplicationStatusType :param last_sync_time: Required. A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads. @@ -170,7 +172,7 @@ class Logging(msrest.serialization.Model): :param write: Required. Indicates whether all write requests should be logged. :type write: bool :param retention_policy: Required. The retention policy. - :type retention_policy: ~azure_table.models.RetentionPolicy + :type retention_policy: ~azure.data.tables.models.RetentionPolicy """ _validation = { @@ -223,7 +225,7 @@ class Metrics(msrest.serialization.Model): API operations. :type include_apis: bool :param retention_policy: The retention policy. - :type retention_policy: ~azure_table.models.RetentionPolicy + :type retention_policy: ~azure.data.tables.models.RetentionPolicy """ _validation = { @@ -262,7 +264,7 @@ class QueryOptions(msrest.serialization.Model): :param format: Specifies the media type for the response. Possible values include: "application/json;odata=nometadata", "application/json;odata=minimalmetadata", "application/json;odata=fullmetadata". - :type format: str or ~azure_table.models.OdataMetadataFormat + :type format: str or ~azure.data.tables.models.OdataMetadataFormat :param top: Maximum number of records to return. :type top: int :param select: Select expression using OData notation. Limits the columns on each record to @@ -343,13 +345,12 @@ class SignedIdentifier(msrest.serialization.Model): :param id: Required. A unique id. :type id: str - :param access_policy: Required. The access policy. - :type access_policy: ~azure_table.models.AccessPolicy + :param access_policy: The access policy. + :type access_policy: ~azure.data.tables.models.AccessPolicy """ _validation = { 'id': {'required': True}, - 'access_policy': {'required': True}, } _attribute_map = { @@ -364,7 +365,7 @@ def __init__( self, *, id: str, - access_policy: "AccessPolicy", + access_policy: Optional["AccessPolicy"] = None, **kwargs ): super(SignedIdentifier, self).__init__(**kwargs) @@ -425,7 +426,7 @@ class TableQueryResponse(msrest.serialization.Model): :param odata_metadata: The metadata response of the table. :type odata_metadata: str :param value: List of tables. - :type value: list[~azure_table.models.TableResponseProperties] + :type value: list[~azure.data.tables.models.TableResponseProperties] """ _attribute_map = { @@ -521,40 +522,90 @@ def __init__( class TableServiceError(msrest.serialization.Model): """Table Service error. - :param message: The error message. - :type message: str + :param odata_error: The odata error. + :type odata_error: ~azure.data.tables.models.TableServiceErrorOdataError """ _attribute_map = { - 'message': {'key': 'Message', 'type': 'str', 'xml': {'name': 'Message'}}, - } - _xml_map = { - + 'odata_error': {'key': 'odata\\.error', 'type': 'TableServiceErrorOdataError'}, } def __init__( self, *, - message: Optional[str] = None, + odata_error: Optional["TableServiceErrorOdataError"] = None, **kwargs ): super(TableServiceError, self).__init__(**kwargs) + self.odata_error = odata_error + + +class TableServiceErrorOdataError(msrest.serialization.Model): + """The odata error. + + :param code: The service error code. The error codes possible are listed in: + https://docs.microsoft.com/rest/api/storageservices/table-service-error-codes. + :type code: str + :param message: The service error message. + :type message: ~azure.data.tables.models.TableServiceErrorOdataErrorMessage + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'TableServiceErrorOdataErrorMessage'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional["TableServiceErrorOdataErrorMessage"] = None, + **kwargs + ): + super(TableServiceErrorOdataError, self).__init__(**kwargs) + self.code = code self.message = message +class TableServiceErrorOdataErrorMessage(msrest.serialization.Model): + """The service error message. + + :param lang: Language code of the error message. + :type lang: str + :param value: The error message. + :type value: str + """ + + _attribute_map = { + 'lang': {'key': 'lang', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + lang: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + super(TableServiceErrorOdataErrorMessage, self).__init__(**kwargs) + self.lang = lang + self.value = value + + class TableServiceProperties(msrest.serialization.Model): """Table Service Properties. :param logging: Azure Analytics Logging settings. - :type logging: ~azure_table.models.Logging + :type logging: ~azure.data.tables.models.Logging :param hour_metrics: A summary of request statistics grouped by API in hourly aggregates for tables. - :type hour_metrics: ~azure_table.models.Metrics + :type hour_metrics: ~azure.data.tables.models.Metrics :param minute_metrics: A summary of request statistics grouped by API in minute aggregates for tables. - :type minute_metrics: ~azure_table.models.Metrics + :type minute_metrics: ~azure.data.tables.models.Metrics :param cors: The set of CORS rules. - :type cors: list[~azure_table.models.CorsRule] + :type cors: list[~azure.data.tables.models.CorsRule] """ _attribute_map = { @@ -587,7 +638,7 @@ class TableServiceStats(msrest.serialization.Model): """Stats for the service. :param geo_replication: Geo-Replication information for the Secondary Storage Service. - :type geo_replication: ~azure_table.models.GeoReplication + :type geo_replication: ~azure.data.tables.models.GeoReplication """ _attribute_map = { diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/__init__.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/__init__.py index 1298fa41c6f8..774e1c0d97a4 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/__init__.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/__init__.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_service_operations.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_service_operations.py index be2f182e168a..1b68db654b48 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_service_operations.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_service_operations.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING @@ -26,7 +28,7 @@ class ServiceOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_table.models + :type models: ~azure.data.tables.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -49,10 +51,11 @@ def set_properties( **kwargs # type: Any ): # type: (...) -> None - """Sets properties for an account's Table service endpoint, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. + """Sets properties for an account's Table service endpoint, including properties for Analytics and + CORS (Cross-Origin Resource Sharing) rules. :param table_service_properties: The Table Service properties. - :type table_service_properties: ~azure_table.models.TableServiceProperties + :type table_service_properties: ~azure.data.tables.models.TableServiceProperties :param timeout: The timeout parameter is expressed in seconds. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -91,7 +94,6 @@ def set_properties( header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(table_service_properties, 'TableServiceProperties', is_xml=True) body_content_kwargs['content'] = body_content @@ -122,7 +124,8 @@ def get_properties( **kwargs # type: Any ): # type: (...) -> "models.TableServiceProperties" - """Gets the properties of an account's Table service, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules. + """Gets the properties of an account's Table service, including properties for Analytics and CORS + (Cross-Origin Resource Sharing) rules. :param timeout: The timeout parameter is expressed in seconds. :type timeout: int @@ -131,7 +134,7 @@ def get_properties( :type request_id_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: TableServiceProperties, or the result of cls(response) - :rtype: ~azure_table.models.TableServiceProperties + :rtype: ~azure.data.tables.models.TableServiceProperties :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TableServiceProperties"] @@ -161,7 +164,6 @@ def get_properties( header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') header_parameters['Accept'] = 'application/xml' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,7 +192,9 @@ def get_statistics( **kwargs # type: Any ): # type: (...) -> "models.TableServiceStats" - """Retrieves statistics related to replication for the Table service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the account. + """Retrieves statistics related to replication for the Table service. It is only available on the + secondary location endpoint when read-access geo-redundant replication is enabled for the + account. :param timeout: The timeout parameter is expressed in seconds. :type timeout: int @@ -199,7 +203,7 @@ def get_statistics( :type request_id_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: TableServiceStats, or the result of cls(response) - :rtype: ~azure_table.models.TableServiceStats + :rtype: ~azure.data.tables.models.TableServiceStats :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TableServiceStats"] @@ -229,7 +233,6 @@ def get_statistics( header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') header_parameters['Accept'] = 'application/xml' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_table_operations.py b/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_table_operations.py index 9686ea544832..69d4d70236be 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_table_operations.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_generated/operations/_table_operations.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator}) +# 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. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING @@ -26,7 +28,7 @@ class TableOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_table.models + :type models: ~azure.data.tables.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -57,10 +59,10 @@ def query( :param next_table_name: A table query continuation token from a previous call. :type next_table_name: str :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: TableQueryResponse, or the result of cls(response) - :rtype: ~azure_table.models.TableQueryResponse + :rtype: ~azure.data.tables.models.TableQueryResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TableQueryResponse"] @@ -106,14 +108,14 @@ def query( header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') header_parameters['Accept'] = 'application/json;odata=minimalmetadata' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **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) - raise HttpResponseError(response=response) + error = self._deserialize(models.TableServiceError, response) + 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')) @@ -137,25 +139,25 @@ def create( query_options=None, # type: Optional["models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> "models.TableResponse" + # type: (...) -> Optional["models.TableResponse"] """Creates a new table under the given account. :param table_properties: The Table properties. - :type table_properties: ~azure_table.models.TableProperties + :type table_properties: ~azure.data.tables.models.TableProperties :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when analytics logging is enabled. :type request_id_parameter: str :param response_preference: Specifies whether the response should include the inserted entity in the payload. Possible values are return-no-content and return-content. - :type response_preference: str or ~azure_table.models.ResponseFormat + :type response_preference: str or ~azure.data.tables.models.ResponseFormat :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: TableResponse, or the result of cls(response) - :rtype: ~azure_table.models.TableResponse or None + :rtype: ~azure.data.tables.models.TableResponse or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TableResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.TableResponse"]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) @@ -188,7 +190,6 @@ def create( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json;odata=minimalmetadata' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(table_properties, 'TableProperties') body_content_kwargs['content'] = body_content @@ -265,7 +266,6 @@ def delete( if request_id_parameter is not None: header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -311,10 +311,10 @@ def query_entities( :param next_row_key: An entity query continuation token from a previous call. :type next_row_key: str :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: TableEntityQueryResponse, or the result of cls(response) - :rtype: ~azure_table.models.TableEntityQueryResponse + :rtype: ~azure.data.tables.models.TableEntityQueryResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.TableEntityQueryResponse"] @@ -365,7 +365,6 @@ def query_entities( header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') header_parameters['Accept'] = 'application/json;odata=minimalmetadata' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -400,7 +399,7 @@ def query_entities_with_partition_and_row_key( query_options=None, # type: Optional["models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> "models.TableEntityQueryResponse" + # type: (...) -> Dict[str, object] """Queries entities in a table. :param table: The name of the table. @@ -415,13 +414,13 @@ def query_entities_with_partition_and_row_key( limit that is recorded in the analytics logs when analytics logging is enabled. :type request_id_parameter: str :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response - :return: TableEntityQueryResponse, or the result of cls(response) - :rtype: ~azure_table.models.TableEntityQueryResponse + :return: dict mapping str to object, or the result of cls(response) + :rtype: dict[str, object] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TableEntityQueryResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, object]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) @@ -463,7 +462,6 @@ def query_entities_with_partition_and_row_key( header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') header_parameters['Accept'] = 'application/json;odata=minimalmetadata' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -481,7 +479,7 @@ def query_entities_with_partition_and_row_key( response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) response_headers['x-ms-continuation-NextPartitionKey']=self._deserialize('str', response.headers.get('x-ms-continuation-NextPartitionKey')) response_headers['x-ms-continuation-NextRowKey']=self._deserialize('str', response.headers.get('x-ms-continuation-NextRowKey')) - deserialized = self._deserialize('TableEntityQueryResponse', pipeline_response) + deserialized = self._deserialize('{object}', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) @@ -523,7 +521,7 @@ def update_entity( :param table_entity_properties: The properties for the table entity. :type table_entity_properties: dict[str, object] :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -566,7 +564,6 @@ def update_entity( header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] if table_entity_properties is not None: body_content = self._serialize.body(table_entity_properties, '{object}') @@ -629,7 +626,7 @@ def merge_entity( :param table_entity_properties: The properties for the table entity. :type table_entity_properties: dict[str, object] :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -672,7 +669,6 @@ def merge_entity( header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] if table_entity_properties is not None: body_content = self._serialize.body(table_entity_properties, '{object}') @@ -731,7 +727,7 @@ def delete_entity( limit that is recorded in the analytics logs when analytics logging is enabled. :type request_id_parameter: str :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -771,7 +767,6 @@ def delete_entity( header_parameters['DataServiceVersion'] = self._serialize.header("data_service_version", data_service_version, 'str') header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -802,7 +797,7 @@ def insert_entity( query_options=None, # type: Optional["models.QueryOptions"] **kwargs # type: Any ): - # type: (...) -> Dict[str, object] + # type: (...) -> Optional[Dict[str, object]] """Insert entity in a table. :param table: The name of the table. @@ -814,17 +809,17 @@ def insert_entity( :type request_id_parameter: str :param response_preference: Specifies whether the response should include the inserted entity in the payload. Possible values are return-no-content and return-content. - :type response_preference: str or ~azure_table.models.ResponseFormat + :type response_preference: str or ~azure.data.tables.models.ResponseFormat :param table_entity_properties: The properties for the table entity. :type table_entity_properties: dict[str, object] :param query_options: Parameter group. - :type query_options: ~azure_table.models.QueryOptions + :type query_options: ~azure.data.tables.models.QueryOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: dict mapping str to object, or the result of cls(response) :rtype: dict[str, object] or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, object]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Dict[str, object]]] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) @@ -860,7 +855,6 @@ def insert_entity( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json;odata=minimalmetadata' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] if table_entity_properties is not None: body_content = self._serialize.body(table_entity_properties, '{object}') @@ -912,7 +906,8 @@ def get_access_policy( **kwargs # type: Any ): # type: (...) -> List["models.SignedIdentifier"] - """Retrieves details about any stored access policies specified on the table that may be used with Shared Access Signatures. + """Retrieves details about any stored access policies specified on the table that may be used with + Shared Access Signatures. :param table: The name of the table. :type table: str @@ -923,7 +918,7 @@ def get_access_policy( :type request_id_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier, or the result of cls(response) - :rtype: list[~azure_table.models.SignedIdentifier] + :rtype: list[~azure.data.tables.models.SignedIdentifier] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["models.SignedIdentifier"]] @@ -952,7 +947,6 @@ def get_access_policy( header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') header_parameters['Accept'] = 'application/xml' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -994,7 +988,7 @@ def set_access_policy( limit that is recorded in the analytics logs when analytics logging is enabled. :type request_id_parameter: str :param table_acl: The acls for the table. - :type table_acl: list[~azure_table.models.SignedIdentifier] + :type table_acl: list[~azure.data.tables.models.SignedIdentifier] :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1026,9 +1020,7 @@ def set_access_policy( if request_id_parameter is not None: header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/xml' - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'wrapped': True, 'itemsName': 'SignedIdentifier'}} if table_acl is not None: diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_sdk_moniker.py b/sdk/tables/azure-data-tables/azure/data/tables/_sdk_moniker.py new file mode 100644 index 000000000000..8a7571636b37 --- /dev/null +++ b/sdk/tables/azure-data-tables/azure/data/tables/_sdk_moniker.py @@ -0,0 +1,11 @@ +# 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. +# -------------------------------------------------------------------------- + +from ._version import VERSION + +SDK_MONIKER = "data-tables/{}".format(VERSION) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py index a8ee3a33c212..83eb4dba666a 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_client.py @@ -413,7 +413,8 @@ def get_entity( partition_key=partition_key, row_key=row_key, **kwargs) - properties = _convert_to_entity(entity.additional_properties) + + properties = _convert_to_entity(entity) return properties except HttpResponseError as error: _process_table_error(error) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py index 5adb7e22b7b6..49f2721ecc78 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py @@ -353,7 +353,8 @@ async def get_entity( partition_key=partition_key, row_key=row_key, **kwargs) - properties = _convert_to_entity(entity.additional_properties) + + properties = _convert_to_entity(entity) return properties except HttpResponseError as error: _process_table_error(error) diff --git a/sdk/tables/azure-data-tables/tests/test_table_client.py b/sdk/tables/azure-data-tables/tests/test_table_client.py index 34ba05da9fb6..ce110ce471a5 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_client.py +++ b/sdk/tables/azure-data-tables/tests/test_table_client.py @@ -443,7 +443,7 @@ def test_user_agent_custom(self, resource_group, location, storage_account, stor def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) self.assertIn( - "TestApp/v1.0 azsdk-python-storage-table/{} Python/{} ({})".format( + "TestApp/v1.0 azsdk-python-data-tables/{} Python/{} ({})".format( VERSION, platform.python_version(), platform.platform()), @@ -456,7 +456,7 @@ def callback(response): def callback(response): self.assertTrue('User-Agent' in response.http_request.headers) self.assertIn( - "TestApp/v2.0 TestApp/v1.0 azsdk-python-storage-table/{} Python/{} ({})".format( + "TestApp/v2.0 TestApp/v1.0 azsdk-python-data-tables/{} Python/{} ({})".format( VERSION, platform.python_version(), platform.platform()),