Skip to content

Commit

Permalink
Fix dup cloud error (#17097)
Browse files Browse the repository at this point in the history
* Fix dup cloud error

* update
  • Loading branch information
xiangyan99 authored Mar 6, 2021
1 parent 32cd56c commit be4f3ef
Show file tree
Hide file tree
Showing 15 changed files with 208 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from typing import Any

from azure.core.credentials import TokenCredential
from azure.core.pipeline.transport import HttpRequest, HttpResponse

from ._configuration import AccessControlClientConfiguration
from .operations import RoleAssignmentsOperations
Expand Down Expand Up @@ -57,6 +58,24 @@ def __init__(
self.role_definitions = RoleDefinitionsOperations(
self._client, self._config, self._serialize, self._deserialize)

def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse
"""
path_format_arguments = {
'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

def close(self):
# type: () -> None
self._client.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import Any, TYPE_CHECKING

from azure.core import AsyncPipelineClient
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
Expand Down Expand Up @@ -54,6 +55,23 @@ def __init__(
self.role_definitions = RoleDefinitionsOperations(
self._client, self._config, self._serialize, self._deserialize)

async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
"""
path_format_arguments = {
'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

async def close(self) -> None:
await self._client.close()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from typing import Any

from azure.core.credentials import TokenCredential
from azure.core.pipeline.transport import HttpRequest, HttpResponse

from ._configuration import ArtifactsClientConfiguration
from .operations import LinkedServiceOperations
Expand Down Expand Up @@ -133,6 +134,24 @@ def __init__(
self.workspace_git_repo_management = WorkspaceGitRepoManagementOperations(
self._client, self._config, self._serialize, self._deserialize)

def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse
"""
path_format_arguments = {
'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

def close(self):
# type: () -> None
self._client.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import Any, TYPE_CHECKING

from azure.core import AsyncPipelineClient
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
Expand Down Expand Up @@ -130,6 +131,23 @@ def __init__(
self.workspace_git_repo_management = WorkspaceGitRepoManagementOperations(
self._client, self._config, self._serialize, self._deserialize)

async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
"""
path_format_arguments = {
'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

async def close(self) -> None:
await self._client.close()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async def get_next(next_link=None):
response = pipeline_response.http_response

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

Expand Down Expand Up @@ -148,7 +148,7 @@ async def _flush_initial(

if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response)
error = self._deserialize.failsafe_deserialize(_models.CloudError, response)
raise HttpResponseError(response=response, model=error)

deserialized = None
Expand Down Expand Up @@ -268,7 +268,7 @@ async def get_operation_result(

if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response)
error = self._deserialize.failsafe_deserialize(_models.CloudError, response)
raise HttpResponseError(response=response, model=error)

if response.status_code == 200:
Expand Down Expand Up @@ -318,7 +318,7 @@ async def _delete_initial(

if response.status_code not in [200, 202, 409]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response)
error = self._deserialize.failsafe_deserialize(_models.CloudError, response)
raise HttpResponseError(response=response, model=error)

deserialized = None
Expand Down Expand Up @@ -439,7 +439,7 @@ async def get(

if response.status_code not in [200, 304]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response)
error = self._deserialize.failsafe_deserialize(_models.CloudError, response)
raise HttpResponseError(response=response, model=error)

deserialized = None
Expand Down Expand Up @@ -487,7 +487,7 @@ async def _create_initial(

if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response)
error = self._deserialize.failsafe_deserialize(_models.CloudError, response)
raise HttpResponseError(response=response, model=error)

deserialized = None
Expand Down Expand Up @@ -624,7 +624,7 @@ async def append(

if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, response)
error = self._deserialize.failsafe_deserialize(_models.CloudError, response)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
from ._models_py3 import CassandraTableDataset
from ._models_py3 import ChainingTrigger
from ._models_py3 import CloudError
from ._models_py3 import CloudErrorAutoGenerated
from ._models_py3 import CommonDataServiceForAppsEntityDataset
from ._models_py3 import CommonDataServiceForAppsLinkedService
from ._models_py3 import CommonDataServiceForAppsSink
Expand Down Expand Up @@ -718,7 +717,6 @@
from ._models import CassandraTableDataset # type: ignore
from ._models import ChainingTrigger # type: ignore
from ._models import CloudError # type: ignore
from ._models import CloudErrorAutoGenerated # type: ignore
from ._models import CommonDataServiceForAppsEntityDataset # type: ignore
from ._models import CommonDataServiceForAppsLinkedService # type: ignore
from ._models import CommonDataServiceForAppsSink # type: ignore
Expand Down Expand Up @@ -1427,7 +1425,6 @@
'CassandraTableDataset',
'ChainingTrigger',
'CloudError',
'CloudErrorAutoGenerated',
'CommonDataServiceForAppsEntityDataset',
'CommonDataServiceForAppsLinkedService',
'CommonDataServiceForAppsSink',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6963,44 +6963,6 @@ def __init__(
self.details = kwargs.get('details', None)


class CloudErrorAutoGenerated(msrest.serialization.Model):
"""The object that defines the structure of an Azure Synapse error response.

All required parameters must be populated in order to send to Azure.

:param code: Required. Error code.
:type code: str
:param message: Required. Error message.
:type message: str
:param target: Property name/path in request associated with error.
:type target: str
:param details: Array with additional error details.
:type details: list[~azure.synapse.artifacts.models.CloudErrorAutoGenerated]
"""

_validation = {
'code': {'required': True},
'message': {'required': True},
}

_attribute_map = {
'code': {'key': 'error.code', 'type': 'str'},
'message': {'key': 'error.message', 'type': 'str'},
'target': {'key': 'error.target', 'type': 'str'},
'details': {'key': 'error.details', 'type': '[CloudErrorAutoGenerated]'},
}

def __init__(
self,
**kwargs
):
super(CloudErrorAutoGenerated, self).__init__(**kwargs)
self.code = kwargs['code']
self.message = kwargs['message']
self.target = kwargs.get('target', None)
self.details = kwargs.get('details', None)


class CommonDataServiceForAppsEntityDataset(Dataset):
"""The Common Data Service for Apps entity dataset.

Expand Down Expand Up @@ -20617,7 +20579,7 @@ class OperationResult(msrest.serialization.Model):
:param target: Property name/path in request associated with error.
:type target: str
:param details: Array with additional error details.
:type details: list[~azure.synapse.artifacts.models.CloudErrorAutoGenerated]
:type details: list[~azure.synapse.artifacts.models.CloudError]
"""

_validation = {
Expand All @@ -20629,7 +20591,7 @@ class OperationResult(msrest.serialization.Model):
'code': {'key': 'error.code', 'type': 'str'},
'message': {'key': 'error.message', 'type': 'str'},
'target': {'key': 'error.target', 'type': 'str'},
'details': {'key': 'error.details', 'type': '[CloudErrorAutoGenerated]'},
'details': {'key': 'error.details', 'type': '[CloudError]'},
}

def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7961,49 +7961,6 @@ def __init__(
self.details = details


class CloudErrorAutoGenerated(msrest.serialization.Model):
"""The object that defines the structure of an Azure Synapse error response.

All required parameters must be populated in order to send to Azure.

:param code: Required. Error code.
:type code: str
:param message: Required. Error message.
:type message: str
:param target: Property name/path in request associated with error.
:type target: str
:param details: Array with additional error details.
:type details: list[~azure.synapse.artifacts.models.CloudErrorAutoGenerated]
"""

_validation = {
'code': {'required': True},
'message': {'required': True},
}

_attribute_map = {
'code': {'key': 'error.code', 'type': 'str'},
'message': {'key': 'error.message', 'type': 'str'},
'target': {'key': 'error.target', 'type': 'str'},
'details': {'key': 'error.details', 'type': '[CloudErrorAutoGenerated]'},
}

def __init__(
self,
*,
code: str,
message: str,
target: Optional[str] = None,
details: Optional[List["CloudErrorAutoGenerated"]] = None,
**kwargs
):
super(CloudErrorAutoGenerated, self).__init__(**kwargs)
self.code = code
self.message = message
self.target = target
self.details = details


class CommonDataServiceForAppsEntityDataset(Dataset):
"""The Common Data Service for Apps entity dataset.

Expand Down Expand Up @@ -23598,7 +23555,7 @@ class OperationResult(msrest.serialization.Model):
:param target: Property name/path in request associated with error.
:type target: str
:param details: Array with additional error details.
:type details: list[~azure.synapse.artifacts.models.CloudErrorAutoGenerated]
:type details: list[~azure.synapse.artifacts.models.CloudError]
"""

_validation = {
Expand All @@ -23610,7 +23567,7 @@ class OperationResult(msrest.serialization.Model):
'code': {'key': 'error.code', 'type': 'str'},
'message': {'key': 'error.message', 'type': 'str'},
'target': {'key': 'error.target', 'type': 'str'},
'details': {'key': 'error.details', 'type': '[CloudErrorAutoGenerated]'},
'details': {'key': 'error.details', 'type': '[CloudError]'},
}

def __init__(
Expand All @@ -23619,7 +23576,7 @@ def __init__(
code: Optional[str] = None,
message: Optional[str] = None,
target: Optional[str] = None,
details: Optional[List["CloudErrorAutoGenerated"]] = None,
details: Optional[List["CloudError"]] = None,
**kwargs
):
super(OperationResult, self).__init__(**kwargs)
Expand Down
Loading

0 comments on commit be4f3ef

Please sign in to comment.