couchbase 3.7.0 → 3.8.0

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 (286) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/ext/CMakeLists.txt +4 -1
  4. data/ext/cache/extconf_include.rb +4 -3
  5. data/ext/cache/mozilla-ca-bundle.crt +66 -93
  6. data/ext/cache/mozilla-ca-bundle.sha256 +1 -1
  7. data/ext/couchbase/CMakeLists.txt +24 -11
  8. data/ext/couchbase/cmake/APKBUILD.in +17 -1
  9. data/ext/couchbase/cmake/Bundler.cmake +9 -1
  10. data/ext/couchbase/cmake/Cache.cmake +48 -19
  11. data/ext/couchbase/cmake/CompilerOptions.cmake +3 -1
  12. data/ext/couchbase/cmake/OpenSSL.cmake +10 -2
  13. data/ext/couchbase/cmake/Packaging.cmake +48 -8
  14. data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +43 -1
  15. data/ext/couchbase/cmake/build_config.hxx.in +2 -0
  16. data/ext/couchbase/cmake/couchbase-cxx-client.spec.in +18 -0
  17. data/ext/couchbase/cmake/tarball_glob.txt +10 -0
  18. data/ext/couchbase/core/app_telemetry_meter.cxx +1 -0
  19. data/ext/couchbase/core/app_telemetry_reporter.cxx +45 -43
  20. data/ext/couchbase/core/app_telemetry_reporter.hxx +4 -3
  21. data/ext/couchbase/core/bucket.cxx +128 -13
  22. data/ext/couchbase/core/bucket.hxx +12 -2
  23. data/ext/couchbase/core/cluster.cxx +304 -152
  24. data/ext/couchbase/core/cluster.hxx +32 -0
  25. data/ext/couchbase/core/cluster_credentials.cxx +25 -0
  26. data/ext/couchbase/core/cluster_credentials.hxx +5 -0
  27. data/ext/couchbase/core/cluster_label_listener.cxx +72 -0
  28. data/ext/couchbase/core/cluster_label_listener.hxx +46 -0
  29. data/ext/couchbase/core/cluster_options.hxx +4 -0
  30. data/ext/couchbase/core/deprecation_utils.hxx +26 -0
  31. data/ext/couchbase/core/error.hxx +27 -0
  32. data/ext/couchbase/core/free_form_http_request.hxx +0 -2
  33. data/ext/couchbase/core/http_component.cxx +12 -48
  34. data/ext/couchbase/core/impl/analytics.cxx +3 -2
  35. data/ext/couchbase/core/impl/analytics.hxx +2 -1
  36. data/ext/couchbase/core/impl/analytics_index_manager.cxx +249 -137
  37. data/ext/couchbase/core/impl/binary_collection.cxx +134 -58
  38. data/ext/couchbase/core/impl/bucket_manager.cxx +87 -35
  39. data/ext/couchbase/core/impl/collection.cxx +560 -245
  40. data/ext/couchbase/core/impl/collection_manager.cxx +89 -49
  41. data/ext/couchbase/core/impl/dns_srv_tracker.cxx +4 -4
  42. data/ext/couchbase/core/impl/error.cxx +20 -13
  43. data/ext/couchbase/core/impl/error.hxx +15 -10
  44. data/ext/couchbase/core/impl/get_all_replicas.hxx +1 -1
  45. data/ext/couchbase/core/impl/get_any_replica.hxx +2 -1
  46. data/ext/couchbase/core/impl/get_replica.hxx +2 -0
  47. data/ext/couchbase/core/impl/lookup_in_replica.hxx +1 -1
  48. data/ext/couchbase/core/impl/observability_recorder.cxx +161 -0
  49. data/ext/couchbase/core/impl/observability_recorder.hxx +77 -0
  50. data/ext/couchbase/core/impl/observe_seqno.hxx +2 -0
  51. data/ext/couchbase/core/impl/public_bucket.cxx +31 -7
  52. data/ext/couchbase/core/impl/public_cluster.cxx +107 -19
  53. data/ext/couchbase/core/impl/query.cxx +6 -3
  54. data/ext/couchbase/core/impl/query.hxx +3 -1
  55. data/ext/couchbase/core/impl/query_index_manager.cxx +267 -102
  56. data/ext/couchbase/core/impl/scope.cxx +53 -11
  57. data/ext/couchbase/core/impl/search.cxx +8 -4
  58. data/ext/couchbase/core/impl/search.hxx +6 -2
  59. data/ext/couchbase/core/impl/search_index_manager.cxx +131 -41
  60. data/ext/couchbase/core/impl/with_cancellation.hxx +75 -0
  61. data/ext/couchbase/core/io/config_tracker.cxx +9 -9
  62. data/ext/couchbase/core/io/config_tracker.hxx +2 -1
  63. data/ext/couchbase/core/io/http_command.hxx +98 -49
  64. data/ext/couchbase/core/io/http_context.hxx +2 -0
  65. data/ext/couchbase/core/io/http_session.cxx +23 -10
  66. data/ext/couchbase/core/io/http_session.hxx +17 -9
  67. data/ext/couchbase/core/io/http_session_manager.hxx +163 -228
  68. data/ext/couchbase/core/io/http_traits.hxx +0 -7
  69. data/ext/couchbase/core/io/mcbp_command.hxx +123 -44
  70. data/ext/couchbase/core/io/mcbp_session.cxx +251 -26
  71. data/ext/couchbase/core/io/mcbp_session.hxx +9 -1
  72. data/ext/couchbase/core/io/mcbp_traits.hxx +0 -8
  73. data/ext/couchbase/core/io/streams.cxx +3 -3
  74. data/ext/couchbase/core/io/streams.hxx +3 -2
  75. data/ext/couchbase/core/meta/features.hxx +15 -0
  76. data/ext/couchbase/core/meta/version.cxx +13 -0
  77. data/ext/couchbase/core/meta/version.hxx +3 -0
  78. data/ext/couchbase/core/metrics/constants.hxx +23 -0
  79. data/ext/couchbase/core/metrics/logging_meter.cxx +5 -5
  80. data/ext/couchbase/core/metrics/meter_wrapper.cxx +65 -63
  81. data/ext/couchbase/core/metrics/meter_wrapper.hxx +12 -10
  82. data/ext/couchbase/core/operations/document_analytics.hxx +0 -5
  83. data/ext/couchbase/core/operations/document_append.hxx +0 -4
  84. data/ext/couchbase/core/operations/document_decrement.hxx +0 -5
  85. data/ext/couchbase/core/operations/document_exists.hxx +0 -7
  86. data/ext/couchbase/core/operations/document_get.hxx +0 -7
  87. data/ext/couchbase/core/operations/document_get_all_replicas.hxx +77 -27
  88. data/ext/couchbase/core/operations/document_get_and_lock.hxx +0 -9
  89. data/ext/couchbase/core/operations/document_get_and_touch.hxx +0 -9
  90. data/ext/couchbase/core/operations/document_get_any_replica.hxx +83 -2
  91. data/ext/couchbase/core/operations/document_get_projected.hxx +0 -9
  92. data/ext/couchbase/core/operations/document_increment.hxx +0 -5
  93. data/ext/couchbase/core/operations/document_insert.hxx +0 -4
  94. data/ext/couchbase/core/operations/document_lookup_in.hxx +0 -9
  95. data/ext/couchbase/core/operations/document_lookup_in_all_replicas.hxx +46 -4
  96. data/ext/couchbase/core/operations/document_lookup_in_any_replica.hxx +121 -43
  97. data/ext/couchbase/core/operations/document_mutate_in.hxx +0 -5
  98. data/ext/couchbase/core/operations/document_prepend.hxx +0 -4
  99. data/ext/couchbase/core/operations/document_query.hxx +0 -4
  100. data/ext/couchbase/core/operations/document_remove.hxx +0 -4
  101. data/ext/couchbase/core/operations/document_replace.hxx +0 -4
  102. data/ext/couchbase/core/operations/document_search.hxx +0 -7
  103. data/ext/couchbase/core/operations/document_touch.hxx +0 -7
  104. data/ext/couchbase/core/operations/document_unlock.hxx +0 -6
  105. data/ext/couchbase/core/operations/document_upsert.hxx +0 -4
  106. data/ext/couchbase/core/operations/document_view.cxx +2 -0
  107. data/ext/couchbase/core/operations/document_view.hxx +10 -13
  108. data/ext/couchbase/core/operations/http_noop.hxx +2 -0
  109. data/ext/couchbase/core/operations/management/analytics_dataset_create.hxx +2 -0
  110. data/ext/couchbase/core/operations/management/analytics_dataset_drop.hxx +2 -0
  111. data/ext/couchbase/core/operations/management/analytics_dataset_get_all.hxx +2 -0
  112. data/ext/couchbase/core/operations/management/analytics_dataverse_create.hxx +2 -0
  113. data/ext/couchbase/core/operations/management/analytics_dataverse_drop.hxx +2 -0
  114. data/ext/couchbase/core/operations/management/analytics_get_pending_mutations.hxx +2 -0
  115. data/ext/couchbase/core/operations/management/analytics_index_create.hxx +2 -0
  116. data/ext/couchbase/core/operations/management/analytics_index_drop.hxx +2 -0
  117. data/ext/couchbase/core/operations/management/analytics_index_get_all.hxx +2 -0
  118. data/ext/couchbase/core/operations/management/analytics_link_connect.hxx +2 -0
  119. data/ext/couchbase/core/operations/management/analytics_link_create.hxx +2 -0
  120. data/ext/couchbase/core/operations/management/analytics_link_disconnect.hxx +2 -0
  121. data/ext/couchbase/core/operations/management/analytics_link_drop.hxx +2 -0
  122. data/ext/couchbase/core/operations/management/analytics_link_get_all.hxx +2 -0
  123. data/ext/couchbase/core/operations/management/analytics_link_replace.hxx +2 -0
  124. data/ext/couchbase/core/operations/management/bucket_create.hxx +2 -0
  125. data/ext/couchbase/core/operations/management/bucket_describe.hxx +2 -0
  126. data/ext/couchbase/core/operations/management/bucket_drop.hxx +2 -0
  127. data/ext/couchbase/core/operations/management/bucket_flush.hxx +2 -0
  128. data/ext/couchbase/core/operations/management/bucket_get.hxx +2 -0
  129. data/ext/couchbase/core/operations/management/bucket_get_all.hxx +2 -0
  130. data/ext/couchbase/core/operations/management/bucket_update.hxx +2 -0
  131. data/ext/couchbase/core/operations/management/change_password.hxx +2 -0
  132. data/ext/couchbase/core/operations/management/cluster_describe.hxx +2 -0
  133. data/ext/couchbase/core/operations/management/cluster_developer_preview_enable.hxx +2 -0
  134. data/ext/couchbase/core/operations/management/collection_create.hxx +2 -0
  135. data/ext/couchbase/core/operations/management/collection_drop.hxx +2 -0
  136. data/ext/couchbase/core/operations/management/collection_update.hxx +2 -0
  137. data/ext/couchbase/core/operations/management/collections_manifest_get.hxx +2 -0
  138. data/ext/couchbase/core/operations/management/error_utils.cxx +4 -1
  139. data/ext/couchbase/core/operations/management/eventing_deploy_function.hxx +2 -0
  140. data/ext/couchbase/core/operations/management/eventing_drop_function.hxx +2 -0
  141. data/ext/couchbase/core/operations/management/eventing_get_all_functions.hxx +2 -0
  142. data/ext/couchbase/core/operations/management/eventing_get_function.hxx +2 -0
  143. data/ext/couchbase/core/operations/management/eventing_get_status.hxx +2 -0
  144. data/ext/couchbase/core/operations/management/eventing_pause_function.hxx +2 -0
  145. data/ext/couchbase/core/operations/management/eventing_resume_function.hxx +2 -0
  146. data/ext/couchbase/core/operations/management/eventing_undeploy_function.hxx +2 -0
  147. data/ext/couchbase/core/operations/management/eventing_upsert_function.hxx +2 -0
  148. data/ext/couchbase/core/operations/management/freeform.hxx +2 -0
  149. data/ext/couchbase/core/operations/management/group_drop.hxx +2 -0
  150. data/ext/couchbase/core/operations/management/group_get.hxx +2 -0
  151. data/ext/couchbase/core/operations/management/group_get_all.hxx +2 -0
  152. data/ext/couchbase/core/operations/management/group_upsert.hxx +2 -0
  153. data/ext/couchbase/core/operations/management/query_index_build.hxx +2 -0
  154. data/ext/couchbase/core/operations/management/query_index_build_deferred.hxx +68 -30
  155. data/ext/couchbase/core/operations/management/query_index_create.hxx +2 -0
  156. data/ext/couchbase/core/operations/management/query_index_drop.hxx +2 -0
  157. data/ext/couchbase/core/operations/management/query_index_get_all.hxx +4 -3
  158. data/ext/couchbase/core/operations/management/query_index_get_all_deferred.hxx +2 -1
  159. data/ext/couchbase/core/operations/management/role_get_all.hxx +2 -0
  160. data/ext/couchbase/core/operations/management/scope_create.hxx +2 -0
  161. data/ext/couchbase/core/operations/management/scope_drop.hxx +2 -0
  162. data/ext/couchbase/core/operations/management/scope_get_all.hxx +2 -0
  163. data/ext/couchbase/core/operations/management/search_get_stats.hxx +2 -0
  164. data/ext/couchbase/core/operations/management/search_index_analyze_document.hxx +2 -0
  165. data/ext/couchbase/core/operations/management/search_index_control_ingest.hxx +2 -0
  166. data/ext/couchbase/core/operations/management/search_index_control_plan_freeze.hxx +2 -0
  167. data/ext/couchbase/core/operations/management/search_index_control_query.hxx +2 -0
  168. data/ext/couchbase/core/operations/management/search_index_drop.hxx +2 -0
  169. data/ext/couchbase/core/operations/management/search_index_get.hxx +2 -0
  170. data/ext/couchbase/core/operations/management/search_index_get_all.hxx +2 -0
  171. data/ext/couchbase/core/operations/management/search_index_get_documents_count.hxx +2 -0
  172. data/ext/couchbase/core/operations/management/search_index_get_stats.hxx +2 -0
  173. data/ext/couchbase/core/operations/management/search_index_upsert.hxx +2 -0
  174. data/ext/couchbase/core/operations/management/user_drop.hxx +2 -0
  175. data/ext/couchbase/core/operations/management/user_get.hxx +2 -0
  176. data/ext/couchbase/core/operations/management/user_get_all.hxx +2 -0
  177. data/ext/couchbase/core/operations/management/user_upsert.hxx +2 -0
  178. data/ext/couchbase/core/operations/management/view_index_drop.hxx +2 -0
  179. data/ext/couchbase/core/operations/management/view_index_get.hxx +2 -0
  180. data/ext/couchbase/core/operations/management/view_index_get_all.hxx +2 -0
  181. data/ext/couchbase/core/operations/management/view_index_upsert.hxx +2 -0
  182. data/ext/couchbase/core/operations/operation_traits.hxx +6 -0
  183. data/ext/couchbase/core/operations.hxx +0 -1
  184. data/ext/couchbase/core/operations_fwd.hxx +8 -0
  185. data/ext/couchbase/core/origin.cxx +67 -12
  186. data/ext/couchbase/core/origin.hxx +13 -8
  187. data/ext/couchbase/core/orphan_reporter.cxx +164 -0
  188. data/ext/couchbase/core/orphan_reporter.hxx +65 -0
  189. data/ext/couchbase/core/sasl/CMakeLists.txt +1 -0
  190. data/ext/couchbase/core/sasl/client.cc +6 -0
  191. data/ext/couchbase/core/sasl/mechanism.cc +2 -1
  192. data/ext/couchbase/core/sasl/mechanism.h +2 -1
  193. data/ext/couchbase/core/sasl/oauthbearer/oauthbearer.cc +41 -0
  194. data/ext/couchbase/core/sasl/oauthbearer/oauthbearer.h +47 -0
  195. data/ext/couchbase/core/tls_context_provider.cxx +44 -0
  196. data/ext/couchbase/core/tls_context_provider.hxx +44 -0
  197. data/ext/couchbase/core/tracing/attribute_helpers.hxx +45 -0
  198. data/ext/couchbase/core/tracing/constants.hxx +148 -68
  199. data/ext/couchbase/core/tracing/threshold_logging_options.hxx +0 -3
  200. data/ext/couchbase/core/tracing/threshold_logging_tracer.cxx +122 -170
  201. data/ext/couchbase/core/tracing/tracer_wrapper.cxx +17 -24
  202. data/ext/couchbase/core/tracing/tracer_wrapper.hxx +8 -10
  203. data/ext/couchbase/core/tracing/wrapper_sdk_tracer.cxx +114 -0
  204. data/ext/couchbase/core/tracing/wrapper_sdk_tracer.hxx +85 -0
  205. data/ext/couchbase/core/transactions/attempt_context_impl.cxx +16 -14
  206. data/ext/couchbase/core/transactions/attempt_context_impl.hxx +4 -4
  207. data/ext/couchbase/core/transactions/transactions.cxx +1 -1
  208. data/ext/couchbase/core/transactions/transactions_cleanup.cxx +1 -2
  209. data/ext/couchbase/core/utils/byteswap.hxx +12 -0
  210. data/ext/couchbase/core/utils/concurrent_fixed_priority_queue.hxx +102 -0
  211. data/ext/couchbase/core/utils/connection_string.cxx +2 -0
  212. data/ext/couchbase/couchbase/certificate_authenticator.hxx +1 -0
  213. data/ext/couchbase/couchbase/cluster.hxx +47 -0
  214. data/ext/couchbase/couchbase/cluster_options.hxx +16 -0
  215. data/ext/couchbase/couchbase/collection.hxx +60 -15
  216. data/ext/couchbase/couchbase/error_codes.hxx +48 -48
  217. data/ext/couchbase/couchbase/jwt_authenticator.hxx +52 -0
  218. data/ext/couchbase/couchbase/metrics/meter.hxx +2 -1
  219. data/ext/couchbase/couchbase/metrics/otel_meter.hxx +75 -80
  220. data/ext/couchbase/couchbase/network_options.hxx +19 -0
  221. data/ext/couchbase/couchbase/password_authenticator.hxx +1 -0
  222. data/ext/couchbase/couchbase/tracing/otel_tracer.hxx +15 -17
  223. data/ext/couchbase/couchbase/tracing/request_span.hxx +2 -2
  224. data/ext/couchbase.cxx +4 -0
  225. data/ext/extconf.rb +1 -0
  226. data/ext/rcb_analytics.cxx +157 -47
  227. data/ext/rcb_backend.cxx +118 -71
  228. data/ext/rcb_buckets.cxx +39 -16
  229. data/ext/rcb_collections.cxx +36 -12
  230. data/ext/rcb_crud.cxx +587 -294
  231. data/ext/rcb_hdr_histogram.cxx +219 -0
  232. data/ext/rcb_hdr_histogram.hxx +28 -0
  233. data/ext/rcb_multi.cxx +142 -59
  234. data/ext/rcb_observability.cxx +132 -0
  235. data/ext/rcb_observability.hxx +49 -0
  236. data/ext/rcb_query.cxx +77 -27
  237. data/ext/rcb_search.cxx +92 -31
  238. data/ext/rcb_users.cxx +69 -26
  239. data/ext/rcb_utils.cxx +91 -0
  240. data/ext/rcb_utils.hxx +141 -168
  241. data/ext/rcb_views.cxx +36 -12
  242. data/lib/active_support/cache/couchbase_store.rb +6 -6
  243. data/lib/couchbase/authenticator.rb +14 -0
  244. data/lib/couchbase/binary_collection.rb +37 -22
  245. data/lib/couchbase/bucket.rb +46 -31
  246. data/lib/couchbase/cluster.rb +146 -61
  247. data/lib/couchbase/collection.rb +257 -186
  248. data/lib/couchbase/datastructures/couchbase_list.rb +81 -50
  249. data/lib/couchbase/datastructures/couchbase_map.rb +86 -50
  250. data/lib/couchbase/datastructures/couchbase_queue.rb +64 -38
  251. data/lib/couchbase/datastructures/couchbase_set.rb +57 -41
  252. data/lib/couchbase/deprecations.rb +1 -1
  253. data/lib/couchbase/diagnostics.rb +8 -8
  254. data/lib/couchbase/errors.rb +6 -0
  255. data/lib/couchbase/management/analytics_index_manager.rb +90 -59
  256. data/lib/couchbase/management/bucket_manager.rb +73 -45
  257. data/lib/couchbase/management/collection_manager.rb +86 -43
  258. data/lib/couchbase/management/collection_query_index_manager.rb +56 -33
  259. data/lib/couchbase/management/query_index_manager.rb +88 -36
  260. data/lib/couchbase/management/scope_search_index_manager.rb +119 -52
  261. data/lib/couchbase/management/search_index_manager.rb +401 -178
  262. data/lib/couchbase/management/user_manager.rb +343 -174
  263. data/lib/couchbase/management/view_index_manager.rb +166 -73
  264. data/lib/couchbase/metrics/logging_meter.rb +108 -0
  265. data/lib/couchbase/metrics/logging_value_recorder.rb +50 -0
  266. data/lib/couchbase/metrics/meter.rb +27 -0
  267. data/lib/couchbase/metrics/noop_meter.rb +30 -0
  268. data/lib/couchbase/metrics/noop_value_recorder.rb +27 -0
  269. data/lib/couchbase/metrics/value_recorder.rb +25 -0
  270. data/lib/couchbase/options.rb +69 -3
  271. data/lib/couchbase/protostellar/cluster.rb +3 -0
  272. data/lib/couchbase/scope.rb +62 -48
  273. data/lib/couchbase/search_options.rb +18 -18
  274. data/lib/couchbase/tracing/noop_span.rb +29 -0
  275. data/lib/couchbase/tracing/noop_tracer.rb +29 -0
  276. data/lib/couchbase/tracing/request_span.rb +34 -0
  277. data/lib/couchbase/tracing/request_tracer.rb +28 -0
  278. data/lib/couchbase/tracing/threshold_logging_span.rb +112 -0
  279. data/lib/couchbase/tracing/threshold_logging_tracer.rb +231 -0
  280. data/lib/couchbase/utils/hdr_histogram.rb +55 -0
  281. data/lib/couchbase/utils/observability.rb +257 -0
  282. data/lib/couchbase/utils/observability_constants.rb +200 -0
  283. data/lib/couchbase/utils/stdlib_logger_adapter.rb +1 -3
  284. data/lib/couchbase/version.rb +1 -1
  285. data/lib/couchbase.rb +2 -2
  286. metadata +58 -6
