Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate code from connie's swagger change #12979

Merged
merged 9 commits into from
Aug 14, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# --------------------------------------------------------------------------
import platform
import sys
from ._generated.version import VERSION
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we actually using the user-agent string below? This doesn't fit our format:
https://azure.github.io/azure-sdk/general_azurecore.html#telemetry-policy

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we've talked about this partially offline, @seankane-msft were you able to find out a way to not import this and set the x-ms-version on our side, and just rely on the generated code? I think this can also be addressed in a separate PR as long as there's an issue open for it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not yet, there is an issue out related with the versioning (#12411)

seankane-msft marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
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.table.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.table.operations.ServiceOperations
seankane-msft marked this conversation as resolved.
Show resolved Hide resolved
: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', 'table/{}'.format(VERSION))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this too, I think this should be data-tables/

Wondering if we need to regenerate with autorest and specify namespace like,
--namespace=azure.data.tables --package-name=azure-data-tables

@iscai-msft

Copy link
Contributor

@iscai-msft iscai-msft Aug 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kristapratico yeah the correct sdk moniker should be 'data-tables'. But we shouldn't need to regenerate, since we're overwriting the generated code's sdk moniker here. Instead, the code I linked should be changed to "data-tables".

@seankane-msft can you change this? We tend to keep the user agent in a separate file, that way you can import the constant from the file and use it. TA file example here, and for now, you can just import the user agent constant from that file and set sdk_moniker equal to that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated to user-agent, I think we still need to regen with azure-data-tables otherwise all generated code refs will be off

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah ended up agreeing with you after going through the whole SDK. I don't think it's 100% necessary since it's more for us, but do agree it would look a lot better

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kristapratico @iscai-msft I regenerated this, user-agent isn't used anywhere in this sdk, should I move it to it's own file or should I remove it entirely?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move it to its own file like how izzy linked above, it's more manageable that way. It looks like the current user-agent string is

azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)

and it should look like this:

azsdk-python-data-tables/{SDK version} Python/3.8.3 (Windows-10-10.0.19041-SP0)

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,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.table.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.table.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', 'table/{}'.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.table.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.table.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.table.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.table.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