Skip to content

Commit d56fbb9

Browse files
author
SDKAuto
committed
CodeGen from PR 33346 in Azure/azure-rest-api-specs
Merge ccee499de1cee05584e18fd327f83a3bde43cb83 into cccd214128449efff36c3a73b7275c72f0e63d0a
1 parent 7656cf2 commit d56fbb9

39 files changed

+5326
-3705
lines changed
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"commit": "8bf9ff0986adb3b37755d8b0a0dfab93906d2eab",
2+
"commit": "5b9253e8d55c3ac796d67377ca1ee95ca8f46b79",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.7",
5-
"use": [
6-
"@autorest/[email protected]",
7-
"@autorest/[email protected]"
8-
],
9-
"autorest_command": "autorest specification/liftrastronomer/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/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
10-
"readme": "specification/liftrastronomer/resource-manager/readme.md"
4+
"typespec_src": "specification/liftrastronomer/Astronomer.Astro.Management",
5+
"@azure-tools/typespec-python": "0.40.0"
116
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"CrossLanguagePackageId": "Astronomer.Astro",
3+
"CrossLanguageDefinitionId": {
4+
"azure.mgmt.astro.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo",
5+
"azure.mgmt.astro.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail",
6+
"azure.mgmt.astro.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse",
7+
"azure.mgmt.astro.models.ManagedServiceIdentityV4": "Azure.ResourceManager.Legacy.ManagedServiceIdentityV4",
8+
"azure.mgmt.astro.models.MarketplaceDetails": "LiftrBase.MarketplaceDetails",
9+
"azure.mgmt.astro.models.OfferDetails": "LiftrBase.OfferDetails",
10+
"azure.mgmt.astro.models.Operation": "Azure.ResourceManager.CommonTypes.Operation",
11+
"azure.mgmt.astro.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay",
12+
"azure.mgmt.astro.models.OrganizationProperties": "LiftrBase.Data.OrganizationProperties",
13+
"azure.mgmt.astro.models.Resource": "Azure.ResourceManager.CommonTypes.Resource",
14+
"azure.mgmt.astro.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource",
15+
"azure.mgmt.astro.models.OrganizationResource": "Astronomer.Astro.OrganizationResource",
16+
"azure.mgmt.astro.models.OrganizationResourceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel",
17+
"azure.mgmt.astro.models.OrganizationResourceUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties",
18+
"azure.mgmt.astro.models.PartnerOrganizationProperties": "LiftrBase.Data.PartnerOrganizationProperties",
19+
"azure.mgmt.astro.models.SingleSignOnProperties": "LiftrBase.SingleSignOnProperties",
20+
"azure.mgmt.astro.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData",
21+
"azure.mgmt.astro.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity",
22+
"azure.mgmt.astro.models.UserDetails": "LiftrBase.UserDetails",
23+
"azure.mgmt.astro.models.Origin": "Azure.ResourceManager.CommonTypes.Origin",
24+
"azure.mgmt.astro.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType",
25+
"azure.mgmt.astro.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType",
26+
"azure.mgmt.astro.models.MarketplaceSubscriptionStatus": "LiftrBase.MarketplaceSubscriptionStatus",
27+
"azure.mgmt.astro.models.RenewalMode": "LiftrBase.RenewalMode",
28+
"azure.mgmt.astro.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState",
29+
"azure.mgmt.astro.models.SingleSignOnStates": "LiftrBase.SingleSignOnStates",
30+
"azure.mgmt.astro.models.ManagedServiceIdentityType": "Azure.ResourceManager.Legacy.ManagedServiceIdentityType",
31+
"azure.mgmt.astro.AstroMgmtClient.operations.list": "Azure.ResourceManager.Operations.list",
32+
"azure.mgmt.astro.AstroMgmtClient.organizations.get": "Astronomer.Astro.Organizations.get",
33+
"azure.mgmt.astro.AstroMgmtClient.organizations.begin_create_or_update": "Astronomer.Astro.Organizations.createOrUpdate",
34+
"azure.mgmt.astro.AstroMgmtClient.organizations.begin_update": "Astronomer.Astro.Organizations.update",
35+
"azure.mgmt.astro.AstroMgmtClient.organizations.begin_delete": "Astronomer.Astro.Organizations.delete",
36+
"azure.mgmt.astro.AstroMgmtClient.organizations.list_by_resource_group": "Astronomer.Astro.Organizations.listByResourceGroup",
37+
"azure.mgmt.astro.AstroMgmtClient.organizations.list_by_subscription": "Astronomer.Astro.Organizations.listBySubscription"
38+
}
39+
}

