Skip to content

Commit

Permalink
[AutoRelease] t2-resource-2024-10-17-51538(can only be merged by SDK …
Browse files Browse the repository at this point in the history
…owner) (#37957)

* code and test

* fix-live-test-fail

* Update CHANGELOG.md

* Update conftest.py

---------

Co-authored-by: azure-sdk <PythonSdkPipelines>
Co-authored-by: ChenxiJiang333 <v-chenjiang@microsoft.com>
Co-authored-by: ChenxiJiang333 <119990644+ChenxiJiang333@users.noreply.github.com>
Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
  • Loading branch information
4 people authored Oct 24, 2024
1 parent 71681bd commit 7dcaf26
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 411 deletions.
15 changes: 15 additions & 0 deletions sdk/resources/azure-mgmt-resource/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Release History

## 23.2.0 (2024-10-24)

### Features Added

- Added operation group DataBoundariesOperations
- Added operation group PolicyDefinitionVersionsOperations
- Added operation group PolicySetDefinitionVersionsOperations
- Model ParameterDefinitionsValue has a new parameter schema
- Model PolicyAssignment has a new parameter definition_version
- Model PolicyDefinition has a new parameter version
- Model PolicyDefinition has a new parameter versions
- Model PolicyDefinitionReference has a new parameter definition_version
- Model PolicySetDefinition has a new parameter version
- Model PolicySetDefinition has a new parameter versions

## 23.1.1 (2024-05-08)

### Other Changes
Expand Down
5 changes: 3 additions & 2 deletions sdk/resources/azure-mgmt-resource/_meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"commit": "63c41aa20e38fe6d2ddd1a367b4fe57e8b601c34",
"commit": "34424077cae09522361ea641761dc37941603383",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.10.2",
"use": [
Expand Down Expand Up @@ -62,5 +62,6 @@
"package-deploymentstacks-2024-03": "2024-05-02 13:16:57 -0400 88cc082d66e2b481ed99a17d44edffaeb6254eec Microsoft.Resources/stable/2024-03-01/deploymentStacks.json",
"package-deploymentstacks-2022-08-preview": "2024-05-02 13:16:57 -0400 88cc082d66e2b481ed99a17d44edffaeb6254eec Microsoft.Resources/preview/2022-08-01-preview/deploymentStacks.json",
"package-changes-2022-05": "2022-04-24 21:43:30 -0700 91b36e26db23dffc149d968333c29f9a2f131702 Microsoft.Resources/stable/2022-05-01/changes.json",
"package-policy-2023-04-only": "2024-06-12 20:54:26 -0700 412364b282e52b50eadc3cd88d56d283b6c8712a Microsoft.Authorization/stable/2023-04-01/policySetDefinitions.json"
"package-policy-2023-04-only": "2024-06-12 20:54:26 -0700 412364b282e52b50eadc3cd88d56d283b6c8712a Microsoft.Authorization/stable/2023-04-01/policySetDefinitions.json",
"package-databoundaries-2024-08": "2024-08-22 09:22:07 -0700 a6074b7654c388dec49c9969d0136cfeb03575c9 Microsoft.Resources/stable/2024-08-01/dataBoundaries.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,6 @@ def data_boundaries(self):
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def operations(self):
"""Instance depends on the API version:
* 2024-08-01: :class:`Operations<azure.mgmt.resource.databoundaries.v2024_08_01.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2024-08-01':
from .v2024_08_01.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

def close(self):
self._client.close()
def __enter__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,6 @@ def data_boundaries(self):
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def operations(self):
"""Instance depends on the API version:
* 2024-08-01: :class:`Operations<azure.mgmt.resource.databoundaries.v2024_08_01.aio.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2024-08-01':
from ..v2024_08_01.aio.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

async def close(self):
await self._client.close()
async def __aenter__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from . import models as _models
from .._serialization import Deserializer, Serializer
from ._configuration import DataBoundaryMgmtClientConfiguration
from .operations import DataBoundariesOperations, Operations
from .operations import DataBoundariesOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
Expand All @@ -28,8 +28,6 @@
class DataBoundaryMgmtClient: # pylint: disable=client-accepts-api-version-keyword
"""Provides APIs for data boundary operations.
:ivar operations: Operations operations
:vartype operations: azure.mgmt.resource.databoundaries.v2024_08_01.operations.Operations
:ivar data_boundaries: DataBoundariesOperations operations
:vartype data_boundaries:
azure.mgmt.resource.databoundaries.v2024_08_01.operations.DataBoundariesOperations
Expand Down Expand Up @@ -70,7 +68,6 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2024-08-01")
self.data_boundaries = DataBoundariesOperations(
self._client, self._config, self._serialize, self._deserialize, "2024-08-01"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
"async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"operations": "Operations",
"data_boundaries": "DataBoundariesOperations"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from .. import models as _models
from ..._serialization import Deserializer, Serializer
from ._configuration import DataBoundaryMgmtClientConfiguration
from .operations import DataBoundariesOperations, Operations
from .operations import DataBoundariesOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
Expand All @@ -28,8 +28,6 @@
class DataBoundaryMgmtClient: # pylint: disable=client-accepts-api-version-keyword
"""Provides APIs for data boundary operations.
:ivar operations: Operations operations
:vartype operations: azure.mgmt.resource.databoundaries.v2024_08_01.aio.operations.Operations
:ivar data_boundaries: DataBoundariesOperations operations
:vartype data_boundaries:
azure.mgmt.resource.databoundaries.v2024_08_01.aio.operations.DataBoundariesOperations
Expand Down Expand Up @@ -70,7 +68,6 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2024-08-01")
self.data_boundaries = DataBoundariesOperations(
self._client, self._config, self._serialize, self._deserialize, "2024-08-01"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._operations import Operations
from ._operations import DataBoundariesOperations

from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"Operations",
"DataBoundariesOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
# --------------------------------------------------------------------------
from io import IOBase
import sys
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload

from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
Expand All @@ -22,7 +20,6 @@
)
from azure.core.pipeline import PipelineResponse
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
Expand All @@ -32,7 +29,6 @@
build_data_boundaries_get_scope_request,
build_data_boundaries_get_tenant_request,
build_data_boundaries_put_request,
build_operations_list_request,
)

if sys.version_info >= (3, 9):
Expand All @@ -43,102 +39,6 @@
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]


class Operations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.resource.databoundaries.v2024_08_01.aio.DataBoundaryMgmtClient`'s
:attr:`operations` attribute.
"""

models = _models

def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")

@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists all of the available Microsoft.Resources REST API operations.
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.databoundaries.v2024_08_01.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-08-01"))
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)

error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

def prepare_request(next_link=None):
if not next_link:

_request = build_operations_list_request(
api_version=api_version,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)

else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request

async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)

async def get_next(next_link=None):
_request = prepare_request(next_link)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

return pipeline_response

return AsyncItemPaged(get_next, extract_data)


class DataBoundariesOperations:
"""
.. warning::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@
from ._models_py3 import ErrorAdditionalInfo
from ._models_py3 import ErrorDetail
from ._models_py3 import ErrorResponse
from ._models_py3 import Operation
from ._models_py3 import OperationDisplay
from ._models_py3 import OperationListResult
from ._models_py3 import ProxyResource
from ._models_py3 import Resource
from ._models_py3 import SystemData

from ._data_boundary_mgmt_client_enums import ActionType
from ._data_boundary_mgmt_client_enums import CreatedByType
from ._data_boundary_mgmt_client_enums import DataBoundary
from ._data_boundary_mgmt_client_enums import DefaultName
from ._data_boundary_mgmt_client_enums import Origin
from ._data_boundary_mgmt_client_enums import ProvisioningState
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
Expand All @@ -34,17 +29,12 @@
"ErrorAdditionalInfo",
"ErrorDetail",
"ErrorResponse",
"Operation",
"OperationDisplay",
"OperationListResult",
"ProxyResource",
"Resource",
"SystemData",
"ActionType",
"CreatedByType",
"DataBoundary",
"DefaultName",
"Origin",
"ProvisioningState",
]
__all__.extend([p for p in _patch_all if p not in __all__])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
from azure.core import CaseInsensitiveEnumMeta


class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs."""

INTERNAL = "Internal"


class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of identity that created the resource."""

Expand All @@ -40,16 +34,6 @@ class DefaultName(str, Enum, metaclass=CaseInsensitiveEnumMeta):
DEFAULT = "default"


class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit
logs UX. Default value is "user,system".
"""

USER = "user"
SYSTEM = "system"
USER_SYSTEM = "user,system"


class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Denotes the state of provisioning."""

Expand Down
Loading

0 comments on commit 7dcaf26

Please sign in to comment.