Skip to content

Commit

Permalink
CodeGen from PR 13786 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
reference old versions of other apis (Azure#13786)

* reference old versions of other apis

* remove old files
  • Loading branch information
SDKAuto committed Apr 6, 2021
1 parent 37380a4 commit 5581fec
Show file tree
Hide file tree
Showing 90 changed files with 13,043 additions and 432 deletions.
1 change: 1 addition & 0 deletions sdk/authorization/azure-mgmt-authorization/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include _meta.json
recursive-include tests *.py *.yaml
include *.md
include azure/__init__.py
Expand Down
8 changes: 8 additions & 0 deletions sdk/authorization/azure-mgmt-authorization/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"autorest": "V2",
"use": "@microsoft.azure/autorest.python@~4.0.71",
"commit": "a80895f851ff857163eaca150d32f9f5c8f67d72",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/authorization/resource-manager/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --use=@microsoft.azure/autorest.python@~4.0.71 --version=V2",
"readme": "specification/authorization/resource-manager/readme.md"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,20 @@

try:
from ._models_py3 import ClassicAdministrator
from ._models_py3 import ErrorAdditionalInfo
from ._models_py3 import ErrorDetail
from ._models_py3 import ErrorResponse, ErrorResponseException
except (SyntaxError, ImportError):
from ._models import ClassicAdministrator
from ._models import ErrorAdditionalInfo
from ._models import ErrorDetail
from ._models import ErrorResponse, ErrorResponseException
from ._paged_models import ClassicAdministratorPaged

__all__ = [
'ClassicAdministrator',
'ErrorAdditionalInfo',
'ErrorDetail',
'ErrorResponse', 'ErrorResponseException',
'ClassicAdministratorPaged',
]
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# --------------------------------------------------------------------------

from msrest.serialization import Model
from msrest.exceptions import HttpOperationError


class ClassicAdministrator(Model):
Expand Down Expand Up @@ -50,3 +51,108 @@ class CloudError(Model):

_attribute_map = {
}


class ErrorAdditionalInfo(Model):
"""The resource management error additional info.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar type: The additional info type.
:vartype type: str
:ivar info: The additional info.
:vartype info: object
"""

_validation = {
'type': {'readonly': True},
'info': {'readonly': True},
}

_attribute_map = {
'type': {'key': 'type', 'type': 'str'},
'info': {'key': 'info', 'type': 'object'},
}

def __init__(self, **kwargs):
super(ErrorAdditionalInfo, self).__init__(**kwargs)
self.type = None
self.info = None


class ErrorDetail(Model):
"""The error detail.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar code: The error code.
:vartype code: str
:ivar message: The error message.
:vartype message: str
:ivar target: The error target.
:vartype target: str
:ivar details: The error details.
:vartype details:
list[~azure.mgmt.authorization.v2015_06_01.models.ErrorDetail]
:ivar additional_info: The error additional info.
:vartype additional_info:
list[~azure.mgmt.authorization.v2015_06_01.models.ErrorAdditionalInfo]
"""

_validation = {
'code': {'readonly': True},
'message': {'readonly': True},
'target': {'readonly': True},
'details': {'readonly': True},
'additional_info': {'readonly': True},
}

_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
'target': {'key': 'target', 'type': 'str'},
'details': {'key': 'details', 'type': '[ErrorDetail]'},
'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'},
}

def __init__(self, **kwargs):
super(ErrorDetail, self).__init__(**kwargs)
self.code = None
self.message = None
self.target = None
self.details = None
self.additional_info = None


class ErrorResponse(Model):
"""Error response.
Common error response for all Azure Resource Manager APIs to return error
details for failed operations. (This also follows the OData error response
format.).
:param error: The error object.
:type error: ~azure.mgmt.authorization.v2015_06_01.models.ErrorDetail
"""

_attribute_map = {
'error': {'key': 'error', 'type': 'ErrorDetail'},
}

def __init__(self, **kwargs):
super(ErrorResponse, self).__init__(**kwargs)
self.error = kwargs.get('error', None)


