Skip to content

Commit ab606cb

Browse files
author
SDKAuto
committed
CodeGen from PR 34270 in Azure/azure-rest-api-specs
Merge c5c31b0506df39bc9e78f53a9678914719c1964d into a19648565889eaae019e531c15f3045d1244c7ce
1 parent 6c30600 commit ab606cb

File tree

76 files changed

+15720
-12421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+15720
-12421
lines changed

sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/CHANGELOG.md

Lines changed: 195 additions & 0 deletions
Large diffs are not rendered by default.

sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/README.md

Lines changed: 3 additions & 3 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 Appcomplianceautomation 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
@@ -24,7 +24,7 @@ pip install azure-identity
2424

2525
### Authentication
2626

27-
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables.
27+
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables.
2828

2929
- `AZURE_CLIENT_ID` for Azure client ID.
3030
- `AZURE_TENANT_ID` for Azure tenant ID.
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"commit": "43f10d3b8bacd5fc6b01254b5050c613f26c3573",
2+
"commit": "079f70d6f2b754db6b736e117196104efd2dd496",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.10.2",
5-
"use": [
6-
"@autorest/[email protected]",
7-
"@autorest/[email protected]"
8-
],
9-
"autorest_command": "autorest specification/appcomplianceautomation/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.10.2 --version-tolerant=False",
10-
"readme": "specification/appcomplianceautomation/resource-manager/readme.md"
4+
"typespec_src": "specification/appcomplianceautomation/AppComplianceAutomation.Management",
5+
"@azure-tools/typespec-python": "0.44.2"
116
}

sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/apiview-properties.json

Lines changed: 164 additions & 0 deletions
Large diffs are not rendered by default.

sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/__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 ._app_compliance_automation_mgmt_client import AppComplianceAutomationMgmtClient
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 AppComplianceAutomationMgmtClient # 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
"AppComplianceAutomationMgmtClient",
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()
Lines changed: 50 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
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
10-
from typing import Any, TYPE_CHECKING
10+
from typing import Any, Optional, TYPE_CHECKING, cast
11+
from typing_extensions import Self
1112

1213
from azure.core.pipeline import policies
1314
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.core.settings import settings
1416
from azure.mgmt.core import ARMPipelineClient
1517
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
18+
from azure.mgmt.core.tools import get_arm_endpoints
1619

17-
from . import models as _models
1820
from ._configuration import AppComplianceAutomationMgmtClientConfiguration
19-
from ._serialization import Deserializer, Serializer
21+
from ._utils.serialization import Deserializer, Serializer
2022
from .operations import (
2123
EvidenceOperations,
2224
Operations,
@@ -28,44 +30,50 @@
2830
)
2931

3032
if TYPE_CHECKING:
31-
# pylint: disable=unused-import,ungrouped-imports
3233
from azure.core.credentials import TokenCredential
3334

3435

35-
class AppComplianceAutomationMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
36+
class AppComplianceAutomationMgmtClient: # pylint: disable=too-many-instance-attributes
3637
"""App Compliance Automation Tool for Microsoft 365 API spec.
3738
38-
:ivar provider_actions: ProviderActionsOperations operations
39-
:vartype provider_actions:
40-
azure.mgmt.appcomplianceautomation.operations.ProviderActionsOperations
41-
:ivar operations: Operations operations
42-
:vartype operations: azure.mgmt.appcomplianceautomation.operations.Operations
4339
:ivar report: ReportOperations operations
4440
:vartype report: azure.mgmt.appcomplianceautomation.operations.ReportOperations
45-
:ivar evidence: EvidenceOperations operations
46-
:vartype evidence: azure.mgmt.appcomplianceautomation.operations.EvidenceOperations
41+
:ivar webhook: WebhookOperations operations
42+
:vartype webhook: azure.mgmt.appcomplianceautomation.operations.WebhookOperations
43+
:ivar snapshot: SnapshotOperations operations
44+
:vartype snapshot: azure.mgmt.appcomplianceautomation.operations.SnapshotOperations
4745
:ivar scoping_configuration: ScopingConfigurationOperations operations
4846
:vartype scoping_configuration:
4947
azure.mgmt.appcomplianceautomation.operations.ScopingConfigurationOperations
50-
:ivar snapshot: SnapshotOperations operations
51-
:vartype snapshot: azure.mgmt.appcomplianceautomation.operations.SnapshotOperations
52-
:ivar webhook: WebhookOperations operations
53-
:vartype webhook: azure.mgmt.appcomplianceautomation.operations.WebhookOperations
54-
:param credential: Credential needed for the client to connect to Azure. Required.
48+
:ivar evidence: EvidenceOperations operations
49+
:vartype evidence: azure.mgmt.appcomplianceautomation.operations.EvidenceOperations
50+
:ivar operations: Operations operations
51+
:vartype operations: azure.mgmt.appcomplianceautomation.operations.Operations
52+
:ivar provider_actions: ProviderActionsOperations operations
53+
:vartype provider_actions:
54+
azure.mgmt.appcomplianceautomation.operations.ProviderActionsOperations
55+
:param credential: Credential used to authenticate requests to the service. Required.
5556
:type credential: ~azure.core.credentials.TokenCredential
56-
:param base_url: Service URL. Default value is "https://management.azure.com".
57+
:param base_url: Service host. Default value is None.
5758
:type base_url: str
58-
:keyword api_version: Api Version. Default value is "2024-06-27". Note that overriding this
59-
default value may result in unsupported behavior.
59+
:keyword api_version: The API version to use for this operation. Default value is "2024-06-27".
60+
Note that overriding this default value may result in unsupported behavior.
6061
:paramtype api_version: str
6162
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
6263
Retry-After header is present.
6364
"""
6465

