Skip to content

Commit

Permalink
Regenerate code from connie's swagger change (#12979)
Browse files Browse the repository at this point in the history
* regenerated new code

* updated get_entity method for new generated code

* pylint updates

* removed unneeded constant

* updating the _generated code to have namespace azure.data.tables

* fixed another linting error

* added user_agent string

* Forgot to add the new file, adding sdk moniker

* removed an unused import
  • Loading branch information
seankane-msft authored Aug 14, 2020
1 parent 9138465 commit 18c5bb2
Show file tree
Hide file tree
Showing 23 changed files with 358 additions and 223 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -389,8 +389,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)
Expand Down
9 changes: 1 addition & 8 deletions sdk/tables/azure-data-tables/azure/data/tables/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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.
# --------------------------------------------------------------------------

Expand All @@ -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__(
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
# --------------------------------------------------------------------------

Expand All @@ -9,19 +11,20 @@
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.
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
"""

Expand All @@ -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(
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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']
Original file line number Diff line number Diff line change
@@ -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.
# --------------------------------------------------------------------------

Expand All @@ -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__(
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
# --------------------------------------------------------------------------

Expand All @@ -9,15 +11,16 @@
from azure.core.configuration import Configuration
from azure.core.pipeline import policies

VERSION = "unknown"
from .._version import VERSION


class AzureTableConfiguration(Configuration):
"""Configuration for AzureTable.
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
"""

Expand All @@ -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(
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
# --------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"]
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 18c5bb2

Please sign in to comment.