@@ -15,274 +15,443 @@
15
15
  # limitations under the License.
16
16
 
17
17
  require "couchbase/errors"
18
+ require "couchbase/options"
18
19
 
19
20
  require "time"
20
21
 
21
22
  module Couchbase
22
23
  module Management
24
+ module Options
25
+ module User
26
+ # Options for {UserManager#get_user}
27
+ class GetUser < ::Couchbase::Options::Base
28
+ # @return [:local, :external] Name of the user's domain. Defaults to +:local+
29
+ attr_accessor :domain
30
+
31
+ # Creates an instance of options for {UserManager#get_user}
32
+ # @param [:local, :external] domain the name of the user's domain. Defaults to +:local+
33
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
34
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
35
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
36
+ #
37
+ # @yieldparam [GetUser] self
38
+ def initialize(domain: :local,
39
+ timeout: nil,
40
+ retry_strategy: nil,
41
+ parent_span: nil)
42
+ super(timeout: timeout, retry_strategy: retry_strategy, parent_span: parent_span)
43
+ @domain = domain
44
+ yield self if block_given?
45
+ end
46
+
47
+ # @api private
48
+ DEFAULT = GetUser.new.freeze
49
+ end
50
+
51
+ # Options for {UserManager#get_all_users}
52
+ class GetAllUsers < ::Couchbase::Options::Base
53
+ # @return [:local, :external] Name of the user's domain. Defaults to +:local+
54
+ attr_accessor :domain
55
+
56
+ # Creates an instance of options for {UserManager#get_all_users}
57
+ # @param [:local, :external] the name of the user's domain. Defaults to +:local+
58
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
59
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
60
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
61
+ #
62
+ # @yieldparam [GetAllUsers] self
63
+ def initialize(domain: :local,
64
+ timeout: nil,
65
+ retry_strategy: nil,
66
+ parent_span: nil)
67
+ super(timeout: timeout, retry_strategy: retry_strategy, parent_span: parent_span)
68
+ @domain = domain
69
+ yield self if block_given?
70
+ end
71
+ end
72
+
73
+ # Options for {UserManager#upsert_user}
74
+ class UpsertUser < ::Couchbase::Options::Base
75
+ # @return [:local, :external] Name of the user's domain. Defaults to +:local+
76
+ attr_accessor :domain
77
+
78
+ # Creates an instance of options for {UserManager#upsert_user}
79
+ # @param [:local, :external] domain the name of the user's domain. Defaults to +:local+
80
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
81
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
82
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
83
+ #
84
+ # @yieldparam [UpsertUser] self
85
+ def initialize(domain: :local,
86
+ timeout: nil,
87
+ retry_strategy: nil,
88
+ parent_span: nil)
89
+ super(timeout: timeout, retry_strategy: retry_strategy, parent_span: parent_span)
90
+ @domain = domain
91
+ yield self if block_given?
92
+ end
93
+
94
+ # @api private
95
+ DEFAULT = UpsertUser.new.freeze
96
+ end
97
+
98
+ # Options for {UserManager#drop_user}
99
+ class DropUser < ::Couchbase::Options::Base
100
+ # @return [:local, :external] Name of the user's domain. Defaults to +:local+
101
+ attr_accessor :domain
102
+
103
+ # Creates an instance of options for {UserManager#drop_user}
104
+ # @param [:local, :external] domain the name of the user's domain. Defaults to +:local+
105
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
106
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
107
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
108
+ #
109
+ # @yieldparam [DropUser] self
110
+ def initialize(domain: :local,
111
+ timeout: nil,
112
+ retry_strategy: nil,
113
+ parent_span: nil)
114
+ super(timeout: timeout, retry_strategy: retry_strategy, parent_span: parent_span)
115
+ @domain = domain
116
+ yield self if block_given?
117
+ end
118
+
119
+ # @api private
120
+ DEFAULT = DropUser.new.freeze
121
+ end
122
+
123
+ # Options for {UserManager#change_password}
124
+ class ChangePassword < ::Couchbase::Options::Base
125
+ # Creates an instance of options for {UserManager#change_password}
126
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
127
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
128
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
129
+ #
130
+ # @yieldparam [ChangePassword] self
131
+ def initialize(timeout: nil,
132
+ retry_strategy: nil,
133
+ parent_span: nil)
134
+ super
135
+ yield self if block_given?
136
+ end
137
+
138
+ # @api private
139
+ DEFAULT = ChangePassword.new.freeze
140
+ end
141
+
142
+ # Options for {UserManager#get_roles}
143
+ class GetRoles < ::Couchbase::Options::Base
144
+ # Creates an instance of options for {UserManager#get_roles}
145
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
146
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
147
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
148
+ #
149
+ # @yieldparam [GetRoles] self
150
+ def initialize(timeout: nil,
151
+ retry_strategy: nil,
152
+ parent_span: nil)
153
+ super
154
+ yield self if block_given?
155
+ end
156
+
157
+ # @api private
158
+ DEFAULT = GetRoles.new.freeze
159
+ end
160
+
161
+ # Options for {UserManager#get_group}
162
+ class GetGroup < ::Couchbase::Options::Base
163
+ # Creates an instance of options for {UserManager#get_group}
164
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
165
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
166
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
167
+ #
168
+ # @yieldparam [GetGroup] self
169
+ def initialize(timeout: nil,
170
+ retry_strategy: nil,
171
+ parent_span: nil)
172
+ super
173
+ yield self if block_given?
174
+ end
175
+
176
+ # @api private
177
+ DEFAULT = GetGroup.new.freeze
178
+ end
179
+
180
+ # Options for {UserManager#get_all_groups}
181
+ class GetAllGroups < ::Couchbase::Options::Base
182
+ # Creates an instance of options for {UserManager#get_all_groups}
183
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
184
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
185
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
186
+ #
187
+ # @yieldparam [GetAllGroups] self
188
+ def initialize(timeout: nil,
189
+ retry_strategy: nil,
190
+ parent_span: nil)
191
+ super
192
+ yield self if block_given?
193
+ end
194
+
195
+ # @api private
196
+ DEFAULT = GetAllGroups.new.freeze
197
+ end
198
+
199
+ # Options for {UserManager#upsert_group}
200
+ class UpsertGroup < ::Couchbase::Options::Base
201
+ # Creates an instance of options for {UserManager#upsert_group}
202
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
203
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
204
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
205
+ #
206
+ # @yieldparam [UpsertGroup] self
207
+ def initialize(timeout: nil,
208
+ retry_strategy: nil,
209
+ parent_span: nil)
210
+ super
211
+ yield self if block_given?
212
+ end
213
+
214
+ # @api private
215
+ DEFAULT = UpsertGroup.new.freeze
216
+ end
217
+
218
+ # Options for {UserManager#drop_group}
219
+ class DropGroup < ::Couchbase::Options::Base
220
+ # Creates an instance of options for {UserManager#drop_group}
221
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
222
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
223
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
224
+ #
225
+ # @yieldparam [DropGroup] self
226
+ def initialize(timeout: nil,
227
+ retry_strategy: nil,
228
+ parent_span: nil)
229
+ super
230
+ yield self if block_given?
231
+ end
232
+
233
+ # @api private
234
+ DEFAULT = DropGroup.new.freeze
235
+ end
236
+ end
237
+ end
238
+
23
239
  class UserManager