65-
def __init__(
66-
self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
67-
) -> None:
68-
self._config = AppComplianceAutomationMgmtClientConfiguration(credential=credential, **kwargs)
66+
def __init__(self, credential: "TokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None:
67+
_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"])
73+
self._config = AppComplianceAutomationMgmtClientConfiguration(
74+
credential=credential, base_url=cast(str, base_url), credential_scopes=credential_scopes, **kwargs
75+
)
76+
6977
_policies = kwargs.pop("policies", None)
7078
if _policies is None:
7179
_policies = [
@@ -84,31 +92,30 @@ def __init__(
8492
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
8593
self._config.http_logging_policy,
8694
]
87-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
95+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs)
8896

89-
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
90-
self._serialize = Serializer(client_models)
91-
self._deserialize = Deserializer(client_models)
97+
self._serialize = Serializer()
98+
self._deserialize = Deserializer()
9299
self._serialize.client_side_validation = False
93-
self.provider_actions = ProviderActionsOperations(
100+
self.report = ReportOperations(self._client, self._config, self._serialize, self._deserialize)
101+
self.webhook = WebhookOperations(self._client, self._config, self._serialize, self._deserialize)
102+
self.snapshot = SnapshotOperations(self._client, self._config, self._serialize, self._deserialize)
103+
self.scoping_configuration = ScopingConfigurationOperations(
94104
self._client, self._config, self._serialize, self._deserialize
95105
)
96-
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
97-
self.report = ReportOperations(self._client, self._config, self._serialize, self._deserialize)
98106
self.evidence = EvidenceOperations(self._client, self._config, self._serialize, self._deserialize)
99-
self.scoping_configuration = ScopingConfigurationOperations(
107+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
108+
self.provider_actions = ProviderActionsOperations(
100109
self._client, self._config, self._serialize, self._deserialize
101110
)
102-
self.snapshot = SnapshotOperations(self._client, self._config, self._serialize, self._deserialize)
103-
self.webhook = WebhookOperations(self._client, self._config, self._serialize, self._deserialize)
104111

105-
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
112+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
106113
"""Runs the network request through the client's chained policies.
107114
108115
>>> from azure.core.rest import HttpRequest
109116
>>> request = HttpRequest("GET", "https://www.example.org/")
110117
<HttpRequest [GET], url: 'https://www.example.org/'>
111-
>>> response = client._send_request(request)
118+
>>> response = client.send_request(request)
112119
<HttpResponse: 200 OK>
113120
114121
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -121,13 +128,17 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
121128
"""
122129

123130
request_copy = deepcopy(request)
124-
request_copy.url = self._client.format_url(request_copy.url)
131+
path_format_arguments = {
132+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
133+
}
134+
135+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
125136
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
126137

127138
def close(self) -> None:
128139
self._client.close()
129140

130-
def __enter__(self) -> "AppComplianceAutomationMgmtClient":
141+
def __enter__(self) -> Self:
131142
self._client.__enter__()
132143
return self
133144

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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

@@ -14,7 +14,6 @@
1414
from ._version import VERSION
1515

1616
if TYPE_CHECKING:
17-
# pylint: disable=unused-import,ungrouped-imports
1817
from azure.core.credentials import TokenCredential
1918

2019

@@ -24,20 +23,25 @@ class AppComplianceAutomationMgmtClientConfiguration: # pylint: disable=too-man
2423
Note that all parameters used to create this instance are saved as instance
2524
attributes.
2625
27-
:param credential: Credential needed for the client to connect to Azure. Required.
26+
:param credential: Credential used to authenticate requests to the service. Required.
2827
:type credential: ~azure.core.credentials.TokenCredential
29-
:keyword api_version: Api Version. Default value is "2024-06-27". Note that overriding this
30-
default value may result in unsupported behavior.
28+
:param base_url: Service host. Default value is "https://management.azure.com".
29+
:type base_url: str
30+
:keyword api_version: The API version to use for this operation. Default value is "2024-06-27".
31+
Note that overriding this default value may result in unsupported behavior.
3132
:paramtype api_version: str
3233
"""
3334

34-
def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
35+
def __init__(
36+
self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
37+
) -> None:
3538
api_version: str = kwargs.pop("api_version", "2024-06-27")
3639

3740
if credential is None:
3841
raise ValueError("Parameter 'credential' must not be None.")
3942

4043
self.credential = credential
44+
self.base_url = base_url
4145
self.api_version = api_version
4246
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
4347
kwargs.setdefault("sdk_moniker", "mgmt-appcomplianceautomation/{}".format(VERSION))

sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_patch.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# ------------------------------------
2-
# Copyright (c) Microsoft Corporation.
3-
# Licensed under the MIT License.
4-
# ------------------------------------
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# --------------------------------------------------------------------------
56
"""Customize generated code here.
67
78
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
# --------------------------------------------------------------------------
22
# Copyright (c) Microsoft Corporation. All rights reserved.
33
# Licensed under the MIT License. See License.txt in the project root for license information.
4-
# Code generated by Microsoft (R) AutoRest Code Generator.
4+
# Code generated by Microsoft (R) Python Code Generator.
55
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
66
# --------------------------------------------------------------------------
7-
8-
from azure.core.pipeline.transport import HttpRequest
9-
10-
11-
def _convert_request(request, files=None):
12-
data = request.content if not files else None
13-
request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
14-
if files:
15-
request.set_formdata_body(files)
16-
return request

0 commit comments

Comments
 (0)