Skip to content

Commit c169dae

Browse files
author
SDKAuto
committed
CodeGen from PR 33826 in Azure/azure-rest-api-specs
Merge 1f0b86e46eb04220d15b7c62d0891d9d12b67fff into 908f30f83295f8afe862310153344468510e3b88
1 parent 1310d7e commit c169dae

File tree

12 files changed

+70
-53
lines changed

12 files changed

+70
-53
lines changed

sdk/neonpostgres/azure-mgmt-neonpostgres/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 Neonpostgres 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": "917ba27f78348899fba4cafb37fcf018f1987a8e",
2+
"commit": "aba277781380092d0a72c1f58f1d89d39af64066",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"typespec_src": "specification/liftrneon/Neon.Postgres.Management",
5-
"@azure-tools/typespec-python": "0.42.2"
5+
"@azure-tools/typespec-python": "0.43.0"
66
}

sdk/neonpostgres/azure-mgmt-neonpostgres/azure/mgmt/neonpostgres/_client.py

Lines changed: 17 additions & 9 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 NeonPostgresMgmtClientConfiguration
1921
from ._serialization import Deserializer, Serializer
@@ -58,7 +60,7 @@ class NeonPostgresMgmtClient: # pylint: disable=too-many-instance-attributes
5860
:type credential: ~azure.core.credentials.TokenCredential
5961
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
6062
:type subscription_id: str
61-
:param base_url: Service host. Default value is "https://management.azure.com".
63+
:param base_url: Service host. Default value is None.
6264
:type base_url: str
6365
:keyword api_version: The API version to use for this operation. Default value is "2025-03-01".
6466
Note that overriding this default value may result in unsupported behavior.
@@ -68,16 +70,22 @@ class NeonPostgresMgmtClient: # pylint: disable=too-many-instance-attributes
6870
"""
6971

7072
def __init__(
71-
self,
72-
credential: "TokenCredential",
73-
subscription_id: str,
74-
base_url: str = "https://management.azure.com",
75-
**kwargs: Any
73+
self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
7674
) -> None:
7775
_endpoint = "{endpoint}"
76+
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
77+
_endpoints = get_arm_endpoints(_cloud)
78+
if not base_url:
79+
base_url = _endpoints["resource_manager"]
80+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
7881
self._config = NeonPostgresMgmtClientConfiguration(
79-
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
82+
credential=credential,
83+
subscription_id=subscription_id,
84+
base_url=cast(str, base_url),
85+
credential_scopes=credential_scopes,
86+
**kwargs
8087
)
88+
8189
_policies = kwargs.pop("policies", None)
8290
if _policies is None:
8391
_policies = [
@@ -96,7 +104,7 @@ def __init__(
96104
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
97105
self._config.http_logging_policy,
98106
]
99-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
107+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs)
100108

101109
self._serialize = Serializer()
102110
self._deserialize = Deserializer()

sdk/neonpostgres/azure-mgmt-neonpostgres/azure/mgmt/neonpostgres/_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/neonpostgres/azure-mgmt-neonpostgres/azure/mgmt/neonpostgres/_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/neonpostgres/azure-mgmt-neonpostgres/azure/mgmt/neonpostgres/aio/_client.py

Lines changed: 19 additions & 9 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 NeonPostgresMgmtClientConfiguration
@@ -58,7 +60,7 @@ class NeonPostgresMgmtClient: # pylint: disable=too-many-instance-attributes
5860
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
5961
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
6062
:type subscription_id: str
61-
:param base_url: Service host. Default value is "https://management.azure.com".
63+
:param base_url: Service host. Default value is None.
6264
:type base_url: str
6365
:keyword api_version: The API version to use for this operation. Default value is "2025-03-01".
6466
Note that overriding this default value may result in unsupported behavior.
@@ -68,16 +70,22 @@ class NeonPostgresMgmtClient: # pylint: disable=too-many-instance-attributes
6870
"""
6971