24
240
  alias inspect to_s
25
241
 
26
242
  # @param [Couchbase::Backend] backend
27
- def initialize(backend)
243
+ # @param [Couchbase::Observability::Wrapper] observability wrapper
244
+ #
245
+ # @api private
246
+ def initialize(backend, observability)
28
247
  @backend = backend
248
+ @observability = observability
29
249
  end
30
250
 
31
251
  # Get a user
32
252
  #
33
253
  # @param [String] username ID of the user
34
- # @param [GetUserOptions] options
254
+ # @param [Options::User::GetUser] options
35
255
  #
36
256
  # @return [UserAndMetadata]
37
257
  #
38
258
  # @raise [ArgumentError]
39
259
  # @raise [Error::UserNotFound]
40
- def get_user(username, options = GetUserOptions.new)
41
- resp = @backend.user_get(options.domain, username, options.timeout)
42
- extract_user(resp)
260
+ def get_user(username, options = Options::User::GetUser::DEFAULT)
261
+ @observability.record_operation(Observability::OP_UM_GET_USER, options.parent_span, self, :management) do |obs_handler|
262
+ resp = @backend.user_get(options.domain, username, options.timeout, obs_handler)
263
+ extract_user(resp)
264
+ end
43
265
  end
44
266
 
45
267
  # Gets all users
