|
55 | 55 | build_pilots_add_pilot_stamps_request,
|
56 | 56 | build_pilots_delete_pilots_request,
|
57 | 57 | build_pilots_get_pilot_jobs_request,
|
| 58 | + build_pilots_legacy_send_message_request, |
| 59 | + build_pilots_search_logs_request, |
58 | 60 | build_pilots_search_request,
|
59 | 61 | build_pilots_summary_request,
|
60 | 62 | build_pilots_update_pilot_fields_request,
|
@@ -2649,6 +2651,143 @@ async def search(
|
2649 | 2651 |
|
2650 | 2652 | return deserialized # type: ignore
|
2651 | 2653 |
|
| 2654 | + @overload |
| 2655 | + async def search_logs( |
| 2656 | + self, |
| 2657 | + body: Optional[_models.SearchParams] = None, |
| 2658 | + *, |
| 2659 | + page: int = 1, |
| 2660 | + per_page: int = 100, |
| 2661 | + content_type: str = "application/json", |
| 2662 | + **kwargs: Any |
| 2663 | + ) -> List[Dict[str, Any]]: |
| 2664 | + """Search Logs. |
| 2665 | +
|
| 2666 | + Search Logs. |
| 2667 | +
|
| 2668 | + :param body: Default value is None. |
| 2669 | + :type body: ~_generated.models.SearchParams |
| 2670 | + :keyword page: Default value is 1. |
| 2671 | + :paramtype page: int |
| 2672 | + :keyword per_page: Default value is 100. |
| 2673 | + :paramtype per_page: int |
| 2674 | + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. |
| 2675 | + Default value is "application/json". |
| 2676 | + :paramtype content_type: str |
| 2677 | + :return: list of dict mapping str to any |
| 2678 | + :rtype: list[dict[str, any]] |
| 2679 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2680 | + """ |
| 2681 | + |
| 2682 | + @overload |
| 2683 | + async def search_logs( |
| 2684 | + self, |
| 2685 | + body: Optional[IO[bytes]] = None, |
| 2686 | + *, |
| 2687 | + page: int = 1, |
| 2688 | + per_page: int = 100, |
| 2689 | + content_type: str = "application/json", |
| 2690 | + **kwargs: Any |
| 2691 | + ) -> List[Dict[str, Any]]: |
| 2692 | + """Search Logs. |
| 2693 | +
|
| 2694 | + Search Logs. |
| 2695 | +
|
| 2696 | + :param body: Default value is None. |
| 2697 | + :type body: IO[bytes] |
| 2698 | + :keyword page: Default value is 1. |
| 2699 | + :paramtype page: int |
| 2700 | + :keyword per_page: Default value is 100. |
| 2701 | + :paramtype per_page: int |
| 2702 | + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. |
| 2703 | + Default value is "application/json". |
| 2704 | + :paramtype content_type: str |
| 2705 | + :return: list of dict mapping str to any |
| 2706 | + :rtype: list[dict[str, any]] |
| 2707 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2708 | + """ |
| 2709 | + |
| 2710 | + @distributed_trace_async |
| 2711 | + async def search_logs( |
| 2712 | + self, |
| 2713 | + body: Optional[Union[_models.SearchParams, IO[bytes]]] = None, |
| 2714 | + *, |
| 2715 | + page: int = 1, |
| 2716 | + per_page: int = 100, |
| 2717 | + **kwargs: Any |
| 2718 | + ) -> List[Dict[str, Any]]: |
| 2719 | + """Search Logs. |
| 2720 | +
|
| 2721 | + Search Logs. |
| 2722 | +
|
| 2723 | + :param body: Is either a SearchParams type or a IO[bytes] type. Default value is None. |
| 2724 | + :type body: ~_generated.models.SearchParams or IO[bytes] |
| 2725 | + :keyword page: Default value is 1. |
| 2726 | + :paramtype page: int |
| 2727 | + :keyword per_page: Default value is 100. |
| 2728 | + :paramtype per_page: int |
| 2729 | + :return: list of dict mapping str to any |
| 2730 | + :rtype: list[dict[str, any]] |
| 2731 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2732 | + """ |
| 2733 | + error_map: MutableMapping = { |
| 2734 | + 401: ClientAuthenticationError, |
| 2735 | + 404: ResourceNotFoundError, |
| 2736 | + 409: ResourceExistsError, |
| 2737 | + 304: ResourceNotModifiedError, |
| 2738 | + } |
| 2739 | + error_map.update(kwargs.pop("error_map", {}) or {}) |
| 2740 | + |
| 2741 | + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) |
| 2742 | + _params = kwargs.pop("params", {}) or {} |
| 2743 | + |
| 2744 | + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) |
| 2745 | + cls: ClsType[List[Dict[str, Any]]] = kwargs.pop("cls", None) |
| 2746 | + |
| 2747 | + content_type = content_type or "application/json" |
| 2748 | + _json = None |
| 2749 | + _content = None |
| 2750 | + if isinstance(body, (IOBase, bytes)): |
| 2751 | + _content = body |
| 2752 | + else: |
| 2753 | + if body is not None: |
| 2754 | + _json = self._serialize.body(body, "SearchParams") |
| 2755 | + else: |
| 2756 | + _json = None |
| 2757 | + |
| 2758 | + _request = build_pilots_search_logs_request( |
| 2759 | + page=page, |
| 2760 | + per_page=per_page, |
| 2761 | + content_type=content_type, |
| 2762 | + json=_json, |
| 2763 | + content=_content, |
| 2764 | + headers=_headers, |
| 2765 | + params=_params, |
| 2766 | + ) |
| 2767 | + _request.url = self._client.format_url(_request.url) |
| 2768 | + |
| 2769 | + _stream = False |
| 2770 | + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access |
| 2771 | + _request, stream=_stream, **kwargs |
| 2772 | + ) |
| 2773 | + |
| 2774 | + response = pipeline_response.http_response |
| 2775 | + |
| 2776 | + if response.status_code not in [200, 206]: |
| 2777 | + map_error(status_code=response.status_code, response=response, error_map=error_map) |
| 2778 | + raise HttpResponseError(response=response) |
| 2779 | + |
| 2780 | + response_headers = {} |
| 2781 | + if response.status_code == 206: |
| 2782 | + response_headers["Content-Range"] = self._deserialize("str", response.headers.get("Content-Range")) |
| 2783 | + |
| 2784 | + deserialized = self._deserialize("[{object}]", pipeline_response.http_response) |
| 2785 | + |
| 2786 | + if cls: |
| 2787 | + return cls(pipeline_response, deserialized, response_headers) # type: ignore |
| 2788 | + |
| 2789 | + return deserialized # type: ignore |
| 2790 | + |
2652 | 2791 | @overload
|
2653 | 2792 | async def summary(
|
2654 | 2793 | self, body: _models.SummaryParams, *, content_type: str = "application/json", **kwargs: Any
|
@@ -2743,3 +2882,114 @@ async def summary(self, body: Union[_models.SummaryParams, IO[bytes]], **kwargs:
|
2743 | 2882 | return cls(pipeline_response, deserialized, {}) # type: ignore
|
2744 | 2883 |
|
2745 | 2884 | return deserialized # type: ignore
|
| 2885 | + |
| 2886 | + |
| 2887 | +class PilotsLegacyOperations: |
| 2888 | + """ |
| 2889 | + .. warning:: |
| 2890 | + **DO NOT** instantiate this class directly. |
| 2891 | +
|
| 2892 | + Instead, you should access the following operations through |
| 2893 | + :class:`~_generated.aio.Dirac`'s |
| 2894 | + :attr:`pilots_legacy` attribute. |
| 2895 | + """ |
| 2896 | + |
| 2897 | + models = _models |
| 2898 | + |
| 2899 | + def __init__(self, *args, **kwargs) -> None: |
| 2900 | + input_args = list(args) |
| 2901 | + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") |
| 2902 | + self._config: DiracConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") |
| 2903 | + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") |
| 2904 | + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") |
| 2905 | + |
| 2906 | + @overload |
| 2907 | + async def send_message( |
| 2908 | + self, body: _models.BodyPilotsLegacySendMessage, *, content_type: str = "application/json", **kwargs: Any |
| 2909 | + ) -> None: |
| 2910 | + """Send Message. |
| 2911 | +
|
| 2912 | + Send logs with legacy pilot. |
| 2913 | +
|
| 2914 | + :param body: Required. |
| 2915 | + :type body: ~_generated.models.BodyPilotsLegacySendMessage |
| 2916 | + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. |
| 2917 | + Default value is "application/json". |
| 2918 | + :paramtype content_type: str |
| 2919 | + :return: None |
| 2920 | + :rtype: None |
| 2921 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2922 | + """ |
| 2923 | + |
| 2924 | + @overload |
| 2925 | + async def send_message(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: |
| 2926 | + """Send Message. |
| 2927 | +
|
| 2928 | + Send logs with legacy pilot. |
| 2929 | +
|
| 2930 | + :param body: Required. |
| 2931 | + :type body: IO[bytes] |
| 2932 | + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. |
| 2933 | + Default value is "application/json". |
| 2934 | + :paramtype content_type: str |
| 2935 | + :return: None |
| 2936 | + :rtype: None |
| 2937 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2938 | + """ |
| 2939 | + |
| 2940 | + @distributed_trace_async |
| 2941 | + async def send_message(self, body: Union[_models.BodyPilotsLegacySendMessage, IO[bytes]], **kwargs: Any) -> None: |
| 2942 | + """Send Message. |
| 2943 | +
|
| 2944 | + Send logs with legacy pilot. |
| 2945 | +
|
| 2946 | + :param body: Is either a BodyPilotsLegacySendMessage type or a IO[bytes] type. Required. |
| 2947 | + :type body: ~_generated.models.BodyPilotsLegacySendMessage or IO[bytes] |
| 2948 | + :return: None |
| 2949 | + :rtype: None |
| 2950 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2951 | + """ |
| 2952 | + error_map: MutableMapping = { |
| 2953 | + 401: ClientAuthenticationError, |
| 2954 | + 404: ResourceNotFoundError, |
| 2955 | + 409: ResourceExistsError, |
| 2956 | + 304: ResourceNotModifiedError, |
| 2957 | + } |
| 2958 | + error_map.update(kwargs.pop("error_map", {}) or {}) |
| 2959 | + |
| 2960 | + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) |
| 2961 | + _params = kwargs.pop("params", {}) or {} |
| 2962 | + |
| 2963 | + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) |
| 2964 | + cls: ClsType[None] = kwargs.pop("cls", None) |
| 2965 | + |
| 2966 | + content_type = content_type or "application/json" |
| 2967 | + _json = None |
| 2968 | + _content = None |
| 2969 | + if isinstance(body, (IOBase, bytes)): |
| 2970 | + _content = body |
| 2971 | + else: |
| 2972 | + _json = self._serialize.body(body, "BodyPilotsLegacySendMessage") |
| 2973 | + |
| 2974 | + _request = build_pilots_legacy_send_message_request( |
| 2975 | + content_type=content_type, |
| 2976 | + json=_json, |
| 2977 | + content=_content, |
| 2978 | + headers=_headers, |
| 2979 | + params=_params, |
| 2980 | + ) |
| 2981 | + _request.url = self._client.format_url(_request.url) |
| 2982 | + |
| 2983 | + _stream = False |
| 2984 | + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access |
| 2985 | + _request, stream=_stream, **kwargs |
| 2986 | + ) |
| 2987 | + |
| 2988 | + response = pipeline_response.http_response |
| 2989 | + |
| 2990 | + if response.status_code not in [204]: |
| 2991 | + map_error(status_code=response.status_code, response=response, error_map=error_map) |
| 2992 | + raise HttpResponseError(response=response) |
| 2993 | + |
| 2994 | + if cls: |
| 2995 | + return cls(pipeline_response, None, {}) # type: ignore |
0 commit comments