Skip to content

Commit 465cfd2

Browse files
committed
Configurations: 'specification/policyinsights/resource-manager/Microsoft.PolicyInsights/PolicyInsights/tspconfig.yaml', API Version: 2024-10-01, SDK Release Type: beta, and CommitSHA: 'cb62053a18882dd258d9922be9770702b7ef6ac9' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6362432 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release.
1 parent 3706f36 commit 465cfd2

198 files changed

Lines changed: 28512 additions & 19020 deletions

File tree

Some content is hidden

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

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

Lines changed: 307 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
2-
"commit": "6ed455a1fb884a0a8d5c8970d44d4ccee288cf30",
2+
"apiVersions": {
3+
"PolicyInsightsApi": "2024-10-01",
4+
"PolicyTrackedResourcesApi": "2018-07-01-preview"
5+
},
6+
"commit": "cb62053a18882dd258d9922be9770702b7ef6ac9",
37
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.10.2",
5-
"use": [
6-
"@autorest/python@6.50.0",
7-
"@autorest/modelerfour@4.27.0"
8-
],
9-
"autorest_command": "autorest specification/policyinsights/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --package-mode=azure-mgmt --python --python-sdks-folder=C:\\dev\\azure-sdk-for-python\\sdk --tag=package-2020-07 --use=@autorest/python@6.50.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
10-
"readme": "specification/policyinsights/resource-manager/readme.md"
8+
"typespec_src": "specification/policyinsights/resource-manager/Microsoft.PolicyInsights/PolicyInsights",
9+
"emitterVersion": "0.62.1"
1110
}

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

Lines changed: 225 additions & 177 deletions
Large diffs are not rendered by default.

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

Lines changed: 2 additions & 2 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
# pylint: disable=wrong-import-position
@@ -12,7 +12,7 @@
1212
if TYPE_CHECKING:
1313
from ._patch import * # pylint: disable=unused-wildcard-import
1414

15-
from ._policy_insights_client import PolicyInsightsClient # type: ignore
15+
from ._client import PolicyInsightsClient # type: ignore
1616
from ._version import VERSION
1717

1818
__version__ = VERSION

sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_policy_insights_client.py renamed to sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_client.py

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
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+
import sys
1011
from typing import Any, Optional, TYPE_CHECKING, cast
11-
from typing_extensions import Self
1212

1313
from azure.core.pipeline import policies
1414
from azure.core.rest import HttpRequest, HttpResponse
@@ -17,10 +17,11 @@
1717
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1818
from azure.mgmt.core.tools import get_arm_endpoints
1919

20-
from . import models as _models
2120
from ._configuration import PolicyInsightsClientConfiguration
2221
from ._utils.serialization import Deserializer, Serializer
2322
from .operations import (
23+
AttestationsOperations,
24+
ComponentPolicyStatesOperations,
2425
Operations,
2526
PolicyEventsOperations,
2627
PolicyMetadataOperations,
@@ -30,6 +31,11 @@
3031
RemediationsOperations,
3132
)
3233

