|
59 | 59 | build_pilots_clear_pilots_request,
|
60 | 60 | build_pilots_create_pilot_secrets_request,
|
61 | 61 | build_pilots_delete_pilots_request,
|
| 62 | + build_pilots_get_logs_request, |
62 | 63 | build_pilots_pilot_login_request,
|
63 | 64 | build_pilots_refresh_pilot_tokens_request,
|
64 | 65 | build_pilots_search_request,
|
| 66 | + build_pilots_send_message_request, |
65 | 67 | build_pilots_update_pilot_fields_request,
|
66 | 68 | build_well_known_get_installation_metadata_request,
|
67 | 69 | build_well_known_get_jwks_request,
|
@@ -3470,3 +3472,166 @@ async def refresh_pilot_tokens(
|
3470 | 3472 | return cls(pipeline_response, deserialized, {}) # type: ignore
|
3471 | 3473 |
|
3472 | 3474 | return deserialized # type: ignore
|
| 3475 | + |
| 3476 | + @overload |
| 3477 | + async def send_message( |
| 3478 | + self, |
| 3479 | + body: _models.LogMessage, |
| 3480 | + *, |
| 3481 | + content_type: str = "application/json", |
| 3482 | + **kwargs: Any, |
| 3483 | + ) -> int: |
| 3484 | + """Send Message. |
| 3485 | +
|
| 3486 | + Send Message. |
| 3487 | +
|
| 3488 | + :param body: Required. |
| 3489 | + :type body: ~_generated.models.LogMessage |
| 3490 | + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. |
| 3491 | + Default value is "application/json". |
| 3492 | + :paramtype content_type: str |
| 3493 | + :return: int |
| 3494 | + :rtype: int |
| 3495 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 3496 | + """ |
| 3497 | + |
| 3498 | + @overload |
| 3499 | + async def send_message( |
| 3500 | + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any |
| 3501 | + ) -> int: |
| 3502 | + """Send Message. |
| 3503 | +
|
| 3504 | + Send Message. |
| 3505 | +
|
| 3506 | + :param body: Required. |
| 3507 | + :type body: IO[bytes] |
| 3508 | + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. |
| 3509 | + Default value is "application/json". |
| 3510 | + :paramtype content_type: str |
| 3511 | + :return: int |
| 3512 | + :rtype: int |
| 3513 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 3514 | + """ |
| 3515 | + |
| 3516 | + @distributed_trace_async |
| 3517 | + async def send_message( |
| 3518 | + self, body: Union[_models.LogMessage, IO[bytes]], **kwargs: Any |
| 3519 | + ) -> int: |
| 3520 | + """Send Message. |
| 3521 | +
|
| 3522 | + Send Message. |
| 3523 | +
|
| 3524 | + :param body: Is either a LogMessage type or a IO[bytes] type. Required. |
| 3525 | + :type body: ~_generated.models.LogMessage or IO[bytes] |
| 3526 | + :return: int |
| 3527 | + :rtype: int |
| 3528 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 3529 | + """ |
| 3530 | + error_map: MutableMapping = { |
| 3531 | + 401: ClientAuthenticationError, |
| 3532 | + 404: ResourceNotFoundError, |
| 3533 | + 409: ResourceExistsError, |
| 3534 | + 304: ResourceNotModifiedError, |
| 3535 | + } |
| 3536 | + error_map.update(kwargs.pop("error_map", {}) or {}) |
| 3537 | + |
| 3538 | + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) |
| 3539 | + _params = kwargs.pop("params", {}) or {} |
| 3540 | + |
| 3541 | + content_type: Optional[str] = kwargs.pop( |
| 3542 | + "content_type", _headers.pop("Content-Type", None) |
| 3543 | + ) |
| 3544 | + cls: ClsType[int] = kwargs.pop("cls", None) |
| 3545 | + |
| 3546 | + content_type = content_type or "application/json" |
| 3547 | + _json = None |
| 3548 | + _content = None |
| 3549 | + if isinstance(body, (IOBase, bytes)): |
| 3550 | + _content = body |
| 3551 | + else: |
| 3552 | + _json = self._serialize.body(body, "LogMessage") |
| 3553 | + |
| 3554 | + _request = build_pilots_send_message_request( |
| 3555 | + content_type=content_type, |
| 3556 | + json=_json, |
| 3557 | + content=_content, |
| 3558 | + headers=_headers, |
| 3559 | + params=_params, |
| 3560 | + ) |
| 3561 | + _request.url = self._client.format_url(_request.url) |
| 3562 | + |
| 3563 | + _stream = False |
| 3564 | + pipeline_response: PipelineResponse = ( |
| 3565 | + await self._client._pipeline.run( # pylint: disable=protected-access |
| 3566 | + _request, stream=_stream, **kwargs |
| 3567 | + ) |
| 3568 | + ) |
| 3569 | + |
| 3570 | + response = pipeline_response.http_response |
| 3571 | + |
| 3572 | + if response.status_code not in [200]: |
| 3573 | + map_error( |
| 3574 | + status_code=response.status_code, response=response, error_map=error_map |
| 3575 | + ) |
| 3576 | + raise HttpResponseError(response=response) |
| 3577 | + |
| 3578 | + deserialized = self._deserialize("int", pipeline_response.http_response) |
| 3579 | + |
| 3580 | + if cls: |
| 3581 | + return cls(pipeline_response, deserialized, {}) # type: ignore |
| 3582 | + |
| 3583 | + return deserialized # type: ignore |
| 3584 | + |
| 3585 | + @distributed_trace_async |
| 3586 | + async def get_logs(self, *, pilot_id: int, **kwargs: Any) -> List[Dict[str, Any]]: |
| 3587 | + """Get Logs. |
| 3588 | +
|
| 3589 | + Get Logs. |
| 3590 | +
|
| 3591 | + :keyword pilot_id: Required. |
| 3592 | + :paramtype pilot_id: int |
| 3593 | + :return: list of dict mapping str to any |
| 3594 | + :rtype: list[dict[str, any]] |
| 3595 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 3596 | + """ |
| 3597 | + error_map: MutableMapping = { |
| 3598 | + 401: ClientAuthenticationError, |
| 3599 | + 404: ResourceNotFoundError, |
| 3600 | + 409: ResourceExistsError, |
| 3601 | + 304: ResourceNotModifiedError, |
| 3602 | + } |
| 3603 | + error_map.update(kwargs.pop("error_map", {}) or {}) |
| 3604 | + |
| 3605 | + _headers = kwargs.pop("headers", {}) or {} |
| 3606 | + _params = kwargs.pop("params", {}) or {} |
| 3607 | + |
| 3608 | + cls: ClsType[List[Dict[str, Any]]] = kwargs.pop("cls", None) |
| 3609 | + |
| 3610 | + _request = build_pilots_get_logs_request( |
| 3611 | + pilot_id=pilot_id, |
| 3612 | + headers=_headers, |
| 3613 | + params=_params, |
| 3614 | + ) |
| 3615 | + _request.url = self._client.format_url(_request.url) |
| 3616 | + |
| 3617 | + _stream = False |
| 3618 | + pipeline_response: PipelineResponse = ( |
| 3619 | + await self._client._pipeline.run( # pylint: disable=protected-access |
| 3620 | + _request, stream=_stream, **kwargs |
| 3621 | + ) |
| 3622 | + ) |
| 3623 | + |
| 3624 | + response = pipeline_response.http_response |
| 3625 | + |
| 3626 | + if response.status_code not in [200]: |
| 3627 | + map_error( |
| 3628 | + status_code=response.status_code, response=response, error_map=error_map |
| 3629 | + ) |
| 3630 | + raise HttpResponseError(response=response) |
| 3631 | + |
| 3632 | + deserialized = self._deserialize("[{object}]", pipeline_response.http_response) |
| 3633 | + |
| 3634 | + if cls: |
| 3635 | + return cls(pipeline_response, deserialized, {}) # type: ignore |
| 3636 | + |
| 3637 | + return deserialized # type: ignore |
0 commit comments