46
268
  #
269
+ # @param [Options::User::GetAllUsers] options
270
+ #
47
271
  # @return [Array<UserAndMetadata>]
48
- def get_all_users(options = GetAllUsersOptions.new)
49
- resp = @backend.user_get_all(options.domain, options.timeout)
50
- resp.map { |entry| extract_user(entry) }
272
+ def get_all_users(options = Options::User::GetAllUsers::DEFAULT)
273
+ @observability.record_operation(Observability::OP_UM_GET_ALL_USERS, options.parent_span, self, :management) do |obs_handler|
274
+ resp = @backend.user_get_all(options.domain, options.timeout, obs_handler)
275
+ resp.map { |entry| extract_user(entry) }
276
+ end
51
277
  end
52
278
 
53
279
  # Creates or updates a user
54
280
  #
55
281
  # @param [User] user the new version of the user
56
- # @param [UpsertUserOptions] options
282
+ # @param [Options::User::UpsertUser] options
57
283
  #
58
284
  # @raise [ArgumentError]
59
- def upsert_user(user, options = UpsertUserOptions.new)
60
- @backend.user_upsert(
61
- options.domain,
62
- {
63
- username: user.username,
64
- display_name: user.display_name,
65
- groups: user.groups,
66
- password: user.password,
67
- roles: user.roles.map do |role|
68
- {
69
- name: role.name,
70
- bucket: role.bucket,
71
- scope: role.scope,
72
- collection: role.collection,
73
- }
74
- end,
75
- }, options.timeout
76
- )
285
+ def upsert_user(user, options = Options::User::UpsertUser::DEFAULT)
286
+ @observability.record_operation(Observability::OP_UM_UPSERT_USER, options.parent_span, self, :management) do |obs_handler|
287
+ @backend.user_upsert(
288
+ options.domain,
289
+ {
290
+ username: user.username,
291
+ display_name: user.display_name,
292
+ groups: user.groups,
293
+ password: user.password,
294
+ roles: user.roles.map do |role|
295
+ {
296
+ name: role.name,
297
+ bucket: role.bucket,
298
+ scope: role.scope,
299
+ collection: role.collection,
300
+ }
301
+ end,
302
+ },
303
+ options.timeout,
304
+ obs_handler,
305
+ )
306
+ end
77
307
  end
