Skip to content

Commit 937eb13

Browse files
author
SDKAuto
committed
CodeGen from PR 33826 in Azure/azure-rest-api-specs
Merge 0244a809d0e455ed5d00dea143355375e055c4b0 into 121c5e84647a9cdb1767d5146affdfe2af91d776
1 parent cca51a6 commit 937eb13

18 files changed

+227
-179
lines changed

sdk/workloads/azure-mgmt-workloadssapvirtualinstance/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Workloadssapvirtualinstance Management Client Library.
4-
This package has been tested with Python 3.8+.
4+
This package has been tested with Python 3.9+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
@@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313
### Prerequisites
1414

15-
- Python 3.8+ is required to use this package.
15+
- Python 3.9+ is required to use this package.
1616
- [Azure subscription](https://azure.microsoft.com/free/)
1717

1818
### Install the package
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"commit": "0d182673b42de227bc01c0e4f04932b6c074f5ce",
2+
"commit": "06be6f9b50e7f2b08822a0409c8402ec37c64544",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"typespec_src": "specification/workloads/Workloads.SAPVirtualInstance.Management",
5-
"@azure-tools/typespec-python": "0.42.2"
5+
"@azure-tools/typespec-python": "0.44.1"
66
}

sdk/workloads/azure-mgmt-workloadssapvirtualinstance/apiview-properties.json

Lines changed: 68 additions & 34 deletions
Large diffs are not rendered by default.

sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_client.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
10-
from typing import Any, TYPE_CHECKING
10+
from typing import Any, Optional, TYPE_CHECKING, cast
1111
from typing_extensions import Self
1212

1313
from azure.core.pipeline import policies
1414
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.core.settings import settings
1516
from azure.mgmt.core import ARMPipelineClient
1617
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
18+
from azure.mgmt.core.tools import get_arm_endpoints
1719