7072
def __init__(
71-
self,
72-
credential: "AsyncTokenCredential",
73-
subscription_id: str,
74-
base_url: str = "https://management.azure.com",
75-
**kwargs: Any
73+
self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
7674
) -> None:
7775
_endpoint = "{endpoint}"
76+
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
77+
_endpoints = get_arm_endpoints(_cloud)
78+
if not base_url:
79+
base_url = _endpoints["resource_manager"]
80+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
7881
self._config = NeonPostgresMgmtClientConfiguration(
79-
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
82+
credential=credential,
83+
subscription_id=subscription_id,
84+
base_url=cast(str, base_url),
85+
credential_scopes=credential_scopes,
86+
**kwargs
8087
)
88+
8189
_policies = kwargs.pop("policies", None)
8290
if _policies is None:
8391
_policies = [
@@ -96,7 +104,9 @@ def __init__(
96104
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
97105
self._config.http_logging_policy,
98106
]
99-
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
107+
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(
108+
base_url=cast(str, _endpoint), policies=_policies, **kwargs
109+
)
100110

101111
self._serialize = Serializer()
102112
self._deserialize = Deserializer()

sdk/neonpostgres/azure-mgmt-neonpostgres/azure/mgmt/neonpostgres/aio/operations/_operations.py

Lines changed: 2 additions & 6 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

@@ -80,13 +80,9 @@
8080
)
8181
from .._configuration import NeonPostgresMgmtClientConfiguration
8282

83-
if sys.version_info >= (3, 9):
84-
from collections.abc import MutableMapping
85-
else:
86-
from typing import MutableMapping # type: ignore
8783
T = TypeVar("T")
8884
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
89-
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
85+
JSON = MutableMapping[str, Any]
9086

9187

9288
class ModelsOperations:

sdk/neonpostgres/azure-mgmt-neonpostgres/azure/mgmt/neonpostgres/models/_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ class OrganizationProperties(_model_base.Model):
11141114
"""
11151115

11161116
marketplace_details: "_models.MarketplaceDetails" = rest_field(
1117-
name="marketplaceDetails", visibility=["read", "create"]
1117+
name="marketplaceDetails", visibility=["read", "create", "update"]
11181118
)
11191119
"""Marketplace details of the resource. Required."""
11201120
user_details: "_models.UserDetails" = rest_field(

sdk/neonpostgres/azure-mgmt-neonpostgres/azure/mgmt/neonpostgres/operations/_operations.py

Lines changed: 2 additions & 6 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, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload
1313
import urllib.parse
1414

@@ -38,13 +38,9 @@
3838
from .._serialization import Deserializer, Serializer
3939
from .._validation import api_version_validation
4040

41-
if sys.version_info >= (3, 9):
42-
from collections.abc import MutableMapping
43-
else:
44-
from typing import MutableMapping # type: ignore
4541
T = TypeVar("T")
4642
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
47-
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
43+
JSON = MutableMapping[str, Any]
4844

4945
_SERIALIZER = Serializer()
5046
_SERIALIZER.client_side_validation = False

sdk/neonpostgres/azure-mgmt-neonpostgres/generated_samples/organizations_update_maximum_set_gen.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ def main():
4343
"numberOfEmployees": 12,
4444
"officeAddress": "icirtoqmmozijk",
4545
},
46+
"marketplaceDetails": {
47+
"offerDetails": {
48+
"offerId": "bunyeeupoedueofwrzej",
49+
"planId": "nlbfiwtslenfwek",
50+
"planName": "ljbmgpkfqklaufacbpml",
51+
"publisherId": "hporaxnopmolttlnkbarw",
52+
"termId": "aedlchikwqckuploswthvshe",
53+
"termUnit": "qbcq",
54+
},
55+
"subscriptionId": "yxmkfivp",
56+
"subscriptionStatus": "PendingFulfillmentStart",
57+
},
4658
"partnerOrganizationProperties": {
4759
"organizationId": "fynmpcbivqkwqdfhrmsyusjd",
4860
"organizationName": "entity-name",

0 commit comments

Comments
 (0)