Skip to content

Commit a9ada09

Browse files
author
SDKAuto
committed
CodeGen from PR 34155 in Azure/azure-rest-api-specs
Merge 043e6e1b58ccc02bb2143244cb6fc7a5bfb1532b into 8a61513cdfbd4d218cfc121633f742db629b5af5
1 parent 7f659e6 commit a9ada09

File tree

10 files changed

+60
-49
lines changed

10 files changed

+60
-49
lines changed

sdk/portalservices/azure-mgmt-portalservicescopilot/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
### Other Changes
66

77
- Initial version
8+
9+
## 1.0.0b1 (2025-04-23)

sdk/portalservices/azure-mgmt-portalservicescopilot/README.md

Lines changed: 8 additions & 4 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 Portalservicescopilot 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
@@ -30,13 +30,17 @@ By default, [Azure Active Directory](https://aka.ms/awps/aad) token authenticati
3030
- `AZURE_TENANT_ID` for Azure tenant ID.
3131
- `AZURE_CLIENT_SECRET` for Azure client secret.
3232

33-
With the above configuration, the client can be authenticated using the following code:
33+
In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.
34+
35+
With above configuration, client can be authenticated by following code:
3436

3537
```python
3638
from azure.identity import DefaultAzureCredential
3739
from azure.mgmt.portalservicescopilot import PortalServicesCopilotMgmtClient
40+
import os
3841

39-
client = PortalServicesCopilotMgmtClient(credential=DefaultAzureCredential())
42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = PortalServicesCopilotMgmtClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
4044
```
4145

4246
## Examples
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"commit": "5b4d360e915c96af135f02d4eefddb5ede18bc91",
2+
"commit": "58b05d8532619faf17f403ddc70803f0821fcea7",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"typespec_src": "specification/portalservices/CopilotSettings.Management",
5-
"@azure-tools/typespec-python": "0.42.2"
5+
"@azure-tools/typespec-python": "0.43.0"
66
}

sdk/portalservices/azure-mgmt-portalservicescopilot/azure/mgmt/portalservicescopilot/_client.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
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 PortalServicesCopilotMgmtClientConfiguration
1921
from ._serialization import Deserializer, Serializer
@@ -33,19 +35,25 @@ class PortalServicesCopilotMgmtClient:
3335
azure.mgmt.portalservicescopilot.operations.CopilotSettingsOperations
3436
:param credential: Credential used to authenticate requests to the service. Required.
3537
:type credential: ~azure.core.credentials.TokenCredential
36-
:param base_url: Service host. Default value is "https://management.azure.com".
38+
:param base_url: Service host. Default value is None.
3739
:type base_url: str
3840
:keyword api_version: The API version to use for this operation. Default value is
3941
"2024-04-01-preview". Note that overriding this default value may result in unsupported
4042
behavior.
4143
:paramtype api_version: str
4244
"""
4345

44-
def __init__(
45-
self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
46-
) -> None:
46+
def __init__(self, credential: "TokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None:
4747
_endpoint = "{endpoint}"
48-
self._config = PortalServicesCopilotMgmtClientConfiguration(credential=credential, base_url=base_url, **kwargs)
48+
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
49+
_endpoints = get_arm_endpoints(_cloud)
50+
if not base_url:
51+
base_url = _endpoints["resource_manager"]
52+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
53+
self._config = PortalServicesCopilotMgmtClientConfiguration(
54+
credential=credential, base_url=cast(str, base_url), credential_scopes=credential_scopes, **kwargs
55+
)
56+
4957
_policies = kwargs.pop("policies", None)
5058
if _policies is None:
5159
_policies = [
@@ -64,7 +72,7 @@ def __init__(
6472
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
6573
self._config.http_logging_policy,
6674
]
67-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
75+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs)
6876

6977
self._serialize = Serializer()
7078
self._deserialize = Deserializer()

sdk/portalservices/azure-mgmt-portalservicescopilot/azure/mgmt/portalservicescopilot/_model_base.py

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/portalservices/azure-mgmt-portalservicescopilot/azure/mgmt/portalservicescopilot/aio/_client.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
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

1820
from .._serialization import Deserializer, Serializer
1921
from ._configuration import PortalServicesCopilotMgmtClientConfiguration
@@ -33,19 +35,25 @@ class PortalServicesCopilotMgmtClient:
3335
azure.mgmt.portalservicescopilot.aio.operations.CopilotSettingsOperations
3436
:param credential: Credential used to authenticate requests to the service. Required.
3537
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
36-
:param base_url: Service host. Default value is "https://management.azure.com".
38+
:param base_url: Service host. Default value is None.
3739
:type base_url: str
3840
:keyword api_version: The API version to use for this operation. Default value is
3941
"2024-04-01-preview". Note that overriding this default value may result in unsupported
4042
behavior.
4143
:paramtype api_version: str
4244
"""
4345