1820
from ._configuration import WorkloadsSapVirtualInstanceMgmtClientConfiguration
19-
from ._serialization import Deserializer, Serializer
21+
from ._utils.serialization import Deserializer, Serializer
2022
from .operations import (
2123
Operations,
2224
SAPApplicationServerInstancesOperations,
@@ -50,7 +52,7 @@ class WorkloadsSapVirtualInstanceMgmtClient:
5052
:type credential: ~azure.core.credentials.TokenCredential
5153
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
5254
:type subscription_id: str
53-
:param base_url: Service host. Default value is "https://management.azure.com".
55+
:param base_url: Service host. Default value is None.
5456
:type base_url: str
5557
:keyword api_version: The API version to use for this operation. Default value is "2024-09-01".
5658
Note that overriding this default value may result in unsupported behavior.
@@ -60,16 +62,22 @@ class WorkloadsSapVirtualInstanceMgmtClient:
6062
"""
6163

6264
def __init__(
63-
self,
64-
credential: "TokenCredential",
65-
subscription_id: str,
66-
base_url: str = "https://management.azure.com",
67-
**kwargs: Any
65+
self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
6866
) -> None:
6967
_endpoint = "{endpoint}"
68+
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
69+
_endpoints = get_arm_endpoints(_cloud)
70+
if not base_url:
71+
base_url = _endpoints["resource_manager"]
72+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
7073
self._config = WorkloadsSapVirtualInstanceMgmtClientConfiguration(
71-
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
74+
credential=credential,
75+
subscription_id=subscription_id,
76+
base_url=cast(str, base_url),
77+
credential_scopes=credential_scopes,
78+
**kwargs
7279
)
80+
7381
_policies = kwargs.pop("policies", None)
7482
if _policies is None:
7583
_policies = [
@@ -88,7 +96,7 @@ def __init__(
8896
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
8997
self._config.http_logging_policy,
9098
]
91-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
99+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs)
92100

93101
self._serialize = Serializer()
94102
self._deserialize = Deserializer()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# Code generated by Microsoft (R) Python Code Generator.
5+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
6+
# --------------------------------------------------------------------------
Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,14 @@
2222
from datetime import datetime, date, time, timedelta, timezone
2323
from json import JSONEncoder
2424
import xml.etree.ElementTree as ET
25+
from collections.abc import MutableMapping
2526
from typing_extensions import Self
2627
import isodate
2728
from azure.core.exceptions import DeserializationError
2829
from azure.core import CaseInsensitiveEnumMeta
2930
from azure.core.pipeline import PipelineResponse
3031
from azure.core.serialization import _Null
3132

32-
if sys.version_info >= (3, 9):
33-
from collections.abc import MutableMapping
34-
else:
35-
from typing import MutableMapping
36-
3733
_LOGGER = logging.getLogger(__name__)
3834

3935
__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"]
@@ -348,7 +344,7 @@ def _get_model(module_name: str, model_name: str):
348344
_UNSET = object()
349345

350346

351-
class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object
347+
class _MyMutableMapping(MutableMapping[str, typing.Any]):
352348
def __init__(self, data: typing.Dict[str, typing.Any]) -> None:
353349
self._data = data
354350

@@ -408,13 +404,13 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any:
408404
return default
409405

410406
@typing.overload
411-
def pop(self, key: str) -> typing.Any: ...
407+
def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ
412408

413409
@typing.overload
414-
def pop(self, key: str, default: _T) -> _T: ...
410+
def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs
415411

416412
@typing.overload
417-
def pop(self, key: str, default: typing.Any) -> typing.Any: ...
413+
def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs
418414

419415
def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
420416
"""
@@ -444,7 +440,7 @@ def clear(self) -> None:
444440
"""
445441
self._data.clear()
446442

447-
def update(self, *args: typing.Any, **kwargs: typing.Any) -> None:
443+
def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ
448444
"""
449445
Updates D from mapping/iterable E and F.
450446
:param any args: Either a mapping object or an iterable of key-value pairs.
@@ -455,7 +451,7 @@ def update(self, *args: typing.Any, **kwargs: typing.Any) -> None:
455451
def setdefault(self, key: str, default: None = None) -> None: ...
456452

457453
@typing.overload
458-
def setdefault(self, key: str, default: typing.Any) -> typing.Any: ...
454+
def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs
459455

460456
def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
461457
"""
@@ -645,7 +641,7 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self:
645641
cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items())
646642
cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}")
647643

648-
return super().__new__(cls) # pylint: disable=no-value-for-parameter
644+
return super().__new__(cls)
649645

650646
def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None:
651647
for base in cls.__bases__:
@@ -681,7 +677,7 @@ def _deserialize(cls, data, exist_discriminators):
681677
discriminator_value = data.find(xml_name).text # pyright: ignore
682678
else:
683679
discriminator_value = data.get(discriminator._rest_name)
684-
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore
680+
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member
685681
return mapped_cls._deserialize(data, exist_discriminators)
686682

687683
def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]:

sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "1.0.0"
9+
VERSION = "1.0.0b1"

sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_client.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
10-
from typing import Any, Awaitable, TYPE_CHECKING
10+
from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast
1111
from typing_extensions import Self
1212

1313
from azure.core.pipeline import policies
1414
from azure.core.rest import AsyncHttpResponse, HttpRequest
15+
from azure.core.settings import settings
1516
from azure.mgmt.core import AsyncARMPipelineClient
1617
from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
18+
from azure.mgmt.core.tools import get_arm_endpoints
1719

18-
from .._serialization import Deserializer, Serializer
20+
from .._utils.serialization import Deserializer, Serializer
1921
from ._configuration import WorkloadsSapVirtualInstanceMgmtClientConfiguration
2022
from .operations import (
2123
Operations,
@@ -50,7 +52,7 @@ class WorkloadsSapVirtualInstanceMgmtClient:
5052
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
5153
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
5254
:type subscription_id: str
53-
:param base_url: Service host. Default value is "https://management.azure.com".
55+
:param base_url: Service host. Default value is None.
5456
:type base_url: str
5557
:keyword api_version: The API version to use for this operation. Default value is "2024-09-01".
5658
Note that overriding this default value may result in unsupported behavior.
@@ -60,16 +62,22 @@ class WorkloadsSapVirtualInstanceMgmtClient:
6062
"""
6163

6264
def __init__(
63-
self,
64-
credential: "AsyncTokenCredential",
65-
subscription_id: str,
66-
base_url: str = "https://management.azure.com",
67-
**kwargs: Any
65+
self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
6866
) -> None:
6967
_endpoint = "{endpoint}"
68+
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
69+
_endpoints = get_arm_endpoints(_cloud)
70+
if not base_url:
71+
base_url = _endpoints["resource_manager"]
72+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
7073
self._config = WorkloadsSapVirtualInstanceMgmtClientConfiguration(
71-
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
74+
credential=credential,
75+
subscription_id=subscription_id,
76+
base_url=cast(str, base_url),
77+
credential_scopes=credential_scopes,
78+
**kwargs
7279
)
80+
7381
_policies = kwargs.pop("policies", None)
7482
if _policies is None:
7583
_policies = [
@@ -88,7 +96,9 @@ def __init__(
8896
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
8997
self._config.http_logging_policy,
9098
]
91-
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
99+
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(
100+
base_url=cast(str, _endpoint), policies=_policies, **kwargs
101+
)
92102

93103
self._serialize = Serializer()
94104
self._deserialize = Deserializer()

sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_operations.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# Code generated by Microsoft (R) Python Code Generator.
77
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
88
# --------------------------------------------------------------------------
9+
from collections.abc import MutableMapping
910
from io import IOBase
1011
import json
11-
import sys
1212
from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload
1313
import urllib.parse
1414

@@ -34,8 +34,8 @@
3434
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
3535

3636
from ... import models as _models
37-
from ..._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize
38-
from ..._serialization import Deserializer, Serializer
37+
from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize
38+
from ..._utils.serialization import Deserializer, Serializer
3939
from ...operations._operations import (
4040
build_operations_list_request,
4141
build_sap_application_server_instances_create_request,
@@ -74,13 +74,9 @@
7474
)
7575
from .._configuration import WorkloadsSapVirtualInstanceMgmtClientConfiguration
7676

77-
if sys.version_info >= (3, 9):
78-
from collections.abc import MutableMapping
79-
else:
80-
from typing import MutableMapping # type: ignore
8177
T = TypeVar("T")
8278
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
83-
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
79+
JSON = MutableMapping[str, Any]
8480

8581

8682
class Operations:

0 commit comments

Comments
 (0)