Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR track2_azure-mgmt-resource] modify policy in readme.md #739

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions sdk/resources/azure-mgmt-resource/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autorest": "3.7.2",
"use": [
"@autorest/python@5.13.0",
"@autorest/python@5.16.0",
"@autorest/modelerfour@4.19.3"
],
"commit": "8db7df38fe5fca1fc4d2634f5c89e8acfeb1f4ce",
"commit": "6ab7b389e84025ddb72fe56039265c5033357d97",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/resources/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
"autorest_command": "autorest specification/resources/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
"readme": "specification/resources/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
from ._version import VERSION

__version__ = VERSION

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = ['ChangesClient']
__all__.extend([p for p in _patch_all if p not in __all__])

# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.changes = ChangesOperations(self._client, self._config, self._serialize, self._deserialize)
self.changes = ChangesOperations(
self._client, self._config, self._serialize, self._deserialize
)


def _send_request(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "21.1.0"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
# --------------------------------------------------------------------------

from ._changes_client import ChangesClient

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = ['ChangesClient']
__all__.extend([p for p in _patch_all if p not in __all__])

# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.changes = ChangesOperations(self._client, self._config, self._serialize, self._deserialize)
self.changes = ChangesOperations(
self._client, self._config, self._serialize, self._deserialize
)


def _send_request(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

from ._operations import ChangesOperations

from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'ChangesOperations',
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from azure.core.rest import 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

from ... import models as _models
Expand All @@ -24,26 +25,24 @@
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class ChangesOperations:
"""ChangesOperations async operations.

You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
"""
.. warning::
**DO NOT** instantiate this class directly.

:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.resource.changes.v2022_05_01.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.mgmt.resource.changes.v2022_05_01.aio.ChangesClient`'s
:attr:`changes` attribute.
"""

models = _models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
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")


@distributed_trace
def list(
Expand All @@ -55,7 +54,7 @@ def list(
top: Optional[int] = 100,
skip_token: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable["_models.ChangeResourceListResult"]:
) -> AsyncIterable[_models.ChangeResourceListResult]:
"""Obtains a list of change resources from the past 14 days for the target resource.

:param resource_group_name: The name of the resource group.
Expand All @@ -77,13 +76,16 @@ def list(
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.changes.v2022_05_01.models.ChangeResourceListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = kwargs.pop('api_version', "2022-05-01") # type: str
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ChangeResourceListResult]

cls = kwargs.pop('cls', None) # type: ClsType["_models.ChangeResourceListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:

Expand All @@ -97,9 +99,11 @@ def prepare_request(next_link=None):
top=top,
skip_token=skip_token,
template_url=self.list.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.url = self._client.format_url(request.url) # type: ignore

else:

Expand All @@ -110,9 +114,11 @@ def prepare_request(next_link=None):
resource_type=resource_type,
resource_name=resource_name,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request

Expand Down Expand Up @@ -155,7 +161,7 @@ async def get(
resource_name: str,
change_resource_id: str,
**kwargs: Any
) -> "_models.ChangeResourceResult":
) -> _models.ChangeResourceResult:
"""Obtains the specified change resource for the target resource.

:param resource_group_name: The name of the resource group.
Expand All @@ -173,13 +179,16 @@ async def get(
:rtype: ~azure.mgmt.resource.changes.v2022_05_01.models.ChangeResourceResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.ChangeResourceResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
error_map.update(kwargs.pop('error_map', {}) or {})

_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version = kwargs.pop('api_version', "2022-05-01") # type: str
api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ChangeResourceResult]


request = build_changes_get_request(
Expand All @@ -191,11 +200,13 @@ async def get(
change_resource_id=change_resource_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.url = self._client.format_url(request.url) # type: ignore

pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.

Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List

__all__: List[str] = [] # Add all objects you want publicly available to users at this package level

def patch_sdk():
"""Do not remove from this file.

`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
ChangeType,
PropertyChangeType,
)

from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'ChangeAttributes',
'ChangeBase',
Expand All @@ -37,3 +39,5 @@
'ChangeType',
'PropertyChangeType',
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
# --------------------------------------------------------------------------

from enum import Enum
from six import with_metaclass
from azure.core import CaseInsensitiveEnumMeta


class ChangeCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class ChangeCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The entity that made the change
"""

Expand All @@ -20,7 +19,7 @@ class ChangeCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
#: System initiated change.
SYSTEM = "System"

class ChangeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class ChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of change that was captured in the resource
"""

Expand All @@ -31,7 +30,7 @@ class ChangeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
#: A newly created resource.
CREATE = "Create"

class PropertyChangeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class PropertyChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of change that occurred
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Dict, List, Optional
from typing import Dict, List, Optional, TYPE_CHECKING

from azure.core.exceptions import HttpResponseError
import msrest.serialization

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
import __init__ as _models


class ChangeAttributes(msrest.serialization.Model):
"""Details about the change resource.
Expand Down Expand Up @@ -64,12 +68,11 @@ class ChangeBase(msrest.serialization.Model):

Variables are only populated by the server, and will be ignored when sending a request.

:ivar property_change_type: The type of change that occurred. Possible values include:
"Update", "Insert", "Remove".
:ivar property_change_type: The type of change that occurred. Known values are: "Update",
"Insert", "Remove".
:vartype property_change_type: str or
~azure.mgmt.resource.changes.v2022_05_01.models.PropertyChangeType
:ivar change_category: The entity that made the change. Possible values include: "User",
"System".
:ivar change_category: The entity that made the change. Known values are: "User", "System".
:vartype change_category: str or ~azure.mgmt.resource.changes.v2022_05_01.models.ChangeCategory
:ivar previous_value: The target resource property value before the change.
:vartype previous_value: str
Expand Down Expand Up @@ -113,8 +116,8 @@ class ChangeProperties(msrest.serialization.Model):
:vartype target_resource_id: str
:ivar target_resource_type: The namespace and type of the resource.
:vartype target_resource_type: str
:ivar change_type: The type of change that was captured in the resource. Possible values
include: "Update", "Delete", "Create".
:ivar change_type: The type of change that was captured in the resource. Known values are:
"Update", "Delete", "Create".
:vartype change_type: str or ~azure.mgmt.resource.changes.v2022_05_01.models.ChangeType
:ivar change_attributes: Details about the change resource.
:vartype change_attributes: ~azure.mgmt.resource.changes.v2022_05_01.models.ChangeAttributes
Expand All @@ -140,8 +143,8 @@ class ChangeProperties(msrest.serialization.Model):
def __init__(
self,
*,
change_attributes: Optional["ChangeAttributes"] = None,
changes: Optional[Dict[str, "ChangeBase"]] = None,
change_attributes: Optional["_models.ChangeAttributes"] = None,
changes: Optional[Dict[str, "_models.ChangeBase"]] = None,
**kwargs
):
"""
Expand Down Expand Up @@ -177,7 +180,7 @@ def __init__(
self,
*,
next_link: Optional[str] = None,
value: Optional[List["ChangeResourceResult"]] = None,
value: Optional[List["_models.ChangeResourceResult"]] = None,
**kwargs
):
"""
Expand Down Expand Up @@ -263,7 +266,7 @@ class ChangeResourceResult(Resource):
def __init__(
self,
*,
properties: Optional["ChangeProperties"] = None,
properties: Optional["_models.ChangeProperties"] = None,
**kwargs
):
"""
Expand Down Expand Up @@ -368,7 +371,7 @@ class ErrorResponse(msrest.serialization.Model):
def __init__(
self,
*,
error: Optional["ErrorDetail"] = None,
error: Optional["_models.ErrorDetail"] = None,
**kwargs
):
"""
Expand Down
Loading