Skip to content

Commit

Permalink
CodeGen from PR 24355 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Revert "[Hub Generated] Publish private branch 'azure-kusto/devCM' (Azure#24160)" (Azure#24355)

This reverts commit 3ee139274d100f1e14b443d359d21e1644e297f6.
  • Loading branch information
SDKAuto committed Jun 8, 2023
1 parent eef79fc commit dc44429
Show file tree
Hide file tree
Showing 53 changed files with 755 additions and 1,152 deletions.
6 changes: 3 additions & 3 deletions sdk/kusto/azure-mgmt-kusto/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "78ec1b99699a4bf44869bd13f1b0ed7d92a99c27",
"commit": "6c157d49894462320db6603bb8e7b3077861b2d7",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@6.2.16",
"@autorest/python@6.5.0",
"@autorest/modelerfour@4.24.3"
],
"autorest_command": "autorest specification/azure-kusto/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"autorest_command": "autorest specification/azure-kusto/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.5.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"readme": "specification/azure-kusto/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -15,11 +14,6 @@

from ._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
Expand All @@ -43,7 +37,7 @@ class KustoManagementClientConfiguration(Configuration): # pylint: disable=too-

def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(KustoManagementClientConfiguration, self).__init__(**kwargs)
api_version: Literal["2022-12-29"] = kwargs.pop("api_version", "2022-12-29")
api_version: str = kwargs.pop("api_version", "2022-12-29")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __init__(
self._config = KustoManagementClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
Expand Down Expand Up @@ -168,5 +168,5 @@ def __enter__(self) -> "KustoManagementClient":
self._client.__enter__()
return self

def __exit__(self, *exc_details) -> None:
def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)
6 changes: 3 additions & 3 deletions sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
if xml_desc.get("attr", False):
if xml_ns:
ET.register_namespace(xml_prefix, xml_ns)
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
serialized.set(xml_name, new_attr) # type: ignore
continue
if xml_desc.get("text", False):
Expand Down Expand Up @@ -1271,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type):
xml_name = internal_type_xml_map.get("name", internal_type.__name__)
xml_ns = internal_type_xml_map.get("ns", None)
if xml_ns:
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
return xml_name


Expand All @@ -1295,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data):
# Integrate namespace if necessary
xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None))
if xml_ns:
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)

# If it's an attribute, that's simple
if xml_desc.get("attr", False):
Expand Down
2 changes: 1 addition & 1 deletion sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "3.1.0"
VERSION = "2.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -15,11 +14,6 @@

from .._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
Expand All @@ -43,7 +37,7 @@ class KustoManagementClientConfiguration(Configuration): # pylint: disable=too-

def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(KustoManagementClientConfiguration, self).__init__(**kwargs)
api_version: Literal["2022-12-29"] = kwargs.pop("api_version", "2022-12-29")
api_version: str = kwargs.pop("api_version", "2022-12-29")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __init__(
self._config = KustoManagementClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
Expand Down Expand Up @@ -168,5 +168,5 @@ async def __aenter__(self) -> "KustoManagementClient":
await self._client.__aenter__()
return self

async def __aexit__(self, *exc_details) -> None:
async def __aexit__(self, *exc_details: Any) -> None:
await self._client.__aexit__(*exc_details)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse

Expand Down Expand Up @@ -39,10 +39,6 @@
build_list_by_cluster_request,
)

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

Expand Down Expand Up @@ -140,7 +136,8 @@ async def check_name_availability(
:type resource_group_name: str
:param cluster_name: The name of the Kusto cluster. Required.
:type cluster_name: str
:param resource_name: The name of the resource. Is either a model type or a IO type. Required.
:param resource_name: The name of the resource. Is either a
AttachedDatabaseConfigurationsCheckNameRequest type or a IO type. Required.
:type resource_name: ~azure.mgmt.kusto.models.AttachedDatabaseConfigurationsCheckNameRequest or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Expand All @@ -162,16 +159,14 @@ async def check_name_availability(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: Literal["2022-12-29"] = kwargs.pop(
"api_version", _params.pop("api-version", self._config.api_version)
)
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CheckNameResult] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(resource_name, (IO, bytes)):
if isinstance(resource_name, (IOBase, bytes)):
_content = resource_name
else:
_json = self._serialize.body(resource_name, "AttachedDatabaseConfigurationsCheckNameRequest")
Expand All @@ -191,8 +186,9 @@ async def check_name_availability(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response
Expand Down Expand Up @@ -233,9 +229,7 @@ def list_by_cluster(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: Literal["2022-12-29"] = kwargs.pop(
"api_version", _params.pop("api-version", self._config.api_version)
)
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AttachedDatabaseConfigurationListResult] = kwargs.pop("cls", None)

error_map = {
Expand Down Expand Up @@ -289,8 +283,9 @@ async def extract_data(pipeline_response):
async def get_next(next_link=None):
request = prepare_request(next_link)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response

Expand Down Expand Up @@ -336,9 +331,7 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: Literal["2022-12-29"] = kwargs.pop(
"api_version", _params.pop("api-version", self._config.api_version)
)
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AttachedDatabaseConfiguration] = kwargs.pop("cls", None)

request = build_get_request(
Expand All @@ -354,8 +347,9 @@ async def get(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response
Expand Down Expand Up @@ -394,16 +388,14 @@ async def _create_or_update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: Literal["2022-12-29"] = kwargs.pop(
"api_version", _params.pop("api-version", self._config.api_version)
)
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.AttachedDatabaseConfiguration] = kwargs.pop("cls", None)

content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(parameters, (IO, bytes)):
if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AttachedDatabaseConfiguration")
Expand All @@ -424,8 +416,9 @@ async def _create_or_update_initial(
request = _convert_request(request)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response
Expand Down Expand Up @@ -554,7 +547,7 @@ async def begin_create_or_update(
Required.
:type attached_database_configuration_name: str
:param parameters: The database parameters supplied to the CreateOrUpdate operation. Is either
a model type or a IO type. Required.
a AttachedDatabaseConfiguration type or a IO type. Required.
:type parameters: ~azure.mgmt.kusto.models.AttachedDatabaseConfiguration or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
Expand All @@ -576,9 +569,7 @@ async def begin_create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: Literal["2022-12-29"] = kwargs.pop(
"api_version", _params.pop("api-version", self._config.api_version)
)
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.AttachedDatabaseConfiguration] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
Expand Down Expand Up @@ -638,9 +629,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: Literal["2022-12-29"] = kwargs.pop(
"api_version", _params.pop("api-version", self._config.api_version)
)
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)

request = build_delete_request(
Expand All @@ -656,8 +645,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
request = _convert_request(request)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response
Expand Down Expand Up @@ -702,9 +692,7 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: Literal["2022-12-29"] = kwargs.pop(
"api_version", _params.pop("api-version", self._config.api_version)
)
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
Expand Down
Loading

0 comments on commit dc44429

Please sign in to comment.