34+
if sys.version_info >= (3, 11):
35+
from typing import Self
36+
else:
37+
from typing_extensions import Self # type: ignore
38+
3339
if TYPE_CHECKING:
3440
from azure.core import AzureClouds
3541
from azure.core.credentials import TokenCredential
@@ -38,26 +44,31 @@
3844
class PolicyInsightsClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
3945
"""PolicyInsightsClient.
4046
41-
:ivar policy_tracked_resources: PolicyTrackedResourcesOperations operations
42-
:vartype policy_tracked_resources:
43-
azure.mgmt.policyinsights.operations.PolicyTrackedResourcesOperations
47+
:ivar operations: Operations operations
48+
:vartype operations: azure.mgmt.policyinsights.operations.Operations
4449
:ivar remediations: RemediationsOperations operations
4550
:vartype remediations: azure.mgmt.policyinsights.operations.RemediationsOperations
51+
:ivar attestations: AttestationsOperations operations
52+
:vartype attestations: azure.mgmt.policyinsights.operations.AttestationsOperations
53+
:ivar policy_metadata: PolicyMetadataOperations operations
54+
:vartype policy_metadata: azure.mgmt.policyinsights.operations.PolicyMetadataOperations
4655
:ivar policy_events: PolicyEventsOperations operations
4756
:vartype policy_events: azure.mgmt.policyinsights.operations.PolicyEventsOperations
4857
:ivar policy_states: PolicyStatesOperations operations
4958
:vartype policy_states: azure.mgmt.policyinsights.operations.PolicyStatesOperations
50-
:ivar operations: Operations operations
51-
:vartype operations: azure.mgmt.policyinsights.operations.Operations
52-
:ivar policy_metadata: PolicyMetadataOperations operations
53-
:vartype policy_metadata: azure.mgmt.policyinsights.operations.PolicyMetadataOperations
5459
:ivar policy_restrictions: PolicyRestrictionsOperations operations
5560
:vartype policy_restrictions: azure.mgmt.policyinsights.operations.PolicyRestrictionsOperations
56-
:param credential: Credential needed for the client to connect to Azure. Required.
61+
:ivar component_policy_states: ComponentPolicyStatesOperations operations
62+
:vartype component_policy_states:
63+
azure.mgmt.policyinsights.operations.ComponentPolicyStatesOperations
64+
:ivar policy_tracked_resources: PolicyTrackedResourcesOperations operations
65+
:vartype policy_tracked_resources:
66+
azure.mgmt.policyinsights.operations.PolicyTrackedResourcesOperations
67+
:param credential: Credential used to authenticate requests to the service. Required.
5768
:type credential: ~azure.core.credentials.TokenCredential
58-
:param subscription_id: Microsoft Azure subscription ID. Required.
69+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
5970
:type subscription_id: str
60-
:param base_url: Service URL. Default value is None.
71+
:param base_url: Service host. Default value is None.
6172
:type base_url: str
6273
:keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is
6374
None.
@@ -75,6 +86,7 @@ def __init__(
7586
cloud_setting: Optional["AzureClouds"] = None,
7687
**kwargs: Any
7788
) -> None:
89+
_endpoint = "{endpoint}"
7890
_cloud = cloud_setting or settings.current.azure_cloud # type: ignore
7991
_endpoints = get_arm_endpoints(_cloud)
8092
if not base_url:
@@ -83,6 +95,7 @@ def __init__(
8395
self._config = PolicyInsightsClientConfiguration(
8496
credential=credential,
8597
subscription_id=subscription_id,
98+
base_url=cast(str, base_url),
8699
cloud_setting=cloud_setting,
87100
credential_scopes=credential_scopes,
88101
**kwargs
@@ -106,31 +119,34 @@ def __init__(
106119
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
107120
self._config.http_logging_policy,
108121
]
109-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs)
122+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs)
110123

111-
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
112-
self._serialize = Serializer(client_models)
113-
self._deserialize = Deserializer(client_models)
124+
self._serialize = Serializer()
125+
self._deserialize = Deserializer()
114126
self._serialize.client_side_validation = False
115-
self.policy_tracked_resources = PolicyTrackedResourcesOperations(
116-
self._client, self._config, self._serialize, self._deserialize
117-
)
127+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
118128
self.remediations = RemediationsOperations(self._client, self._config, self._serialize, self._deserialize)
129+
self.attestations = AttestationsOperations(self._client, self._config, self._serialize, self._deserialize)
130+
self.policy_metadata = PolicyMetadataOperations(self._client, self._config, self._serialize, self._deserialize)
119131
self.policy_events = PolicyEventsOperations(self._client, self._config, self._serialize, self._deserialize)
120132
self.policy_states = PolicyStatesOperations(self._client, self._config, self._serialize, self._deserialize)
121-
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
122-
self.policy_metadata = PolicyMetadataOperations(self._client, self._config, self._serialize, self._deserialize)
123133
self.policy_restrictions = PolicyRestrictionsOperations(
124134
self._client, self._config, self._serialize, self._deserialize
125135
)
136+
self.component_policy_states = ComponentPolicyStatesOperations(
137+
self._client, self._config, self._serialize, self._deserialize
138+
)
139+
self.policy_tracked_resources = PolicyTrackedResourcesOperations(
140+
self._client, self._config, self._serialize, self._deserialize
141+
)
126142

127-
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
143+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
128144
"""Runs the network request through the client's chained policies.
129145
130146
>>> from azure.core.rest import HttpRequest
131147
>>> request = HttpRequest("GET", "https://www.example.org/")
132148
<HttpRequest [GET], url: 'https://www.example.org/'>
133-
>>> response = client._send_request(request)
149+
>>> response = client.send_request(request)
134150
<HttpResponse: 200 OK>
135151
136152
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -143,7 +159,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
143159
"""
144160

145161
request_copy = deepcopy(request)
146-
request_copy.url = self._client.format_url(request_copy.url)
162+
path_format_arguments = {
163+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
164+
}
165+
166+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
147167
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
148168

149169
def close(self) -> None:

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

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

@@ -24,10 +24,12 @@ class PolicyInsightsClientConfiguration: # pylint: disable=too-many-instance-at
2424
Note that all parameters used to create this instance are saved as instance
2525
attributes.
2626
27-
:param credential: Credential needed for the client to connect to Azure. Required.
27+
:param credential: Credential used to authenticate requests to the service. Required.
2828
:type credential: ~azure.core.credentials.TokenCredential
29-
:param subscription_id: Microsoft Azure subscription ID. Required.
29+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3030
:type subscription_id: str
31+
:param base_url: Service host. Default value is "https://management.azure.com".
32+
:type base_url: str
3133
:param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is
3234
None.
3335
:type cloud_setting: ~azure.core.AzureClouds
@@ -37,6 +39,7 @@ def __init__(
3739
self,
3840
credential: "TokenCredential",
3941
subscription_id: str,
42+
base_url: str = "https://management.azure.com",
4043
cloud_setting: Optional["AzureClouds"] = None,
4144
**kwargs: Any
4245
) -> None:
@@ -47,6 +50,7 @@ def __init__(
4750

4851
self.credential = credential
4952
self.subscription_id = subscription_id
53+
self.base_url = base_url
5054
self.cloud_setting = cloud_setting
5155
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5256
kwargs.setdefault("sdk_moniker", "mgmt-policyinsights/{}".format(VERSION))

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
# ------------------------------------
2-
# Copyright (c) Microsoft Corporation.
3-
# Licensed under the MIT License.
4-
# ------------------------------------
5-
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+
# --------------------------------------------------------------------------
66
"""Customize generated code here.
77
88
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
99
"""
10-
from typing import List
1110

12-
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
11+
__all__: list[str] = [] # Add all objects you want publicly available to users at this package level
1312

1413

1514
def patch_sdk():
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +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
# --------------------------------------------------------------------------

0 commit comments

Comments
 (0)