78
308
 
79
309
  # Removes a user
80
310
  #
81
311
  # @param [String] username ID of the user
82
- # @param [DropUserOptions] options
83
- def drop_user(username, options = DropUserOptions.new)
84
- @backend.user_drop(options.domain, username, options.timeout)
312
+ # @param [Options::User::DropUser] options
313
+ def drop_user(username, options = Options::User::DropUser::DEFAULT)
314
+ @observability.record_operation(Observability::OP_UM_DROP_USER, options.parent_span, self, :management) do |obs_handler|
315
+ @backend.user_drop(options.domain, username, options.timeout, obs_handler)
316
+ end
85
317
  end
86
318
 
87
319
  # Gets all roles supported by the server
88
320
  #
89
- # @param [GetRolesOptions] options
321
+ # @param [Options::User::GetRoles] options
90
322
  #
91
323
  # @return [Array<RoleAndDescription>]
92
- def get_roles(options = GetRolesOptions.new)
93
- resp = @backend.role_get_all(options.timeout)
94
- resp.map do |r|
95
- RoleAndDescription.new do |role|
96
- role.name = r[:name]
97
- role.display_name = r[:display_name]
98
- role.description = r[:description]
99
- role.bucket = r[:bucket]
100
- role.scope = r[:scope]
101
- role.collection = r[:collection]
324
+ def get_roles(options = Options::User::GetRoles::DEFAULT)
325
+ @observability.record_operation(Observability::OP_UM_GET_ROLES, options.parent_span, self, :management) do |obs_handler|
326
+ resp = @backend.role_get_all(options.timeout, obs_handler)
327
+ resp.map do |r|
328
+ RoleAndDescription.new do |role|
329
+ role.name = r[:name]
330
+ role.display_name = r[:display_name]
331
+ role.description = r[:description]
332
+ role.bucket = r[:bucket]
333
+ role.scope = r[:scope]
334
+ role.collection = r[:collection]
335
+ end
102
336
  end