44-
def __init__(
45-
self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
46-
) -> None:
46+
def __init__(self, credential: "AsyncTokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None:
4747
_endpoint = "{endpoint}"
48-
self._config = PortalServicesCopilotMgmtClientConfiguration(credential=credential, base_url=base_url, **kwargs)
48+
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
49+
_endpoints = get_arm_endpoints(_cloud)
50+
if not base_url:
51+
base_url = _endpoints["resource_manager"]
52+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
53+
self._config = PortalServicesCopilotMgmtClientConfiguration(
54+
credential=credential, base_url=cast(str, base_url), credential_scopes=credential_scopes, **kwargs
55+
)
56+
4957
_policies = kwargs.pop("policies", None)
5058
if _policies is None:
5159
_policies = [
@@ -64,7 +72,9 @@ def __init__(
6472
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
6573
self._config.http_logging_policy,
6674
]
67-
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
75+
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(
76+
base_url=cast(str, _endpoint), policies=_policies, **kwargs
77+
)
6878

6979
self._serialize = Serializer()
7080
self._deserialize = Deserializer()

sdk/portalservices/azure-mgmt-portalservicescopilot/azure/mgmt/portalservicescopilot/aio/operations/_operations.py

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

@@ -42,13 +42,9 @@
4242
)
4343
from .._configuration import PortalServicesCopilotMgmtClientConfiguration
4444

45-
if sys.version_info >= (3, 9):
46-
from collections.abc import MutableMapping
47-
else:
48-
from typing import MutableMapping # type: ignore
4945
T = TypeVar("T")
5046
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
51-
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
47+
JSON = MutableMapping[str, Any]
5248

5349

5450
class Operations:

sdk/portalservices/azure-mgmt-portalservicescopilot/azure/mgmt/portalservicescopilot/operations/_operations.py

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

@@ -34,13 +34,9 @@
3434
from .._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize
3535
from .._serialization import Deserializer, Serializer
3636

37-
if sys.version_info >= (3, 9):
38-
from collections.abc import MutableMapping
39-
else:
40-
from typing import MutableMapping # type: ignore
4137
T = TypeVar("T")
4238
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
43-
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
39+
JSON = MutableMapping[str, Any]
4440

4541
_SERIALIZER = Serializer()
4642
_SERIALIZER.client_side_validation = False

sdk/portalservices/azure-mgmt-portalservicescopilot/setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"Programming Language :: Python",
5454
"Programming Language :: Python :: 3 :: Only",
5555
"Programming Language :: Python :: 3",
56-
"Programming Language :: Python :: 3.8",
5756
"Programming Language :: Python :: 3.9",
5857
"Programming Language :: Python :: 3.10",
5958
"Programming Language :: Python :: 3.11",
@@ -77,7 +76,7 @@
7776
"isodate>=0.6.1",
7877
"typing-extensions>=4.6.0",
7978
"azure-common>=1.1",
80-
"azure-mgmt-core>=1.3.2",
79+
"azure-mgmt-core>=1.5.0",
8180
],
82-
python_requires=">=3.8",
81+
python_requires=">=3.9",
8382
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
directory: specification/portalservices/CopilotSettings.Management
2-
commit: 5b4d360e915c96af135f02d4eefddb5ede18bc91
2+
commit: 58b05d8532619faf17f403ddc70803f0821fcea7
33
repo: Azure/azure-rest-api-specs
44
additionalDirectories:

0 commit comments

Comments
 (0)