sdk/astro/azure-mgmt-astro/azure/mgmt/astro/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,31 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# 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+
# pylint: disable=wrong-import-position
89

9-
from ._astro_mgmt_client import AstroMgmtClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import AstroMgmtClient # type: ignore
1016
from ._version import VERSION
1117

1218
__version__ = VERSION
1319

1420
try:
1521
from ._patch import __all__ as _patch_all
16-
from ._patch import * # pylint: disable=unused-wildcard-import
22+
from ._patch import *
1723
except ImportError:
1824
_patch_all = []
1925
from ._patch import patch_sdk as _patch_sdk
2026

2127
__all__ = [
2228
"AstroMgmtClient",
2329
]
24-
__all__.extend([p for p in _patch_all if p not in __all__])
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2531

2632
_patch_sdk()

sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_astro_mgmt_client.py renamed to sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_client.py

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,42 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
1112

13+
from azure.core.pipeline import policies
1214
from azure.core.rest import HttpRequest, HttpResponse
1315
from azure.mgmt.core import ARMPipelineClient
16+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1417

15-
from . import models as _models
1618
from ._configuration import AstroMgmtClientConfiguration
1719
from ._serialization import Deserializer, Serializer
1820
from .operations import Operations, OrganizationsOperations
1921

2022
if TYPE_CHECKING:
21-
# pylint: disable=unused-import,ungrouped-imports
2223
from azure.core.credentials import TokenCredential
2324

2425