103
337
  end
104
338
  end
105
339
 
106
340
  # Changes the password of the currently authenticated user
107
341
  #
108
- # @param [ChangePasswordOptions] options
342
+ # @param [Options::User::ChangePassword] options
109
343
  #
110
344
  # @raise [ArgumentError]
111
- def change_password(new_password, options = ChangePasswordOptions.new)
112
- @backend.change_password(new_password, options.timeout)
345
+ def change_password(new_password, options = Options::User::ChangePassword::DEFAULT)
346
+ @observability.record_operation(Observability::OP_UM_CHANGE_PASSWORD, options.parent_span, self, :management) do |obs_handler|
347
+ @backend.change_password(new_password, options.timeout, obs_handler)
348
+ end
113
349
  end
114
350
 
115
351
  # Gets a group
116
352
  #
117
353
  # @param [String] group_name name of the group to get
354
+ # @param [Options::User::GetGroup] options
118
355
  #
119
356
  # @return [Group]
120
357
  #
121
358
  # @raise [ArgumentError]
122
359
  # @raise [Error::GroupNotFound]
123
- def get_group(group_name, options = GetGroupOptions.new)
124
- resp = @backend.group_get(group_name, options.timeout)
125
- extract_group(resp)
360
+ def get_group(group_name, options = Options::User::GetGroup::DEFAULT)
361
+ @observability.record_operation(Observability::OP_UM_GET_GROUP, options.parent_span, self, :management) do |obs_handler|
362
+ resp = @backend.group_get(group_name, options.timeout, obs_handler)
363
+ extract_group(resp)
364
+ end
126
365
  end
