metal-stack-api 0.4.2__tar.gz → 0.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/PKG-INFO +1 -1
  2. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metal_stack_api.egg-info/PKG-INFO +1 -1
  3. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metal_stack_api.egg-info/SOURCES.txt +1 -0
  4. metal_stack_api-0.4.3/metalstack/client/__init__.py +1 -0
  5. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/client/client.py +51 -46
  6. metal_stack_api-0.4.3/metalstack/client/test_interceptor.py +57 -0
  7. metal_stack_api-0.4.2/metalstack/infra/v2/__init__.py +0 -0
  8. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/README.md +0 -0
  9. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/buf/__init__.py +0 -0
  10. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/buf/validate/__init__.py +0 -0
  11. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/buf/validate/validate_pb2.py +0 -0
  12. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metal_stack_api.egg-info/dependency_links.txt +0 -0
  13. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metal_stack_api.egg-info/requires.txt +0 -0
  14. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metal_stack_api.egg-info/top_level.txt +0 -0
  15. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/__init__.py +0 -0
  16. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/__init__.py +0 -0
  17. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/__init__.py +0 -0
  18. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/audit_connect.py +0 -0
  19. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/audit_pb2.py +0 -0
  20. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/audit_pb2.pyi +0 -0
  21. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/component_connect.py +0 -0
  22. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/component_pb2.py +0 -0
  23. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/component_pb2.pyi +0 -0
  24. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/filesystem_connect.py +0 -0
  25. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/filesystem_pb2.py +0 -0
  26. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/filesystem_pb2.pyi +0 -0
  27. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/image_connect.py +0 -0
  28. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/image_pb2.py +0 -0
  29. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/image_pb2.pyi +0 -0
  30. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/ip_connect.py +0 -0
  31. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/ip_pb2.py +0 -0
  32. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/ip_pb2.pyi +0 -0
  33. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/machine_connect.py +0 -0
  34. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/machine_pb2.py +0 -0
  35. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/machine_pb2.pyi +0 -0
  36. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/network_connect.py +0 -0
  37. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/network_pb2.py +0 -0
  38. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/network_pb2.pyi +0 -0
  39. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/partition_connect.py +0 -0
  40. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/partition_pb2.py +0 -0
  41. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/partition_pb2.pyi +0 -0
  42. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/project_connect.py +0 -0
  43. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/project_pb2.py +0 -0
  44. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/project_pb2.pyi +0 -0
  45. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/size_connect.py +0 -0
  46. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/size_imageconstraint_connect.py +0 -0
  47. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/size_imageconstraint_pb2.py +0 -0
  48. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/size_imageconstraint_pb2.pyi +0 -0
  49. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/size_pb2.py +0 -0
  50. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/size_pb2.pyi +0 -0
  51. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/size_reservation_connect.py +0 -0
  52. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/size_reservation_pb2.py +0 -0
  53. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/size_reservation_pb2.pyi +0 -0
  54. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/switch_connect.py +0 -0
  55. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/switch_pb2.py +0 -0
  56. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/switch_pb2.pyi +0 -0
  57. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/task_connect.py +0 -0
  58. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/task_pb2.py +0 -0
  59. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/task_pb2.pyi +0 -0
  60. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/tenant_connect.py +0 -0
  61. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/tenant_pb2.py +0 -0
  62. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/tenant_pb2.pyi +0 -0
  63. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/token_connect.py +0 -0
  64. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/token_pb2.py +0 -0
  65. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/token_pb2.pyi +0 -0
  66. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/vpn_connect.py +0 -0
  67. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/vpn_pb2.py +0 -0
  68. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/admin/v2/vpn_pb2.pyi +0 -0
  69. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/__init__.py +0 -0
  70. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/__init__.py +0 -0
  71. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/audit_connect.py +0 -0
  72. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/audit_pb2.py +0 -0
  73. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/audit_pb2.pyi +0 -0
  74. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/common_pb2.py +0 -0
  75. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/common_pb2.pyi +0 -0
  76. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/component_pb2.py +0 -0
  77. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/component_pb2.pyi +0 -0
  78. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/filesystem_connect.py +0 -0
  79. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/filesystem_pb2.py +0 -0
  80. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/filesystem_pb2.pyi +0 -0
  81. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/health_connect.py +0 -0
  82. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/health_pb2.py +0 -0
  83. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/health_pb2.pyi +0 -0
  84. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/image_connect.py +0 -0
  85. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/image_pb2.py +0 -0
  86. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/image_pb2.pyi +0 -0
  87. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/ip_connect.py +0 -0
  88. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/ip_pb2.py +0 -0
  89. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/ip_pb2.pyi +0 -0
  90. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/machine_connect.py +0 -0
  91. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/machine_pb2.py +0 -0
  92. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/machine_pb2.pyi +0 -0
  93. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/method_connect.py +0 -0
  94. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/method_pb2.py +0 -0
  95. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/method_pb2.pyi +0 -0
  96. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/network_connect.py +0 -0
  97. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/network_pb2.py +0 -0
  98. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/network_pb2.pyi +0 -0
  99. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/partition_connect.py +0 -0
  100. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/partition_pb2.py +0 -0
  101. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/partition_pb2.pyi +0 -0
  102. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/predefined_rules_pb2.py +0 -0
  103. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/predefined_rules_pb2.pyi +0 -0
  104. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/project_connect.py +0 -0
  105. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/project_pb2.py +0 -0
  106. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/project_pb2.pyi +0 -0
  107. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/size_connect.py +0 -0
  108. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/size_imageconstraint_connect.py +0 -0
  109. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/size_imageconstraint_pb2.py +0 -0
  110. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/size_imageconstraint_pb2.pyi +0 -0
  111. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/size_pb2.py +0 -0
  112. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/size_pb2.pyi +0 -0
  113. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/size_reservation_connect.py +0 -0
  114. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/size_reservation_pb2.py +0 -0
  115. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/size_reservation_pb2.pyi +0 -0
  116. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/switch_pb2.py +0 -0
  117. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/switch_pb2.pyi +0 -0
  118. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/tenant_connect.py +0 -0
  119. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/tenant_pb2.py +0 -0
  120. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/tenant_pb2.pyi +0 -0
  121. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/token_connect.py +0 -0
  122. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/token_pb2.py +0 -0
  123. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/token_pb2.pyi +0 -0
  124. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/user_connect.py +0 -0
  125. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/user_pb2.py +0 -0
  126. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/user_pb2.pyi +0 -0
  127. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/version_connect.py +0 -0
  128. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/version_pb2.py +0 -0
  129. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/version_pb2.pyi +0 -0
  130. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/vpn_pb2.py +0 -0
  131. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/api/v2/vpn_pb2.pyi +0 -0
  132. {metal_stack_api-0.4.2/metalstack/client → metal_stack_api-0.4.3/metalstack/client/tests}/__init__.py +0 -0
  133. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/client/tests/conftest.py +0 -0
  134. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/client/tests/test_client.py +0 -0
  135. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/client/tests/test_interceptor.py +0 -0
  136. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/client/tests/test_ping.py +0 -0
  137. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/client/tests/test_token_persistent.py +0 -0
  138. {metal_stack_api-0.4.2/metalstack/client/tests → metal_stack_api-0.4.3/metalstack/infra}/__init__.py +0 -0
  139. {metal_stack_api-0.4.2/metalstack/infra → metal_stack_api-0.4.3/metalstack/infra/v2}/__init__.py +0 -0
  140. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/bmc_connect.py +0 -0
  141. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/bmc_pb2.py +0 -0
  142. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/bmc_pb2.pyi +0 -0
  143. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/boot_connect.py +0 -0
  144. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/boot_pb2.py +0 -0
  145. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/boot_pb2.pyi +0 -0
  146. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/component_connect.py +0 -0
  147. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/component_pb2.py +0 -0
  148. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/component_pb2.pyi +0 -0
  149. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/event_connect.py +0 -0
  150. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/event_pb2.py +0 -0
  151. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/event_pb2.pyi +0 -0
  152. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/switch_connect.py +0 -0
  153. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/switch_pb2.py +0 -0
  154. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/metalstack/infra/v2/switch_pb2.pyi +0 -0
  155. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/setup.cfg +0 -0
  156. {metal_stack_api-0.4.2 → metal_stack_api-0.4.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metal-stack-api
3
- Version: 0.4.2
3
+ Version: 0.4.3
4
4
  Summary: Python API client for metal-stack api
5
5
  Home-page: https://github.com/metal-stack/api
6
6
  Author: metal-stack authors
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metal-stack-api
3
- Version: 0.4.2
3
+ Version: 0.4.3
4
4
  Summary: Python API client for metal-stack api
5
5
  Home-page: https://github.com/metal-stack/api
6
6
  Author: metal-stack authors
@@ -127,6 +127,7 @@ metalstack/api/v2/vpn_pb2.py
127
127
  metalstack/api/v2/vpn_pb2.pyi
128
128
  metalstack/client/__init__.py
129
129
  metalstack/client/client.py
130
+ metalstack/client/test_interceptor.py
130
131
  metalstack/client/tests/__init__.py
131
132
  metalstack/client/tests/conftest.py
132
133
  metalstack/client/tests/test_client.py
@@ -46,9 +46,11 @@ import metalstack.infra.v2.switch_connect as infra_switch_connect
46
46
 
47
47
 
48
48
 
49
+
49
50
  class Client:
50
- def __init__(self, baseurl: str, timeout: float = 10):
51
+ def __init__(self, baseurl: str, timeout: float = 10, interceptors: list = []):
51
52
  self._baseurl = baseurl
53
+ self._interceptors = list(interceptors)
52
54
 
53
55
  transport = pyqwest.SyncHTTPTransport(
54
56
  http_version=pyqwest.HTTPVersion.HTTP2,
@@ -59,151 +61,154 @@ class Client:
59
61
 
60
62
 
61
63
  def adminv2(self):
62
- return self._Adminv2(baseurl=self._baseurl, client=self._client)
64
+ return self._Adminv2(baseurl=self._baseurl, client=self._client, interceptors=self._interceptors)
63
65
 
64
66
  def apiv2(self):
65
- return self._Apiv2(baseurl=self._baseurl, client=self._client)
67
+ return self._Apiv2(baseurl=self._baseurl, client=self._client, interceptors=self._interceptors)
66
68
 
67
69
  def infrav2(self):
68
- return self._Infrav2(baseurl=self._baseurl, client=self._client)
70
+ return self._Infrav2(baseurl=self._baseurl, client=self._client, interceptors=self._interceptors)
69
71
 
70
72
 
71
73
 
72
74
  class _Adminv2:
73
- def __init__(self, baseurl: str, client: pyqwest.SyncClient = None):
75
+ def __init__(self, baseurl: str, client: pyqwest.SyncClient = None, interceptors: list = []):
74
76
  self._baseurl = baseurl
75
77
  self._client = client
78
+ self._interceptors = list(interceptors)
76
79
 
77
80
 
78
81
  def audit(self):
79
- return admin_audit_connect.AuditServiceClientSync(address=self._baseurl, http_client=self._client)
82
+ return admin_audit_connect.AuditServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
80
83
 
81
84
  def component(self):
82
- return admin_component_connect.ComponentServiceClientSync(address=self._baseurl, http_client=self._client)
85
+ return admin_component_connect.ComponentServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
83
86
 
84
87
  def filesystem(self):
85
- return admin_filesystem_connect.FilesystemServiceClientSync(address=self._baseurl, http_client=self._client)
88
+ return admin_filesystem_connect.FilesystemServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
86
89
 
87
90
  def image(self):
88
- return admin_image_connect.ImageServiceClientSync(address=self._baseurl, http_client=self._client)
91
+ return admin_image_connect.ImageServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
89
92
 
90
93
  def ip(self):
91
- return admin_ip_connect.IPServiceClientSync(address=self._baseurl, http_client=self._client)
94
+ return admin_ip_connect.IPServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
92
95
 
93
96
  def machine(self):
94
- return admin_machine_connect.MachineServiceClientSync(address=self._baseurl, http_client=self._client)
97
+ return admin_machine_connect.MachineServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
95
98
 
96
99
  def network(self):
97
- return admin_network_connect.NetworkServiceClientSync(address=self._baseurl, http_client=self._client)
100
+ return admin_network_connect.NetworkServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
98
101
 
99
102
  def partition(self):
100
- return admin_partition_connect.PartitionServiceClientSync(address=self._baseurl, http_client=self._client)
103
+ return admin_partition_connect.PartitionServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
101
104
 
102
105
  def project(self):
103
- return admin_project_connect.ProjectServiceClientSync(address=self._baseurl, http_client=self._client)
106
+ return admin_project_connect.ProjectServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
104
107
 
105
108
  def size(self):
106
- return admin_size_connect.SizeServiceClientSync(address=self._baseurl, http_client=self._client)
109
+ return admin_size_connect.SizeServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
107
110
 
108
111
  def size_imageconstraint(self):
109
- return admin_size_imageconstraint_connect.SizeImageConstraintServiceClientSync(address=self._baseurl, http_client=self._client)
112
+ return admin_size_imageconstraint_connect.SizeImageConstraintServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
110
113
 
111
114
  def size_reservation(self):
112
- return admin_size_reservation_connect.SizeReservationServiceClientSync(address=self._baseurl, http_client=self._client)
115
+ return admin_size_reservation_connect.SizeReservationServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
113
116
 
114
117
  def switch(self):
115
- return admin_switch_connect.SwitchServiceClientSync(address=self._baseurl, http_client=self._client)
118
+ return admin_switch_connect.SwitchServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
116
119
 
117
120
  def task(self):
118
- return admin_task_connect.TaskServiceClientSync(address=self._baseurl, http_client=self._client)
121
+ return admin_task_connect.TaskServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
119
122
 
120
123
  def tenant(self):
121
- return admin_tenant_connect.TenantServiceClientSync(address=self._baseurl, http_client=self._client)
124
+ return admin_tenant_connect.TenantServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
122
125
 
123
126
  def token(self):
124
- return admin_token_connect.TokenServiceClientSync(address=self._baseurl, http_client=self._client)
127
+ return admin_token_connect.TokenServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
125
128
 
126
129
  def vpn(self):
127
- return admin_vpn_connect.VPNServiceClientSync(address=self._baseurl, http_client=self._client)
130
+ return admin_vpn_connect.VPNServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
128
131
 
129
132
 
130
133
  class _Apiv2:
131
- def __init__(self, baseurl: str, client: pyqwest.SyncClient = None):
134
+ def __init__(self, baseurl: str, client: pyqwest.SyncClient = None, interceptors: list = []):
132
135
  self._baseurl = baseurl
133
136
  self._client = client
137
+ self._interceptors = list(interceptors)
134
138
 
135
139
 
136
140
  def audit(self):
137
- return api_audit_connect.AuditServiceClientSync(address=self._baseurl, http_client=self._client)
141
+ return api_audit_connect.AuditServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
138
142
 
139
143
  def filesystem(self):
140
- return api_filesystem_connect.FilesystemServiceClientSync(address=self._baseurl, http_client=self._client)
144
+ return api_filesystem_connect.FilesystemServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
141
145
 
142
146
  def health(self):
143
- return api_health_connect.HealthServiceClientSync(address=self._baseurl, http_client=self._client)
147
+ return api_health_connect.HealthServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
144
148
 
145
149
  def image(self):
146
- return api_image_connect.ImageServiceClientSync(address=self._baseurl, http_client=self._client)
150
+ return api_image_connect.ImageServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
147
151
 
148
152
  def ip(self):
149
- return api_ip_connect.IPServiceClientSync(address=self._baseurl, http_client=self._client)
153
+ return api_ip_connect.IPServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
150
154
 
151
155
  def machine(self):
152
- return api_machine_connect.MachineServiceClientSync(address=self._baseurl, http_client=self._client)
156
+ return api_machine_connect.MachineServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
153
157
 
154
158
  def method(self):
155
- return api_method_connect.MethodServiceClientSync(address=self._baseurl, http_client=self._client)
159
+ return api_method_connect.MethodServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
156
160
 
157
161
  def network(self):
158
- return api_network_connect.NetworkServiceClientSync(address=self._baseurl, http_client=self._client)
162
+ return api_network_connect.NetworkServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
159
163
 
160
164
  def partition(self):
161
- return api_partition_connect.PartitionServiceClientSync(address=self._baseurl, http_client=self._client)
165
+ return api_partition_connect.PartitionServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
162
166
 
163
167
  def project(self):
164
- return api_project_connect.ProjectServiceClientSync(address=self._baseurl, http_client=self._client)
168
+ return api_project_connect.ProjectServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
165
169
 
166
170
  def size(self):
167
- return api_size_connect.SizeServiceClientSync(address=self._baseurl, http_client=self._client)
171
+ return api_size_connect.SizeServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
168
172
 
169
173
  def size_imageconstraint(self):
170
- return api_size_imageconstraint_connect.SizeImageConstraintServiceClientSync(address=self._baseurl, http_client=self._client)
174
+ return api_size_imageconstraint_connect.SizeImageConstraintServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
171
175
 
172
176
  def size_reservation(self):
173
- return api_size_reservation_connect.SizeReservationServiceClientSync(address=self._baseurl, http_client=self._client)
177
+ return api_size_reservation_connect.SizeReservationServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
174
178
 
175
179
  def tenant(self):
176
- return api_tenant_connect.TenantServiceClientSync(address=self._baseurl, http_client=self._client)
180
+ return api_tenant_connect.TenantServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
177
181
 
178
182
  def token(self):
179
- return api_token_connect.TokenServiceClientSync(address=self._baseurl, http_client=self._client)
183
+ return api_token_connect.TokenServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
180
184
 
181
185
  def user(self):
182
- return api_user_connect.UserServiceClientSync(address=self._baseurl, http_client=self._client)
186
+ return api_user_connect.UserServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
183
187
 
184
188
  def version(self):
185
- return api_version_connect.VersionServiceClientSync(address=self._baseurl, http_client=self._client)
189
+ return api_version_connect.VersionServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
186
190
 
187
191
 
188
192
  class _Infrav2:
189
- def __init__(self, baseurl: str, client: pyqwest.SyncClient = None):
193
+ def __init__(self, baseurl: str, client: pyqwest.SyncClient = None, interceptors: list = []):
190
194
  self._baseurl = baseurl
191
195
  self._client = client
196
+ self._interceptors = list(interceptors)
192
197
 
193
198
 
194
199
  def bmc(self):
195
- return infra_bmc_connect.BMCServiceClientSync(address=self._baseurl, http_client=self._client)
200
+ return infra_bmc_connect.BMCServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
196
201
 
197
202
  def boot(self):
198
- return infra_boot_connect.BootServiceClientSync(address=self._baseurl, http_client=self._client)
203
+ return infra_boot_connect.BootServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
199
204
 
200
205
  def component(self):
201
- return infra_component_connect.ComponentServiceClientSync(address=self._baseurl, http_client=self._client)
206
+ return infra_component_connect.ComponentServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
202
207
 
203
208
  def event(self):
204
- return infra_event_connect.EventServiceClientSync(address=self._baseurl, http_client=self._client)
209
+ return infra_event_connect.EventServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
205
210
 
206
211
  def switch(self):
207
- return infra_switch_connect.SwitchServiceClientSync(address=self._baseurl, http_client=self._client)
212
+ return infra_switch_connect.SwitchServiceClientSync(address=self._baseurl, http_client=self._client, interceptors=self._interceptors)
208
213
 
209
214
 
@@ -0,0 +1,57 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+
5
+ from connectrpc.interceptor import UnaryInterceptorSync
6
+ from google.protobuf.json_format import MessageToDict
7
+ from google.protobuf.message import Message
8
+
9
+
10
+ def _messages_equal(a: Message, b: Message) -> bool:
11
+ return MessageToDict(a, preserving_proto_field_name=True) == MessageToDict(
12
+ b, preserving_proto_field_name=True
13
+ )
14
+
15
+
16
+ @dataclass
17
+ class RpcCall:
18
+ request: Message | None = None
19
+ response: Message | None = None
20
+ error: Exception | None = None
21
+
22
+
23
+ class TestClientInterceptor(UnaryInterceptorSync):
24
+ def __init__(self, calls: list[RpcCall] | None = None):
25
+ self._calls: list[RpcCall] = list(calls) if calls else []
26
+ self._call_count: int = 0
27
+
28
+ def intercept_unary_sync(self, call_next, request, ctx):
29
+ if self._call_count >= len(self._calls):
30
+ raise AssertionError(
31
+ f"unexpected RPC call #{self._call_count}: {request.DESCRIPTOR.full_name}"
32
+ )
33
+
34
+ expected = self._calls[self._call_count]
35
+ self._call_count += 1
36
+
37
+ if expected.request is not None and not _messages_equal(expected.request, request):
38
+ import json
39
+
40
+ raise AssertionError(
41
+ f"request mismatch for {request.DESCRIPTOR.full_name}\n"
42
+ f" expected: {json.dumps(MessageToDict(expected.request, preserving_proto_field_name=True), indent=2)}\n"
43
+ f" got: {json.dumps(MessageToDict(request, preserving_proto_field_name=True), indent=2)}"
44
+ )
45
+
46
+ if expected.error is not None:
47
+ raise expected.error
48
+
49
+ return expected.response
50
+
51
+ def assert_all_calls_used(self):
52
+ remaining = len(self._calls) - self._call_count
53
+ if remaining != 0:
54
+ raise AssertionError(
55
+ f"{remaining} expected RPC call(s) were not made "
56
+ f"(made {self._call_count} of {len(self._calls)})"
57
+ )
File without changes