class ErrorResponseException(HttpOperationError):
"""Server responsed with exception of type: 'ErrorResponse'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""

def __init__(self, deserialize, response, *args):

super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args)
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# --------------------------------------------------------------------------

from msrest.serialization import Model
from msrest.exceptions import HttpOperationError


class ClassicAdministrator(Model):
Expand Down Expand Up @@ -50,3 +51,108 @@ class CloudError(Model):

_attribute_map = {
}


class ErrorAdditionalInfo(Model):
"""The resource management error additional info.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar type: The additional info type.
:vartype type: str
:ivar info: The additional info.
:vartype info: object
"""

_validation = {
'type': {'readonly': True},
'info': {'readonly': True},
}

_attribute_map = {
'type': {'key': 'type', 'type': 'str'},
'info': {'key': 'info', 'type': 'object'},
}

def __init__(self, **kwargs) -> None:
super(ErrorAdditionalInfo, self).__init__(**kwargs)
self.type = None
self.info = None


class ErrorDetail(Model):
"""The error detail.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar code: The error code.
:vartype code: str
:ivar message: The error message.
:vartype message: str
:ivar target: The error target.
:vartype target: str
:ivar details: The error details.
:vartype details:
list[~azure.mgmt.authorization.v2015_06_01.models.ErrorDetail]
:ivar additional_info: The error additional info.
:vartype additional_info:
list[~azure.mgmt.authorization.v2015_06_01.models.ErrorAdditionalInfo]
"""

_validation = {
'code': {'readonly': True},
'message': {'readonly': True},
'target': {'readonly': True},
'details': {'readonly': True},
'additional_info': {'readonly': True},
}

_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
'target': {'key': 'target', 'type': 'str'},
'details': {'key': 'details', 'type': '[ErrorDetail]'},
'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'},
}

def __init__(self, **kwargs) -> None:
super(ErrorDetail, self).__init__(**kwargs)
self.code = None
self.message = None
self.target = None
self.details = None
self.additional_info = None


class ErrorResponse(Model):
"""Error response.
Common error response for all Azure Resource Manager APIs to return error
details for failed operations. (This also follows the OData error response
format.).
:param error: The error object.
:type error: ~azure.mgmt.authorization.v2015_06_01.models.ErrorDetail
"""

_attribute_map = {
'error': {'key': 'error', 'type': 'ErrorDetail'},
}

def __init__(self, *, error=None, **kwargs) -> None:
super(ErrorResponse, self).__init__(**kwargs)
self.error = error


class ErrorResponseException(HttpOperationError):
"""Server responsed with exception of type: 'ErrorResponse'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""

def __init__(self, deserialize, response, *args):

super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError

from .. import models

Expand Down Expand Up @@ -52,20 +51,21 @@ def list(
:return: An iterator like instance of ClassicAdministrator
:rtype:
~azure.mgmt.authorization.v2015_06_01.models.ClassicAdministratorPaged[~azure.mgmt.authorization.v2015_06_01.models.ClassicAdministrator]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
:raises:
:class:`ErrorResponseException<azure.mgmt.authorization.v2015_06_01.models.ErrorResponseException>`
"""
def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1)
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1)

else:
url = next_link
Expand All @@ -91,9 +91,7 @@ def internal_paging(next_link=None):
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
raise models.ErrorResponseException(self._deserialize, response)

return response

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

try:
from ._models_py3 import ClassicAdministrator
from ._models_py3 import ErrorAdditionalInfo
from ._models_py3 import ErrorDetail
from ._models_py3 import ErrorResponse, ErrorResponseException
from ._models_py3 import Permission
from ._models_py3 import ProviderOperation
from ._models_py3 import ProviderOperationsMetadata
Expand All @@ -24,6 +27,9 @@
from ._models_py3 import RoleDefinitionFilter
except (SyntaxError, ImportError):
from ._models import ClassicAdministrator
from ._models import ErrorAdditionalInfo
from ._models import ErrorDetail
from ._models import ErrorResponse, ErrorResponseException
from ._models import Permission
from ._models import ProviderOperation
from ._models import ProviderOperationsMetadata
Expand All @@ -43,6 +49,9 @@

__all__ = [
'ClassicAdministrator',
'ErrorAdditionalInfo',
'ErrorDetail',
'ErrorResponse', 'ErrorResponseException',
'Permission',
'ProviderOperation',
'ProviderOperationsMetadata',
Expand Down
Loading

0 comments on commit 5581fec

Please sign in to comment.