127
366
 
128
367
  # Gets all groups
129
368
  #
130
- # @param [GetAllGroupsOptions] options
369
+ # @param [Options::User::GetAllGroups] options
131
370
  #
132
371
  # @return [Array<Group>]
133
- def get_all_groups(options = GetAllGroupsOptions.new)
134
- resp = @backend.group_get_all(options.timeout)
135
- resp.map { |entry| extract_group(entry) }
372
+ def get_all_groups(options = Options::User::GetAllGroups::DEFAULT)
373
+ @observability.record_operation(Observability::OP_UM_GET_ALL_GROUPS, options.parent_span, self, :management) do |obs_handler|
374
+ resp = @backend.group_get_all(options.timeout, obs_handler)
375
+ resp.map { |entry| extract_group(entry) }
376
+ end
136
377
  end
137
378
 
138
379
  # Creates or updates a group
139
380
  #
140
381
  # @param [Group] group the new version of the group
141
- # @param [UpsertGroupOptions] options
382
+ # @param [Options::User::UpsertGroup] options
142
383
  #
143
384
  # @raise [ArgumentError]
144
385
  # @raise [Error::GroupNotFound]
145
- def upsert_group(group, options = UpsertGroupOptions.new)
146
- @backend.group_upsert({
147
- name: group.name,
148
- description: group.description,
149
- ldap_group_reference: group.ldap_group_reference,
150
- roles: group.roles.map do |role|
151
- {
152
- name: role.name,
153
- bucket: role.bucket,
154
- scope: role.scope,
155
- collection: role.collection,
156
- }
157
- end,
158
- }, options.timeout)
386
+ def upsert_group(group, options = Options::User::UpsertGroup::DEFAULT)
387
+ @observability.record_operation(Observability::OP_UM_UPSERT_GROUP, options.parent_span, self, :management) do |obs_handler|
388
+ @backend.group_upsert({
389
+ name: group.name,
390
+ description: group.description,
391
+ ldap_group_reference: group.ldap_group_reference,
392
+ roles: group.roles.map do |role|
393
+ {
394
+ name: role.name,
395
+ bucket: role.bucket,
396
+ scope: role.scope,
397
+ collection: role.collection,
398
+ }
399
+ end,
400
+ }, options.timeout, obs_handler)
401
+ end
159
402
  end
160
403
 
161
404
  # Removes a group
162
405
  #
163
406
  # @param [String] group_name name of the group
164
- # @param [DropGroupOptions] options
407
+ # @param [Options::User::DropGroup] options
165
408
  #
166
409
  # @raise [Error::GroupNotFound]
