status_pb.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # Generated from google/rpc/status.proto. DO NOT EDIT.
  2. # Generated by protoc-gen-py v0.1.1 with parameter "".
  3. # ruff: noqa: PGH004
  4. # ruff: noqa
  5. # fmt: off
  6. from __future__ import annotations
  7. from typing import Literal, TYPE_CHECKING, TypeAlias
  8. from protobuf import Message
  9. from protobuf._codegen import file_desc
  10. from protobuf.wkt import any_pb
  11. if TYPE_CHECKING:
  12. from protobuf import DescFile
  13. from protobuf.wkt import Any
  14. _StatusFields: TypeAlias = Literal["code", "message", "details"]
  15. class Status(Message[_StatusFields]):
  16. """
  17. The `Status` type defines a logical error model that is suitable for
  18. different programming environments, including REST APIs and RPC APIs. It is
  19. used by [gRPC](https://github.com/grpc). Each `Status` message contains
  20. three pieces of data: error code, error message, and error details.
  21. You can find out more about this error model and how to work with it in the
  22. [API Design Guide](https://cloud.google.com/apis/design/errors).
  23. ```proto
  24. message google.rpc.Status
  25. ```
  26. Attributes:
  27. code:
  28. The status code, which should be an enum value of
  29. [google.rpc.Code][google.rpc.Code].
  30. ```proto
  31. int32 code = 1;
  32. ```
  33. message:
  34. A developer-facing error message, which should be in English. Any
  35. user-facing error message should be localized and sent in the
  36. [google.rpc.Status.details][google.rpc.Status.details] field, or localized
  37. by the client.
  38. ```proto
  39. string message = 2;
  40. ```
  41. details:
  42. A list of messages that carry the error details. There is a common set of
  43. message types for APIs to use.
  44. ```proto
  45. repeated google.protobuf.Any details = 3;
  46. ```
  47. """
  48. __slots__ = ("code", "message", "details")
  49. if TYPE_CHECKING:
  50. def __init__(
  51. self,
  52. *,
  53. code: int = 0,
  54. message: str = "",
  55. details: list[Any] | None = None,
  56. ) -> None:
  57. pass
  58. code: int
  59. message: str
  60. details: list[Any]
  61. _DESC = file_desc(
  62. b'\n\x17google/rpc/status.proto\x12\ngoogle.rpc\x1a\x19google/protobuf/any.proto"f\n\x06Status\x12\x12\n\x04code\x18\x01 \x01(\x05R\x04code\x12\x18\n\x07message\x18\x02 \x01(\tR\x07message\x12.\n\x07details\x18\x03 \x03(\x0b2\x14.google.protobuf.AnyR\x07detailsB^\n\x0ecom.google.rpcB\x0bStatusProtoP\x01Z7google.golang.org/genproto/googleapis/rpc/status;status\xa2\x02\x03RPCb\x06proto3',
  63. [
  64. any_pb.desc(),
  65. ],
  66. {
  67. "Status": Status,
  68. },
  69. )
  70. def desc() -> DescFile:
  71. """Returns the descriptor for the file `google/rpc/status.proto`."""
  72. return _DESC