25-
class AstroMgmtClient: # pylint: disable=client-accepts-api-version-keyword
26+
class AstroMgmtClient:
2627
"""AstroMgmtClient.
2728
2829
:ivar operations: Operations operations
2930
:vartype operations: azure.mgmt.astro.operations.Operations
3031
:ivar organizations: OrganizationsOperations operations
3132
:vartype organizations: azure.mgmt.astro.operations.OrganizationsOperations
32-
:param credential: Credential needed for the client to connect to Azure. Required.
33+
:param credential: Credential used to authenticate requests to the service. Required.
3334
:type credential: ~azure.core.credentials.TokenCredential
34-
:param subscription_id: The ID of the target subscription. Required.
35+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3536
:type subscription_id: str
36-
:param base_url: Service URL. Default value is "https://management.azure.com".
37+
:param base_url: Service host. Default value is "https://management.azure.com".
3738
:type base_url: str
38-
:keyword api_version: Api Version. Default value is "2023-08-01". Note that overriding this
39-
default value may result in unsupported behavior.
39+
:keyword api_version: The API version to use for this operation. Default value is "2024-08-27".
40+
Note that overriding this default value may result in unsupported behavior.
4041
:paramtype api_version: str
4142
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4243
Retry-After header is present.
@@ -49,23 +50,43 @@ def __init__(
4950
base_url: str = "https://management.azure.com",
5051
**kwargs: Any
5152
) -> None:
52-
self._config = AstroMgmtClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
53-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
54-
55-
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
56-
self._serialize = Serializer(client_models)
57-
self._deserialize = Deserializer(client_models)
53+
_endpoint = "{endpoint}"
54+
self._config = AstroMgmtClientConfiguration(
55+
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
56+
)
57+
_policies = kwargs.pop("policies", None)
58+
if _policies is None:
59+
_policies = [
60+
policies.RequestIdPolicy(**kwargs),
61+
self._config.headers_policy,
62+
self._config.user_agent_policy,
63+
self._config.proxy_policy,
64+
policies.ContentDecodePolicy(**kwargs),
65+
ARMAutoResourceProviderRegistrationPolicy(),
66+
self._config.redirect_policy,
67+
self._config.retry_policy,
68+
self._config.authentication_policy,
69+
self._config.custom_hook_policy,
70+
self._config.logging_policy,
71+
policies.DistributedTracingPolicy(**kwargs),
72+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
73+
self._config.http_logging_policy,
74+
]
75+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
76+
77+
self._serialize = Serializer()
78+
self._deserialize = Deserializer()
5879
self._serialize.client_side_validation = False
5980
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
6081
self.organizations = OrganizationsOperations(self._client, self._config, self._serialize, self._deserialize)
6182

62-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
83+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
6384
"""Runs the network request through the client's chained policies.
6485
6586
>>> from azure.core.rest import HttpRequest
6687
>>> request = HttpRequest("GET", "https://www.example.org/")
6788
<HttpRequest [GET], url: 'https://www.example.org/'>
68-
>>> response = client._send_request(request)
89+
>>> response = client.send_request(request)
6990
<HttpResponse: 200 OK>
7091
7192
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -78,13 +99,17 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
7899
"""
79100

80101
request_copy = deepcopy(request)
81-
request_copy.url = self._client.format_url(request_copy.url)
82-
return self._client.send_request(request_copy, **kwargs)
102+
path_format_arguments = {
103+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
104+
}
105+
106+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
107+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
83108

84109
def close(self) -> None:
85110
self._client.close()
86111

87-
def __enter__(self) -> "AstroMgmtClient":
112+
def __enter__(self) -> Self:
88113
self._client.__enter__()
89114
return self
90115

sdk/astro/azure-mgmt-astro/azure/mgmt/astro/_configuration.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,46 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

99
from typing import Any, TYPE_CHECKING
1010

11-
from azure.core.configuration import Configuration
1211
from azure.core.pipeline import policies
1312
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1413

1514
from ._version import VERSION
1615

1716
if TYPE_CHECKING:
18-
# pylint: disable=unused-import,ungrouped-imports
1917
from azure.core.credentials import TokenCredential
2018

2119

22-
class AstroMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
20+
class AstroMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes
2321
"""Configuration for AstroMgmtClient.
2422
2523
Note that all parameters used to create this instance are saved as instance
2624
attributes.
2725
28-
:param credential: Credential needed for the client to connect to Azure. Required.
26+
:param credential: Credential used to authenticate requests to the service. Required.
2927
:type credential: ~azure.core.credentials.TokenCredential
30-
:param subscription_id: The ID of the target subscription. Required.
28+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3129
:type subscription_id: str
32-
:keyword api_version: Api Version. Default value is "2023-08-01". Note that overriding this
33-
default value may result in unsupported behavior.
30+
:param base_url: Service host. Default value is "https://management.azure.com".
31+
:type base_url: str
32+
:keyword api_version: The API version to use for this operation. Default value is "2024-08-27".
33+
Note that overriding this default value may result in unsupported behavior.
3434
:paramtype api_version: str
3535
"""
3636

37-
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
38-
super(AstroMgmtClientConfiguration, self).__init__(**kwargs)
39-
api_version: str = kwargs.pop("api_version", "2023-08-01")
37+
def __init__(
38+
self,
39+
credential: "TokenCredential",
40+
subscription_id: str,
41+
base_url: str = "https://management.azure.com",
42+
**kwargs: Any
43+
) -> None:
44+
api_version: str = kwargs.pop("api_version", "2024-08-27")
4045

4146
if credential is None:
4247
raise ValueError("Parameter 'credential' must not be None.")
@@ -45,9 +50,11 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
4550

4651
self.credential = credential
4752
self.subscription_id = subscription_id
53+
self.base_url = base_url
4854
self.api_version = api_version
4955
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5056
kwargs.setdefault("sdk_moniker", "mgmt-astro/{}".format(VERSION))
57+
self.polling_interval = kwargs.get("polling_interval", 30)
5158
self._configure(**kwargs)
5259

5360
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +63,9 @@ def _configure(self, **kwargs: Any) -> None:
5663
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
5764
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
5865
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
59-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6066
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
6167
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
68+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6269
self.authentication_policy = kwargs.get("authentication_policy")
6370
if self.credential and not self.authentication_policy:
6471
self.authentication_policy = ARMChallengeAuthenticationPolicy(

0 commit comments

Comments
 (0)