167
- def drop_group(group_name, options = DropGroupOptions.new)
168
- @backend.group_drop(group_name, options.timeout)
169
- end
170
-
171
- class GetUserOptions
172
- # @return [:local, :external] Name of the user's domain. Defaults to +:local+
173
- attr_accessor :domain
174
-
175
- # @return [Integer] the time in milliseconds allowed for the operation to complete
176
- attr_accessor :timeout
177
-
178
- # @yieldparam [GetUserOptions] self
179
- def initialize
180
- @domain = :local
181
- yield self if block_given?
182
- end
183
- end
184
-
185
- class GetAllUsersOptions
186
- # @return [:local, :external] Name of the user's domain. Defaults to +:local+
187
- attr_accessor :domain
188
-
189
- # @return [Integer] the time in milliseconds allowed for the operation to complete
190
- attr_accessor :timeout
191
-
192
- # @yieldparam [GetAllUsersOptions] self
193
- def initialize
194
- @domain = :local
195
- yield self if block_given?
196
- end
197
- end
198
-
199
- class UpsertUserOptions
200
- # @return [:local, :external] Name of the user's domain. Defaults to +:local+
201
- attr_accessor :domain
202
-
203
- # @return [Integer] the time in milliseconds allowed for the operation to complete
204
- attr_accessor :timeout
205
-
206
- # @yieldparam [UpsertUserOptions] self
207
- def initialize
208
- @domain = :local
209
- yield self if block_given?
410
+ def drop_group(group_name, options = Options::User::DropGroup::DEFAULT)
411
+ @observability.record_operation(Observability::OP_UM_DROP_GROUP, options.parent_span, self, :management) do |obs_handler|
412
+ @backend.group_drop(group_name, options.timeout, obs_handler)
210
413
  end
211
414
  end
212
415
 
213
- class DropUserOptions
214
- # @return [:local, :external] Name of the user's domain. Defaults to +:local+
215
- attr_accessor :domain
416
+ # @api private
417
+ # @deprecated Use {Couchbase::Management::Options::User::GetUser} instead
418
+ GetUserOptions = ::Couchbase::Management::Options::User::GetUser
216
419
 
217
- # @return [Integer] the time in milliseconds allowed for the operation to complete
218
- attr_accessor :timeout
420
+ # @api private
421
+ # @deprecated Use {Couchbase::Management::Options::User::GetAllUsers} instead
422
+ GetAllUsersOptions = ::Couchbase::Management::Options::User::GetAllUsers
219
423
 
220
- # @yieldparam [DropUserOptions] self
221
- def initialize
222
- @domain = :local
223
- yield self if block_given?
224
- end
225
- end
424
+ # @api private
425
+ # @deprecated Use {Couchbase::Management::Options::User::UpsertUser} instead
426
+ UpsertUserOptions = ::Couchbase::Management::Options::User::UpsertUser
226
427
 
227
- class ChangePasswordOptions
228
- # @return [Integer] the time in milliseconds allowed for the operation to complete
229
- attr_accessor :timeout
428
+ # @api private
429
+ # @deprecated Use {Couchbase::Management::Options::User::DropUser} instead
430
+ DropUserOptions = ::Couchbase::Management::Options::User::DropUser
230
431
 
231
- # @yieldparam [ChangePasswordOptions] self
232
- def initialize
233
- yield self if block_given?
234
- end
235
- end
432
+ # @api private
433
+ # @deprecated Use {Couchbase::Management::Options::User::ChangePassword} instead
434
+ ChangePasswordOptions = ::Couchbase::Management::Options::User::ChangePassword
236
435
 
237
- class GetRolesOptions
238
- # @return [Integer] the time in milliseconds allowed for the operation to complete
239
- attr_accessor :timeout
436
+ # @api private
437
+ # @deprecated Use {Couchbase::Management::Options::User::GetRoles} instead
438
+ GetRolesOptions = ::Couchbase::Management::Options::User::GetRoles
240
439
 
241
- # @yieldparam [GetRolesOptions] self
242
- def initialize
243
- yield self if block_given?
244
- end
245
- end
246
-
247
- class GetGroupOptions
248
- # @return [Integer] the time in milliseconds allowed for the operation to complete
249
- attr_accessor :timeout
440
+ # @api private
441
+ # @deprecated Use {Couchbase::Management::Options::User::GetGroup} instead
442
+ GetGroupOptions = ::Couchbase::Management::Options::User::GetGroup
250
443
 
251
- # @yieldparam [GetGroupOptions] self
252
- def initialize
253
- yield self if block_given?
254
- end
255
- end
444
+ # @api private
445
+ # @deprecated Use {Couchbase::Management::Options::User::GetAllGroups} instead
446
+ GetAllGroupsOptions = ::Couchbase::Management::Options::User::GetAllGroups
256
447
 
257
- class GetAllGroupsOptions
258
- # @return [Integer] the time in milliseconds allowed for the operation to complete
259
- attr_accessor :timeout
448
+ # @api private
449
+ # @deprecated Use {Couchbase::Management::Options::User::UpsertGroup} instead
450
+ UpsertGroupOptions = ::Couchbase::Management::Options::User::UpsertGroup
260
451
 
261
- # @yieldparam [GetAllGroupsOptions] self
262
- def initialize
263
- yield self if block_given?
264
- end
265
- end
266
-
267
- class UpsertGroupOptions
268
- # @return [Integer] the time in milliseconds allowed for the operation to complete
269
- attr_accessor :timeout
270
-
271
- # @yieldparam [UpsertGroupOptions] self
272
- def initialize
273
- yield self if block_given?
274
- end
275
- end
276
-
277
- class DropGroupOptions
278
- # @return [Integer] the time in milliseconds allowed for the operation to complete
279
- attr_accessor :timeout
280
-
281
- # @yieldparam [DropGroupOptions] self
282
- def initialize
283
- yield self if block_given?
284
- end
285
- end
452
+ # @api private
453
+ # @deprecated Use {Couchbase::Management::Options::User::DropGroup} instead
454
+ DropGroupOptions = ::Couchbase::Management::Options::User::DropGroup
286
455
 
287
456
  private
288
457