Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,25 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position

from ._patch import LogsIngestionClient
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._patch import LogsUploadError
from ._client import LogsIngestionClient # type: ignore

try:
from ._patch import __all__ as _patch_all
from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"LogsUploadError",
"LogsIngestionClient",
]

__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from copy import deepcopy
from typing import Any, TYPE_CHECKING
from typing_extensions import Self

from azure.core import PipelineClient
from azure.core.pipeline import policies
Expand All @@ -18,11 +19,10 @@
from ._serialization import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential


class LogsIngestionClient(LogsIngestionClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
class LogsIngestionClient(LogsIngestionClientOperationsMixin):
"""Azure Monitor Data Collection Python Client.

:param endpoint: The Data Collection Endpoint for the Data Collection Rule, for example
Expand Down Expand Up @@ -90,7 +90,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
def close(self) -> None:
self._client.close()

def __enter__(self) -> "LogsIngestionClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
from azure.core.pipeline import policies

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential

VERSION = "unknown"


class LogsIngestionClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
class LogsIngestionClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for LogsIngestionClient.

Note that all parameters used to create this instance are saved as instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position

from ._patch import LogsIngestionClientOperationsMixin
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._operations import LogsIngestionClientOperationsMixin # type: ignore

from ._patch import __all__ as _patch_all
from ._patch import *
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"LogsIngestionClientOperationsMixin",
]

__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand All @@ -8,7 +7,7 @@
# --------------------------------------------------------------------------
from io import IOBase
import sys
from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload
from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload

from azure.core.exceptions import (
ClientAuthenticationError,
Expand All @@ -29,7 +28,7 @@
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
from typing import MutableMapping # type: ignore
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
Expand Down Expand Up @@ -71,8 +70,9 @@ def build_logs_ingestion_upload_request(


class LogsIngestionClientOperationsMixin(LogsIngestionClientMixinABC):

@overload
def _upload( # pylint: disable=inconsistent-return-statements
def _upload(
self,
rule_id: str,
stream: str,
Expand All @@ -82,9 +82,8 @@ def _upload( # pylint: disable=inconsistent-return-statements
content_type: str = "application/json",
**kwargs: Any
) -> None: ...

@overload
def _upload( # pylint: disable=inconsistent-return-statements
def _upload(
self,
rule_id: str,
stream: str,
Expand Down Expand Up @@ -122,7 +121,7 @@ def _upload( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -168,8 +167,6 @@ def _upload( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response

if response.status_code not in [204]:
if _stream:
response.read() # Load the body in memory and close the socket
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response)

Expand Down
Loading