couchbase 3.5.2-x86_64-darwin

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 (125) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +202 -0
  3. data/README.md +154 -0
  4. data/ext/extconf.rb +0 -0
  5. data/lib/active_support/cache/couchbase_store.rb +342 -0
  6. data/lib/couchbase/3.1/libcouchbase.bundle +0 -0
  7. data/lib/couchbase/3.2/libcouchbase.bundle +0 -0
  8. data/lib/couchbase/3.3/libcouchbase.bundle +0 -0
  9. data/lib/couchbase/analytics_options.rb +109 -0
  10. data/lib/couchbase/authenticator.rb +66 -0
  11. data/lib/couchbase/binary_collection.rb +130 -0
  12. data/lib/couchbase/binary_collection_options.rb +26 -0
  13. data/lib/couchbase/bucket.rb +146 -0
  14. data/lib/couchbase/cluster.rb +462 -0
  15. data/lib/couchbase/cluster_registry.rb +49 -0
  16. data/lib/couchbase/collection.rb +707 -0
  17. data/lib/couchbase/collection_options.rb +401 -0
  18. data/lib/couchbase/config_profiles.rb +57 -0
  19. data/lib/couchbase/configuration.rb +58 -0
  20. data/lib/couchbase/datastructures/couchbase_list.rb +160 -0
  21. data/lib/couchbase/datastructures/couchbase_map.rb +194 -0
  22. data/lib/couchbase/datastructures/couchbase_queue.rb +134 -0
  23. data/lib/couchbase/datastructures/couchbase_set.rb +128 -0
  24. data/lib/couchbase/datastructures.rb +26 -0
  25. data/lib/couchbase/diagnostics.rb +183 -0
  26. data/lib/couchbase/errors.rb +414 -0
  27. data/lib/couchbase/json_transcoder.rb +41 -0
  28. data/lib/couchbase/key_value_scan.rb +119 -0
  29. data/lib/couchbase/libcouchbase.rb +6 -0
  30. data/lib/couchbase/logger.rb +87 -0
  31. data/lib/couchbase/management/analytics_index_manager.rb +1129 -0
  32. data/lib/couchbase/management/bucket_manager.rb +445 -0
  33. data/lib/couchbase/management/collection_manager.rb +472 -0
  34. data/lib/couchbase/management/collection_query_index_manager.rb +224 -0
  35. data/lib/couchbase/management/query_index_manager.rb +619 -0
  36. data/lib/couchbase/management/scope_search_index_manager.rb +200 -0
  37. data/lib/couchbase/management/search_index_manager.rb +426 -0
  38. data/lib/couchbase/management/user_manager.rb +470 -0
  39. data/lib/couchbase/management/view_index_manager.rb +239 -0
  40. data/lib/couchbase/management.rb +31 -0
  41. data/lib/couchbase/mutation_state.rb +65 -0
  42. data/lib/couchbase/options.rb +2846 -0
  43. data/lib/couchbase/protostellar/binary_collection.rb +55 -0
  44. data/lib/couchbase/protostellar/bucket.rb +55 -0
  45. data/lib/couchbase/protostellar/client.rb +99 -0
  46. data/lib/couchbase/protostellar/cluster.rb +171 -0
  47. data/lib/couchbase/protostellar/collection.rb +152 -0
  48. data/lib/couchbase/protostellar/connect_options.rb +63 -0
  49. data/lib/couchbase/protostellar/error_handling.rb +203 -0
  50. data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_pb.rb +61 -0
  51. data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_services_pb.rb +35 -0
  52. data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_pb.rb +57 -0
  53. data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_services_pb.rb +36 -0
  54. data/lib/couchbase/protostellar/generated/admin/query/v1/query_pb.rb +61 -0
  55. data/lib/couchbase/protostellar/generated/admin/query/v1/query_services_pb.rb +37 -0
  56. data/lib/couchbase/protostellar/generated/admin/search/v1/search_pb.rb +72 -0
  57. data/lib/couchbase/protostellar/generated/admin/search/v1/search_services_pb.rb +44 -0
  58. data/lib/couchbase/protostellar/generated/analytics/v1/analytics_pb.rb +52 -0
  59. data/lib/couchbase/protostellar/generated/analytics/v1/analytics_services_pb.rb +30 -0
  60. data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_pb.rb +70 -0
  61. data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_services_pb.rb +36 -0
  62. data/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb +97 -0
  63. data/lib/couchbase/protostellar/generated/kv/v1/kv_services_pb.rb +46 -0
  64. data/lib/couchbase/protostellar/generated/query/v1/query_pb.rb +57 -0
  65. data/lib/couchbase/protostellar/generated/query/v1/query_services_pb.rb +30 -0
  66. data/lib/couchbase/protostellar/generated/routing/v1/routing_pb.rb +52 -0
  67. data/lib/couchbase/protostellar/generated/routing/v1/routing_services_pb.rb +30 -0
  68. data/lib/couchbase/protostellar/generated/search/v1/search_pb.rb +99 -0
  69. data/lib/couchbase/protostellar/generated/search/v1/search_services_pb.rb +30 -0
  70. data/lib/couchbase/protostellar/generated/transactions/v1/transactions_pb.rb +57 -0
  71. data/lib/couchbase/protostellar/generated/transactions/v1/transactions_services_pb.rb +36 -0
  72. data/lib/couchbase/protostellar/generated/view/v1/view_pb.rb +51 -0
  73. data/lib/couchbase/protostellar/generated/view/v1/view_services_pb.rb +30 -0
  74. data/lib/couchbase/protostellar/generated.rb +9 -0
  75. data/lib/couchbase/protostellar/management/bucket_manager.rb +67 -0
  76. data/lib/couchbase/protostellar/management/collection_manager.rb +94 -0
  77. data/lib/couchbase/protostellar/management/collection_query_index_manager.rb +124 -0
  78. data/lib/couchbase/protostellar/management/query_index_manager.rb +112 -0
  79. data/lib/couchbase/protostellar/management.rb +24 -0
  80. data/lib/couchbase/protostellar/request.rb +78 -0
  81. data/lib/couchbase/protostellar/request_behaviour.rb +42 -0
  82. data/lib/couchbase/protostellar/request_generator/admin/bucket.rb +124 -0
  83. data/lib/couchbase/protostellar/request_generator/admin/collection.rb +94 -0
  84. data/lib/couchbase/protostellar/request_generator/admin/query.rb +130 -0
  85. data/lib/couchbase/protostellar/request_generator/admin.rb +24 -0
  86. data/lib/couchbase/protostellar/request_generator/kv.rb +474 -0
  87. data/lib/couchbase/protostellar/request_generator/query.rb +133 -0
  88. data/lib/couchbase/protostellar/request_generator/search.rb +387 -0
  89. data/lib/couchbase/protostellar/request_generator.rb +26 -0
  90. data/lib/couchbase/protostellar/response_converter/admin/bucket.rb +55 -0
  91. data/lib/couchbase/protostellar/response_converter/admin/collection.rb +42 -0
  92. data/lib/couchbase/protostellar/response_converter/admin/query.rb +59 -0
  93. data/lib/couchbase/protostellar/response_converter/admin.rb +24 -0
  94. data/lib/couchbase/protostellar/response_converter/kv.rb +151 -0
  95. data/lib/couchbase/protostellar/response_converter/query.rb +84 -0
  96. data/lib/couchbase/protostellar/response_converter/search.rb +136 -0
  97. data/lib/couchbase/protostellar/response_converter.rb +26 -0
  98. data/lib/couchbase/protostellar/retry/action.rb +38 -0
  99. data/lib/couchbase/protostellar/retry/orchestrator.rb +60 -0
  100. data/lib/couchbase/protostellar/retry/reason.rb +67 -0
  101. data/lib/couchbase/protostellar/retry/strategies/best_effort.rb +49 -0
  102. data/lib/couchbase/protostellar/retry/strategies.rb +26 -0
  103. data/lib/couchbase/protostellar/retry.rb +28 -0
  104. data/lib/couchbase/protostellar/scope.rb +57 -0
  105. data/lib/couchbase/protostellar/timeout_defaults.rb +30 -0
  106. data/lib/couchbase/protostellar/timeouts.rb +83 -0
  107. data/lib/couchbase/protostellar.rb +29 -0
  108. data/lib/couchbase/query_options.rb +122 -0
  109. data/lib/couchbase/railtie.rb +47 -0
  110. data/lib/couchbase/raw_binary_transcoder.rb +39 -0
  111. data/lib/couchbase/raw_json_transcoder.rb +40 -0
  112. data/lib/couchbase/raw_string_transcoder.rb +42 -0
  113. data/lib/couchbase/scope.rb +258 -0
  114. data/lib/couchbase/search_options.rb +1650 -0
  115. data/lib/couchbase/subdoc.rb +293 -0
  116. data/lib/couchbase/transcoder_flags.rb +64 -0
  117. data/lib/couchbase/utils/generic_logger_adapter.rb +40 -0
  118. data/lib/couchbase/utils/stdlib_logger_adapter.rb +67 -0
  119. data/lib/couchbase/utils/time.rb +71 -0
  120. data/lib/couchbase/utils.rb +23 -0
  121. data/lib/couchbase/version.rb +25 -0
  122. data/lib/couchbase/view_options.rb +67 -0
  123. data/lib/couchbase.rb +30 -0
  124. data/lib/rails/generators/couchbase/config/config_generator.rb +29 -0
  125. metadata +190 -0
@@ -0,0 +1,1129 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020-2021 Couchbase, Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require "couchbase/errors"
18
+ require "couchbase/options"
19
+
20
+ module Couchbase
21
+ module Management
22
+ module Options
23
+ module Analytics
24
+ # Options for {AnalyticsIndexManager#create_dataverse}
25
+ class CreateDataverse < ::Couchbase::Options::Base
26
+ attr_accessor :ignore_if_exists # @return [Boolean]
27
+
28
+ # Creates an instance of options for {AnalyticsIndexManager#create_dataverse}
29
+ #
30
+ # @param [Boolean] ignore_if_exists if +true+, the exception {Error::DataverseExists} will not be raised if the
31
+ # dataverse with the specified name already exists.
32
+ #
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 [Hash, nil] client_context the client context data, if set
36
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
37
+ #
38
+ # @yieldparam [CreateDataverse] self
39
+ def initialize(ignore_if_exists: false,
40
+ timeout: nil,
41
+ retry_strategy: nil,
42
+ client_context: nil,
43
+ parent_span: nil)
44
+ super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
45
+ @ignore_if_exists = ignore_if_exists
46
+ yield self if block_given?
47
+ end
48
+
49
+ # @api private
50
+ def to_backend
51
+ {
52
+ timeout: Utils::Time.extract_duration(@timeout),
53
+ ignore_if_exists: @ignore_if_exists,
54
+ }
55
+ end
56
+ end
57
+
58
+ # Options for {AnalyticsIndexManager#drop_dataverse}
59
+ class DropDataverse < ::Couchbase::Options::Base
60
+ attr_accessor :ignore_if_does_not_exist # @return [Boolean]
61
+
62
+ # Creates an instance of options for {AnalyticsIndexManager#create_dataverse}
63
+ #
64
+ # @param [Boolean] ignore_if_does_not_exist if +true+, the exception {Error::DataverseNotFound} will not be raised
65
+ # if the dataverse with the specified name does not exist.
66
+ #
67
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
68
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
69
+ # @param [Hash, nil] client_context the client context data, if set
70
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
71
+ #
72
+ # @yieldparam [DropDataverse] self
73
+ def initialize(ignore_if_does_not_exist: false,
74
+ timeout: nil,
75
+ retry_strategy: nil,
76
+ client_context: nil,
77
+ parent_span: nil)
78
+ super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
79
+ @ignore_if_does_not_exist = ignore_if_does_not_exist
80
+ yield self if block_given?
81
+ end
82
+
83
+ # @api private
84
+ def to_backend
85
+ {
86
+ timeout: Utils::Time.extract_duration(@timeout),
87
+ ignore_if_does_not_exist: @ignore_if_does_not_exist,
88
+ }
89
+ end
90
+ end
91
+
92
+ # Options for {AnalyticsIndexManager#create_dataset}
93
+ class CreateDataset < ::Couchbase::Options::Base
94
+ attr_accessor :ignore_if_exists # @return [Boolean]
95
+ attr_accessor :condition # @return [String]
96
+ attr_accessor :dataverse_name # @return [String]
97
+
98
+ # Creates an instance of options for {AnalyticsIndexManager#create_dataset}
99
+ #
100
+ # @param [Boolean] ignore_if_exists if +true+, the exception {Error::DatasetExists} will not be raised
101
+ # if the dataset with the specified name already exists.
102
+ # @param [String] condition WHERE clause to use for creating dataset
103
+ # @param [String] dataverse_name the name of the dataverse to use (defaults to +nil+)
104
+ #
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 [Hash, nil] client_context the client context data, if set
108
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
109
+ #
110
+ # @yieldparam [CreateDataset] self
111
+ def initialize(ignore_if_exists: false,
112
+ condition: nil,
113
+ dataverse_name: nil,
114
+ timeout: nil,
115
+ retry_strategy: nil,
116
+ client_context: nil,
117
+ parent_span: nil)
118
+ super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
119
+ @ignore_if_exists = ignore_if_exists
120
+ @condition = condition
121
+ @dataverse_name = dataverse_name
122
+ yield self if block_given?
123
+ end
124
+
125
+ # @api private
126
+ def to_backend
127
+ {
128
+ timeout: Utils::Time.extract_duration(@timeout),
129
+ condition: @condition,
130
+ dataverse_name: @dataverse_name,
131
+ ignore_if_exists: @ignore_if_exists,
132
+ }
133
+ end
134
+ end
135
+
136
+ # Options for {AnalyticsIndexManager#drop_dataset}
137
+ class DropDataset < ::Couchbase::Options::Base
138
+ attr_accessor :ignore_if_does_not_exist # @return [Boolean]
139
+ attr_accessor :dataverse_name # @return [String]
140
+
141
+ # Creates an instance of options for {AnalyticsIndexManager#drop_dataset}
142
+ #
143
+ # @param [Boolean] ignore_if_does_not_exist if +true+, the exception {Error::DatasetNotFound} will not be raised
144
+ # if the dataset with the specified name does not exist.
145
+ # @param [String] dataverse_name the name of the dataverse to use (defaults to +nil+)
146
+ #
147
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
148
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
149
+ # @param [Hash, nil] client_context the client context data, if set
150
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
151
+ #
152
+ # @yieldparam [DropDataset] self
153
+ def initialize(ignore_if_does_not_exist: false,
154
+ dataverse_name: nil,
155
+ timeout: nil,
156
+ retry_strategy: nil,
157
+ client_context: nil,
158
+ parent_span: nil)
159
+ super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
160
+ @ignore_if_does_not_exist = ignore_if_does_not_exist
161
+ @dataverse_name = dataverse_name
162
+ yield self if block_given?
163
+ end
164
+
165
+ # @api private
166
+ def to_backend
167
+ {
168
+ timeout: Utils::Time.extract_duration(@timeout),
169
+ dataverse_name: @dataverse_name,
170
+ ignore_if_does_not_exist: @ignore_if_does_not_exist,
171
+ }
172
+ end
173
+ end
174
+
175
+ # Options for {AnalyticsIndexManager#get_all_datasets}
176
+ class GetAllDatasets < ::Couchbase::Options::Base
177
+ # Creates an instance of options for {AnalyticsIndexManager#get_all_datasets}
178
+ #
179
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
180
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
181
+ # @param [Hash, nil] client_context the client context data, if set
182
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
183
+ #
184
+ # @yieldparam [GetAllDatasets] self
185
+ def initialize(timeout: nil,
186
+ retry_strategy: nil,
187
+ client_context: nil,
188
+ parent_span: nil)
189
+ super
190
+ yield self if block_given?
191
+ end
192
+ end
193
+
194
+ # Options for {AnalyticsIndexManager#create_index}
195
+ class CreateIndex < ::Couchbase::Options::Base
196
+ attr_accessor :ignore_if_exists # @return [Boolean]
197
+ attr_accessor :dataverse_name # @return [String]
198
+
199
+ # Creates an instance of options for {AnalyticsIndexManager#create_index}
200
+ #
201
+ # @param [Boolean] ignore_if_exists if +true+, the exception {Error::DatasetExists} will not be raised
202
+ # if the dataset with the specified name already exists.
203
+ # @param [String] dataverse_name the name of the dataverse to use (defaults to +nil+)
204
+ #
205
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
206
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
207
+ # @param [Hash, nil] client_context the client context data, if set
208
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
209
+ #
210
+ # @yieldparam [CreateIndex] self
211
+ def initialize(ignore_if_exists: false,
212
+ dataverse_name: nil,
213
+ timeout: nil,
214
+ retry_strategy: nil,
215
+ client_context: nil,
216
+ parent_span: nil)
217
+ super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
218
+ @ignore_if_exists = ignore_if_exists
219
+ @dataverse_name = dataverse_name
220
+ yield self if block_given?
221
+ end
222
+
223
+ # @api private
224
+ def to_backend
225
+ {
226
+ timeout: Utils::Time.extract_duration(@timeout),
227
+ dataverse_name: @dataverse_name,
228
+ ignore_if_exists: @ignore_if_exists,
229
+ }
230
+ end
231
+ end
232
+
233
+ # Options for {AnalyticsIndexManager#drop_index}
234
+ class DropIndex < ::Couchbase::Options::Base
235
+ attr_accessor :ignore_if_does_not_exist # @return [Boolean]
236
+ attr_accessor :dataverse_name # @return [String]
237
+
238
+ # Creates an instance of options for {AnalyticsIndexManager#drop_index}
239
+ #
240
+ # @param [Boolean] ignore_if_does_not_exist if +true+, the exception {Error::DatasetNotFound} will not be raised
241
+ # if the dataset with the specified name does not exist.
242
+ # @param [String] dataverse_name the name of the dataverse to use (defaults to +nil+)
243
+ #
244
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
245
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
246
+ # @param [Hash, nil] client_context the client context data, if set
247
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
248
+ #
249
+ # @yieldparam [DropIndex] self
250
+ def initialize(ignore_if_does_not_exist: false,
251
+ dataverse_name: nil,
252
+ timeout: nil,
253
+ retry_strategy: nil,
254
+ client_context: nil,
255
+ parent_span: nil)
256
+ super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
257
+ @ignore_if_does_not_exist = ignore_if_does_not_exist
258
+ @dataverse_name = dataverse_name
259
+ yield self if block_given?
260
+ end
261
+
262
+ # @api private
263
+ def to_backend
264
+ {
265
+ timeout: Utils::Time.extract_duration(@timeout),
266
+ dataverse_name: @dataverse_name,
267
+ ignore_if_does_not_exist: @ignore_if_does_not_exist,
268
+ }
269
+ end
270
+ end
271
+
272
+ # Options for {AnalyticsIndexManager#get_all_indexes}
273
+ class GetAllIndexes < ::Couchbase::Options::Base
274
+ # Creates an instance of options for {AnalyticsIndexManager#get_all_indexes}
275
+ #
276
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
277
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
278
+ # @param [Hash, nil] client_context the client context data, if set
279
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
280
+ #
281
+ # @yieldparam [GetAllIndexes] self
282
+ def initialize(timeout: nil,
283
+ retry_strategy: nil,
284
+ client_context: nil,
285
+ parent_span: nil)
286
+ super
287
+ yield self if block_given?
288
+ end
289
+ end
290
+
291
+ # Options for {AnalyticsIndexManager#connect_link}
292
+ class ConnectLink < ::Couchbase::Options::Base
293
+ attr_accessor :link_name # @return [String]
294
+ attr_accessor :force # @return [Boolean]
295
+ attr_accessor :dataverse_name # @return [String]
296
+
297
+ # Creates an instance of options for {AnalyticsIndexManager#connect_link}
298
+ #
299
+ # @param [String] link_name the name of the link
300
+ # @param [Boolean] force if +true+, link creation will be forced even if the bucket UUID changed, for example
301
+ # due to the bucket being deleted and recreated
302
+ # @param [String] dataverse_name the name of the dataverse to use (defaults to +nil+)
303
+ #
304
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
305
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
306
+ # @param [Hash, nil] client_context the client context data, if set
307
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
308
+ #
309
+ # @yieldparam [ConnectLink] self
310
+ def initialize(link_name: "Local",
311
+ force: false,
312
+ dataverse_name: nil,
313
+ timeout: nil,
314
+ retry_strategy: nil,
315
+ client_context: nil,
316
+ parent_span: nil)
317
+ super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
318
+ @link_name = link_name
319
+ @force = force
320
+ @dataverse_name = dataverse_name
321
+ yield self if block_given?
322
+ end
323
+
324
+ # @api private
325
+ def to_backend
326
+ {
327
+ timeout: Utils::Time.extract_duration(@timeout),
328
+ link_name: @link_name,
329
+ force: @force,
330
+ dataverse_name: @dataverse_name,
331
+ }
332
+ end
333
+ end
334
+
335
+ # Options for {AnalyticsIndexManager#connect_link}
336
+ class DisconnectLink < ::Couchbase::Options::Base
337
+ attr_accessor :link_name # @return [String]
338
+ attr_accessor :dataverse_name # @return [String]
339
+
340
+ # Creates an instance of options for {AnalyticsIndexManager#disconnect_link}
341
+ #
342
+ # @param [String] link_name the name of the link
343
+ # @param [String] dataverse_name the name of the dataverse to use (defaults to +nil+)
344
+ #
345
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
346
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
347
+ # @param [Hash, nil] client_context the client context data, if set
348
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
349
+ #
350
+ # @yieldparam [DisconnectLink] self
351
+ def initialize(link_name: "Local",
352
+ dataverse_name: nil,
353
+ timeout: nil,
354
+ retry_strategy: nil,
355
+ client_context: nil,
356
+ parent_span: nil)
357
+ super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
358
+ @link_name = link_name
359
+ @dataverse_name = dataverse_name
360
+ yield self if block_given?
361
+ end
362
+
363
+ # @api private
364
+ def to_backend
365
+ {
366
+ timeout: Utils::Time.extract_duration(@timeout),
367
+ link_name: @link_name,
368
+ dataverse_name: @dataverse_name,
369
+ }
370
+ end
371
+ end
372
+
373
+ # Options for {AnalyticsIndexManager#get_pending_mutations}
374
+ class GetPendingMutations < ::Couchbase::Options::Base
375
+ # Creates an instance of options for {AnalyticsIndexManager#get_pending_mutations}
376
+ #
377
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
378
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
379
+ # @param [Hash, nil] client_context the client context data, if set
380
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
381
+ #
382
+ # @yieldparam [GetPendingMutations] self
383
+ def initialize(timeout: nil,
384
+ retry_strategy: nil,
385
+ client_context: nil,
386
+ parent_span: nil)
387
+ super
388
+ yield self if block_given?
389
+ end
390
+ end
391
+
392
+ # Options for {AnalyticsIndexManager#create_link}
393
+ class CreateLink < ::Couchbase::Options::Base
394
+ # Creates an instance of options for {AnalyticsIndexManager#create_link}
395
+ #
396
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
397
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
398
+ # @param [Hash, nil] client_context the client context data, if set
399
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
400
+ #
401
+ # @yieldparam [CreateLink] self
402
+ def initialize(timeout: nil,
403
+ retry_strategy: nil,
404
+ client_context: nil,
405
+ parent_span: nil)
406
+ super
407
+ yield self if block_given?
408
+ end
409
+
410
+ # @api private
411
+ def to_backend
412
+ {
413
+ timeout: Utils::Time.extract_duration(@timeout),
414
+ }
415
+ end
416
+ end
417
+
418
+ # Options for {AnalyticsIndexManager#replace_link}
419
+ class ReplaceLink < ::Couchbase::Options::Base
420
+ # Creates an instance of options for {AnalyticsIndexManager#replace_link}
421
+ #
422
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
423
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
424
+ # @param [Hash, nil] client_context the client context data, if set
425
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
426
+ #
427
+ # @yieldparam [ReplaceLink] self
428
+ def initialize(timeout: nil,
429
+ retry_strategy: nil,
430
+ client_context: nil,
431
+ parent_span: nil)
432
+ super
433
+ yield self if block_given?
434
+ end
435
+
436
+ # @api private
437
+ def to_backend
438
+ {
439
+ timeout: Utils::Time.extract_duration(@timeout),
440
+ }
441
+ end
442
+ end
443
+
444
+ # Options for {AnalyticsIndexManager#drop_link}
445
+ class DropLink < ::Couchbase::Options::Base
446
+ # Creates an instance of options for {AnalyticsIndexManager#drop_link}
447
+ #
448
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
449
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
450
+ # @param [Hash, nil] client_context the client context data, if set
451
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
452
+ #
453
+ # @yieldparam [DropLink] self
454
+ def initialize(timeout: nil,
455
+ retry_strategy: nil,
456
+ client_context: nil,
457
+ parent_span: nil)
458
+ super
459
+ yield self if block_given?
460
+ end
461
+
462
+ # @api private
463
+ def to_backend
464
+ {
465
+ timeout: Utils::Time.extract_duration(@timeout),
466
+ }
467
+ end
468
+ end
469
+
470
+ # Options for {AnalyticsIndexManager#get_links}
471
+ class GetLinks < ::Couchbase::Options::Base
472
+ attr_accessor :dataverse # @return [String, nil]
473
+ attr_accessor :link_type # @return [Symbol, nil]
474
+ attr_accessor :name # @return [String, nil]
475
+
476
+ # Creates an instance of options for {AnalyticsIndexManager#get_links}
477
+ #
478
+ # @param [:s3, :azureblob, :couchbase, nil] link_type restricts the results to the given link type.
479
+ # @param [String, nil] dataverse restricts the results to a given dataverse, can be given in the form of
480
+ # "namepart" or "namepart1/namepart2".
481
+ # @param [String, nil] name restricts the results to the link with the specified name. If set then dataverse
482
+ # must also be set.
483
+ #
484
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to
485
+ # complete
486
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
487
+ # @param [Hash, nil] client_context the client context data, if set
488
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
489
+ #
490
+ # @yieldparam [GetLinks] self
491
+ def initialize(link_type: nil,
492
+ dataverse: nil,
493
+ name: nil,
494
+ timeout: nil,
495
+ retry_strategy: nil,
496
+ client_context: nil,
497
+ parent_span: nil)
498
+ super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
499
+ @link_type = link_type
500
+ @dataverse = dataverse
501
+ @name = name
502
+ yield self if block_given?
503
+ end
504
+
505
+ # @api private
506
+ def to_backend
507
+ {
508
+ timeout: Utils::Time.extract_duration(@timeout),
509
+ link_type: @link_type.to_s,
510
+ dataverse: @dataverse,
511
+ name: @name,
512
+ }
513
+ end
514
+ end
515
+
516
+ # rubocop:disable Naming/MethodName constructor shortcuts
517
+ module_function
518
+
519
+ # Construct {CreateDataverse} options for {AnalyticsIndexManager#create_dataverse}
520
+ #
521
+ # @return [CreateDataverse]
522
+ def CreateDataverse(**args)
523
+ CreateDataverse.new(**args)
524
+ end
525
+
526
+ # Construct {DropDataverse} options for {AnalyticsIndexManager#drop_dataverse}
527
+ #
528
+ # @return [DropDataverse]
529
+ def DropDataverse(**args)
530
+ DropDataverse.new(**args)
531
+ end
532
+
533
+ # Construct {CreateDataset} options for {AnalyticsIndexManager#create_dataset}
534
+ #
535
+ # @return [CreateDataset]
536
+ def CreateDataset(**args)
537
+ CreateDataset.new(**args)
538
+ end
539
+
540
+ # Construct {DropDataset} options for {AnalyticsIndexManager#drop_dataset}
541
+ #
542
+ # @return [DropDataset]
543
+ def DropDataset(**args)
544
+ DropDataset.new(**args)
545
+ end
546
+
547
+ # Construct {GetAllDatasets} options for {AnalyticsIndexManager#get_all_datasets}
548
+ #
549
+ # @return [GetAllDatasets]
550
+ def GetAllDatasets(**args)
551
+ GetAllDatasets.new(**args)
552
+ end
553
+
554
+ # Construct {CreateIndex} options for {AnalyticsIndexManager#create_index}
555
+ #
556
+ # @return [CreateIndex]
557
+ def CreateIndex(**args)
558
+ CreateIndex.new(**args)
559
+ end
560
+
561
+ # Construct {DropIndex} options for {AnalyticsIndexManager#drop_index}
562
+ #
563
+ # @return [DropIndex]
564
+ def DropIndex(**args)
565
+ DropIndex.new(**args)
566
+ end
567
+
568
+ # Construct {GetAllIndexes} options for {AnalyticsIndexManager#get_all_indexes}
569
+ #
570
+ # @return [GetAllIndexes]
571
+ def GetAllIndexes(**args)
572
+ GetAllIndexes.new(**args)
573
+ end
574
+
575
+ # Construct {ConnectLink} options for {AnalyticsIndexManager#connect_link}
576
+ #
577
+ # @return [ConnectLink]
578
+ def ConnectLink(**args)
579
+ ConnectLink.new(**args)
580
+ end
581
+
582
+ # Construct {DisconnectLink} options for {AnalyticsIndexManager#disconnect_link}
583
+ #
584
+ # @return [DisconnectLink]
585
+ def DisconnectLink(**args)
586
+ DisconnectLink.new(**args)
587
+ end
588
+
589
+ # Construct {GetPendingMutations} options for {AnalyticsIndexManager#get_pending_mutations}
590
+ #
591
+ # @return [GetPendingMutations]
592
+ def GetPendingMutations(**args)
593
+ GetPendingMutations.new(**args)
594
+ end
595
+
596
+ # Construct {CreateLink} options for {AnalyticsIndexManager#create_link}
597
+ #
598
+ # @return [CreateLink]
599
+ def CreateLink(**args)
600
+ CreateLink.new(**args)
601
+ end
602
+
603
+ # Construct {ReplaceLink} options for {AnalyticsIndexManager#replace_link}
604
+ #
605
+ # @return [ReplaceLink]
606
+ def ReplaceLink(**args)
607
+ ReplaceLink.new(**args)
608
+ end
609
+
610
+ # Construct {DropLink} options for {AnalyticsIndexManager#drop_link}
611
+ #
612
+ # @return [DropLink]
613
+ def DropLink(**args)
614
+ DropLink.new(**args)
615
+ end
616
+
617
+ # Construct {GetLinks} options for {AnalyticsIndexManager#get_links}
618
+ #
619
+ # @return [GetLinks]
620
+ def GetLinks(**args)
621
+ GetLinks.new(**args)
622
+ end
623
+
624
+ # rubocop:enable Naming/MethodName
625
+ end
626
+ end
627
+
628
+ class AnalyticsIndexManager
629
+ alias inspect to_s
630
+
631
+ # @param [Couchbase::Backend] backend
632
+ def initialize(backend)
633
+ @backend = backend
634
+ end
635
+
636
+ # Creates a new dataverse
637
+ #
638
+ # @param [String] dataverse_name
639
+ # @param [Options::Analytics::CreateDataverse] options
640
+ #
641
+ # @return [void]
642
+ #
643
+ # @raise [ArgumentError]
644
+ # @raise [Error::DataverseExists]
645
+ def create_dataverse(dataverse_name, options = Options::Analytics::CreateDataverse.new)
646
+ @backend.analytics_dataverse_create(dataverse_name, options.to_backend)
647
+ end
648
+
649
+ # Drops a dataverse
650
+ #
651
+ # @param [String] dataverse_name name of the dataverse
652
+ # @param [Options::Analytics::DropDataverse] options
653
+ #
654
+ # @return [void]
655
+ #
656
+ # @raise [ArgumentError]
657
+ # @raise [Error::DataverseNotFound]
658
+ def drop_dataverse(dataverse_name, options = Options::Analytics::DropDataverse.new)
659
+ @backend.analytics_dataverse_drop(dataverse_name, options.to_backend)
660
+ end
661
+
662
+ # Creates a new dataset
663
+ #
664
+ # @param [String] dataset_name name of dataset
665
+ # @param [String] bucket_name name of the bucket
666
+ # @param [Options::Analytics::CreateDataset] options
667
+ #
668
+ # @return [void]
669
+ #
670
+ # @raise [ArgumentError]
671
+ # @raise [Error::DatasetExists]
672
+ # @raise [Error::LinkNotFound]
673
+ def create_dataset(dataset_name, bucket_name, options = Options::Analytics::CreateDataset.new)
674
+ @backend.analytics_dataset_create(dataset_name, bucket_name, options.to_backend)
675
+ end
676
+
677
+ # Drops a dataset
678
+ #
679
+ # @param [String] dataset_name name of the dataset
680
+ # @param [Options::Analytics::DropDataset] options
681
+ #
682
+ # @return [void]
683
+ #
684
+ # @raise [ArgumentError]
685
+ # @raise [Error::DatasetNotFound]
686
+ def drop_dataset(dataset_name, options = Options::Analytics::DropDataset.new)
687
+ @backend.analytics_dataset_drop(dataset_name, options.to_backend)
688
+ end
689
+
690
+ # Gets all datasets
691
+ #
692
+ # @param [Options::Analytics::GetAllDatasets] options
693
+ #
694
+ # @return [Array<AnalyticsDataset>]
695
+ def get_all_datasets(options = Options::Analytics::GetAllDatasets.new)
696
+ resp = @backend.analytics_dataset_get_all(options.to_backend)
697
+ resp.map do |entry|
698
+ AnalyticsDataset.new do |dataset|
699
+ dataset.name = entry[:name]
700
+ dataset.dataverse_name = entry[:dataverse_name]
701
+ dataset.link_name = entry[:link_name]
702
+ dataset.bucket_name = entry[:bucket_name]
703
+ end
704
+ end
705
+ end
706
+
707
+ # Creates a new index
708
+ #
709
+ # @param [String] index_name name of the index
710
+ # @param [String] dataset_name name of the dataset
711
+ # @param [Hash<String => String>] fields mapping of the field name to field type
712
+ # @param [Options::Analytics::CreateIndex] options
713
+ #
714
+ # @return [void]
715
+ #
716
+ # @raise [ArgumentError]
717
+ # @raise [Error::IndexExists]
718
+ def create_index(index_name, dataset_name, fields, options = Options::Analytics::CreateIndex.new)
719
+ @backend.analytics_index_create(index_name, dataset_name, fields.entries, options.to_backend)
720
+ end
721
+
722
+ # Drops an index
723
+ #
724
+ # @param [String] index_name name of the index
725
+ # @param [String] dataset_name name of the dataset
726
+ # @param [Options::Analytics::DropIndex] options
727
+ #
728
+ # @return [void]
729
+ #
730
+ # @raise [ArgumentError]
731
+ # @raise [Error::IndexNotFound]
732
+ def drop_index(index_name, dataset_name, options = Options::Analytics::DropIndex.new)
733
+ @backend.analytics_index_drop(index_name, dataset_name, options.to_backend)
734
+ end
735
+
736
+ # Gets all indexes
737
+ #
738
+ # @param [Options::Analytics::GetAllIndexes] options
739
+ #
740
+ # @return [Array<AnalyticsIndex>]
741
+ def get_all_indexes(options = Options::Analytics::GetAllIndexes.new)
742
+ resp = @backend.analytics_index_get_all(options.to_backend)
743
+ resp.map do |entry|
744
+ AnalyticsIndex.new do |dataset|
745
+ dataset.name = entry[:name]
746
+ dataset.dataverse_name = entry[:dataverse_name]
747
+ dataset.dataset_name = entry[:dataset_name]
748
+ dataset.is_primary = entry[:is_primary]
749
+ end
750
+ end
751
+ end
752
+
753
+ # Connects a link
754
+ #
755
+ # @param [Options::Analytics::ConnectLink] options
756
+ #
757
+ # @return [void]
758
+ #
759
+ # @raise [ArgumentError]
760
+ # @raise [Error::LinkNotFound]
761
+ def connect_link(options = Options::Analytics::ConnectLink.new)
762
+ @backend.analytics_link_connect(options.to_backend)
763
+ end
764
+
765
+ # Disconnects a link,
766
+ #
767
+ # @param [Options::Analytics::DisconnectLink] options
768
+ #
769
+ # @return [void]
770
+ #
771
+ # @raise [ArgumentError]
772
+ # @raise [Error::LinkNotFound]
773
+ def disconnect_link(options = Options::Analytics::DisconnectLink.new)
774
+ @backend.analytics_link_disconnect(options.to_backend)
775
+ end
776
+
777
+ # Gets the pending mutations for all datasets.
778
+ #
779
+ # @note If a link is disconnected then it will return no results. If all links are disconnected, then
780
+ # an empty object is returned.
781
+ #
782
+ # @param [Options::Analytics::GetPendingMutations] options
783
+ #
784
+ # @return [Hash<String => Integer>] dictionary, where keys are dataset coordinates encoded as +"dataverse.dataset"+
785
+ # and values are number of mutations for given dataset.
786
+ def get_pending_mutations(options = Options::Analytics::GetPendingMutations.new)
787
+ @backend.analytics_get_pending_mutations(options.to_backend)
788
+ end
789
+
790
+ # Creates a link
791
+ #
792
+ # @param [CouchbaseRemoteAnalyticsLink, AzureBlobExternalAnalyticsLink, S3ExternalAnalyticsLink] link
793
+ # @param [Options::Analytics::CreateLink] options
794
+ #
795
+ # @return [void]
796
+ #
797
+ # @raise [ArgumentError]
798
+ # @raise [Error::LinkExists]
799
+ def create_link(link, options = Options::Analytics::CreateLink.new)
800
+ @backend.analytics_link_create(link.to_backend, options.to_backend)
801
+ end
802
+
803
+ # Replaces the link
804
+ #
805
+ # @param [CouchbaseRemoteAnalyticsLink, AzureBlobExternalAnalyticsLink, S3ExternalAnalyticsLink] link
806
+ # @param [Options::Analytics::ReplaceLink] options
807
+ #
808
+ # @return [void]
809
+ #
810
+ # @raise [ArgumentError]
811
+ # @raise [Error::LinkNotFound]
812
+ def replace_link(link, options = Options::Analytics::ReplaceLink.new)
813
+ @backend.analytics_link_replace(link.to_backend, options.to_backend)
814
+ end
815
+
816
+ # Drops the link
817
+ #
818
+ # @param [String] link_name name of the link
819
+ # @param [String] dataverse_name dataverse where the link belongs
820
+ # @param [Options::Analytics::DropLink] options
821
+ #
822
+ # @return [void]
823
+ #
824
+ # @raise [ArgumentError]
825
+ # @raise [Error::LinkNotFound]
826
+ def drop_link(link_name, dataverse_name, options = Options::Analytics::DropLink.new)
827
+ @backend.analytics_link_drop(link_name, dataverse_name, options.to_backend)
828
+ end
829
+
830
+ # Retrieves the links
831
+ #
832
+ # @param [Options::Analytics::GetLinks] options
833
+ #
834
+ # @return [void]
835
+ #
836
+ # @raise [ArgumentError]
837
+ # @raise [Error::LinkNotFound]
838
+ def get_links(options = Options::Analytics::GetLinks.new)
839
+ resp = @backend.analytics_link_get_all(options.to_backend)
840
+ resp.map do |entry|
841
+ case entry[:type]
842
+ when :s3
843
+ S3ExternalAnalyticsLink.new(
844
+ entry[:link_name],
845
+ entry[:dataverse],
846
+ entry[:access_key_id],
847
+ nil,
848
+ entry[:region],
849
+ service_endpoint: entry[:service_endpoint]
850
+ )
851
+ when :couchbase
852
+ CouchbaseRemoteAnalyticsLink.new(
853
+ entry[:link_name],
854
+ entry[:dataverse],
855
+ entry[:hostname],
856
+ username: entry[:username],
857
+ encryption: EncryptionSettings.new(
858
+ level: entry[:encryption_level],
859
+ certificate: entry[:certificate],
860
+ client_certificate: entry[:client_certificate]
861
+ )
862
+ )
863
+ when :azureblob
864
+ AzureBlobExternalAnalyticsLink.new(
865
+ entry[:link_name],
866
+ entry[:dataverse],
867
+ account_name: entry[:account_name],
868
+ blob_endpoint: entry[:blob_endpoint],
869
+ endpoint_suffix: entry[:endpoint_suffix]
870
+ )
871
+ end
872
+ end
873
+ end
874
+
875
+ # @api private
876
+ # TODO: deprecate after 3.2
877
+ CreateDataverseOptions = ::Couchbase::Management::Options::Analytics::CreateDataverse
878
+
879
+ # @api private
880
+ # TODO: deprecate after 3.2
881
+ DropDataverseOptions = ::Couchbase::Management::Options::Analytics::DropDataverse
882
+
883
+ # @api private
884
+ # TODO: deprecate after 3.2
885
+ CreateDatasetOptions = ::Couchbase::Management::Options::Analytics::CreateDataset
886
+
887
+ # @api private
888
+ # TODO: deprecate after 3.2
889
+ DropDatasetOptions = ::Couchbase::Management::Options::Analytics::DropDataset
890
+
891
+ # @api private
892
+ # TODO: deprecate after 3.2
893
+ GetAllDatasetsOptions = ::Couchbase::Management::Options::Analytics::GetAllDatasets
894
+
895
+ # @api private
896
+ # TODO: deprecate after 3.2
897
+ CreateIndexOptions = ::Couchbase::Management::Options::Analytics::CreateIndex
898
+
899
+ # @api private
900
+ # TODO: deprecate after 3.2
901
+ DropIndexOptions = ::Couchbase::Management::Options::Analytics::DropIndex
902
+
903
+ # @api private
904
+ # TODO: deprecate after 3.2
905
+ GetAllIndexesOptions = ::Couchbase::Management::Options::Analytics::GetAllIndexes
906
+
907
+ # @api private
908
+ # TODO: deprecate after 3.2
909
+ ConnectLinkOptions = ::Couchbase::Management::Options::Analytics::ConnectLink
910
+
911
+ # @api private
912
+ # TODO: deprecate after 3.2
913
+ GetPendingMutationsOptions = ::Couchbase::Management::Options::Analytics::GetPendingMutations
914
+ end
915
+
916
+ class AnalyticsDataset
917
+ # @return [String]
918
+ attr_accessor :name
919
+
920
+ # @return [String]
921
+ attr_accessor :dataverse_name
922
+
923
+ # @return [String]
924
+ attr_accessor :link_name
925
+
926
+ # @return [String]
927
+ attr_accessor :bucket_name
928
+
929
+ # @yieldparam [AnalyticsDataset]
930
+ def initialize
931
+ yield self if block_given?
932
+ end
933
+ end
934
+
935
+ class AnalyticsIndex
936
+ # @return [String]
937
+ attr_accessor :name
938
+
939
+ # @return [String]
940
+ attr_accessor :dataset_name
941
+
942
+ # @return [String]
943
+ attr_accessor :dataverse_name
944
+
945
+ # @return [Boolean]
946
+ attr_accessor :is_primary
947
+ alias primary? is_primary
948
+
949
+ # @yieldparam [AnalyticsIndex]
950
+ def initialize
951
+ yield self if block_given?
952
+ end
953
+ end
954
+
955
+ class EncryptionSettings
956
+ attr_accessor :level # @return [Symbol]
957
+ attr_accessor :certificate # @return [String, nil]
958
+ attr_accessor :client_certificate # @return [String, nil]
959
+ attr_accessor :client_key # @return [String, nil]
960
+
961
+ # @param [:none, :half, :full] level Specifies what level of encryption should be used.
962
+ # @param [String, nil] certificate
963
+ # @param [String, nil] client_certificate
964
+ # @param [String, nil] client_key
965
+ #
966
+ # @yieldparam [EncryptionSettings] self
967
+ def initialize(level: :none,
968
+ certificate: nil,
969
+ client_certificate: nil,
970
+ client_key: nil)
971
+ @level = level
972
+ @certificate = certificate
973
+ @client_certificate = client_certificate
974
+ @client_key = client_key
975
+ yield self if block_given?
976
+ end
977
+ end
978
+
979
+ class CouchbaseRemoteAnalyticsLink
980
+ attr_accessor :name # @return [String]
981
+ attr_accessor :dataverse # @return [String]
982
+ attr_accessor :hostname # @return [String]
983
+ attr_accessor :username # @return [String, nil]
984
+ attr_accessor :password # @return [String, nil]
985
+ attr_accessor :encryption # @return [EncryptionSettings]
986
+
987
+ # @param [String] name the name of this link
988
+ # @param [String] dataverse the dataverse this link belongs to
989
+ # @param [String] hostname the hostname of the target Couchbase cluster
990
+ # @param [String, nil] username the username to use for authentication with the remote cluster. Optional if
991
+ # client-certificate authentication is being used.
992
+ # @param [String, nil] password the password to use for authentication with the remote cluster. Optional if
993
+ # client-certificate authentication is being used.
994
+ # @param [EncryptionSettings] encryption settings for connection encryption
995
+ #
996
+ # @yieldparam [CouchbaseRemoteLink] self
997
+ def initialize(name, dataverse, hostname,
998
+ username: nil,
999
+ password: nil,
1000
+ encryption: EncryptionSettings.new)
1001
+ @name = name
1002
+ @dataverse = dataverse
1003
+ @hostname = hostname
1004
+ @username = username
1005
+ @password = password
1006
+ @encryption = encryption
1007
+ yield self if block_given?
1008
+ end
1009
+
1010
+ # @api private
1011
+ def to_backend
1012
+ {
1013
+ type: :couchbase,
1014
+ link_name: @name,
1015
+ dataverse: @dataverse,
1016
+ hostname: @hostname,
1017
+ username: @username,
1018
+ password: @password,
1019
+ encryption_level: @encryption.level,
1020
+ certificate: @encryption.certificate,
1021
+ client_certificate: @encryption.client_certificate,
1022
+ client_key: @encryption.client_key,
1023
+ }
1024
+ end
1025
+ end
1026
+
1027
+ class AzureBlobExternalAnalyticsLink
1028
+ attr_accessor :name # @return [String]
1029
+ attr_accessor :dataverse # @return [String]
1030
+ attr_accessor :connection_string # @return [String, nil]
1031
+ attr_accessor :account_name # @return [String, nil]
1032
+ attr_accessor :account_key # @return [String, nil]
1033
+ attr_accessor :shared_access_signature # @return [String, nil]
1034
+ attr_accessor :blob_endpoint # @return [String, nil]
1035
+ attr_accessor :endpoint_suffix # @return [String, nil]
1036
+
1037
+ # @param [String] name the name of this link
1038
+ # @param [String] dataverse the dataverse this link belongs to
1039
+ # @param [String, nil] connection_string the connection string can be used as an authentication method,
1040
+ # +connection_string+ contains other authentication methods embedded inside the string. Only a single
1041
+ # authentication method can be used. (e.g. "AccountName=myAccountName;AccountKey=myAccountKey").
1042
+ # @param [String, nil] account_name Azure blob storage account name
1043
+ # @param [String, nil] account_key Azure blob storage account key
1044
+ # @param [String, nil] shared_access_signature token that can be used for authentication
1045
+ # @param [String, nil] blob_endpoint Azure blob storage endpoint
1046
+ # @param [String, nil] endpoint_suffix Azure blob endpoint suffix
1047
+ #
1048
+ # @yieldparam [AzureBlobExternalAnalyticsLink] self
1049
+ def initialize(name, dataverse,
1050
+ connection_string: nil,
1051
+ account_name: nil,
1052
+ account_key: nil,
1053
+ shared_access_signature: nil,
1054
+ blob_endpoint: nil,
1055
+ endpoint_suffix: nil)
1056
+ @name = name
1057
+ @dataverse = dataverse
1058
+ @connection_string = connection_string
1059
+ @account_name = account_name
1060
+ @account_key = account_key
1061
+ @shared_access_signature = shared_access_signature
1062
+ @blob_endpoint = blob_endpoint
1063
+ @endpoint_suffix = endpoint_suffix
1064
+ yield self if block_given?
1065
+ end
1066
+
1067
+ # @api private
1068
+ def to_backend
1069
+ {
1070
+ type: :azureblob,
1071
+ link_name: @name,
1072
+ dataverse: @dataverse,
1073
+ connection_string: @connection_string,
1074
+ account_name: @account_name,
1075
+ account_key: @account_key,
1076
+ shared_access_signature: @shared_access_signature,
1077
+ blob_endpoint: @blob_endpoint,
1078
+ endpoint_suffix: @endpoint_suffix,
1079
+ }
1080
+ end
1081
+ end
1082
+
1083
+ class S3ExternalAnalyticsLink
1084
+ attr_accessor :name # @return [String]
1085
+ attr_accessor :dataverse # @return [String]
1086
+ attr_accessor :access_key_id # @return [String]
1087
+ attr_accessor :secret_access_key # @return [String]
1088
+ attr_accessor :session_token # @return [String, nil]
1089
+ attr_accessor :region # @return [String]
1090
+ attr_accessor :service_endpoint # @return [String, nil]
1091
+
1092
+ # @param [String] name the name of this link
1093
+ # @param [String] dataverse the dataverse this link belongs to
1094
+ # @param [String] access_key_id AWS S3 access key ID
1095
+ # @param [String] secret_access_key AWS S3 secret key
1096
+ # @param [String] region AWS S3 region
1097
+ # @param [String, nil] session_token AWS S3 token if temporary credentials are provided. Only available in 7.0+
1098
+ # @param [String, nil] service_endpoint AWS S3 service endpoint
1099
+ #
1100
+ # @yieldparam [S3ExternalAnalyticsLink] self
1101
+ def initialize(name, dataverse, access_key_id, secret_access_key, region,
1102
+ session_token: nil,
1103
+ service_endpoint: nil)
1104
+ @name = name
1105
+ @dataverse = dataverse
1106
+ @access_key_id = access_key_id
1107
+ @secret_access_key = secret_access_key
1108
+ @session_token = session_token
1109
+ @region = region
1110
+ @service_endpoint = service_endpoint
1111
+ yield self if block_given?
1112
+ end
1113
+
1114
+ # @api private
1115
+ def to_backend
1116
+ {
1117
+ type: :s3,
1118
+ link_name: @name,
1119
+ dataverse: @dataverse,
1120
+ access_key_id: @access_key_id,
1121
+ secret_access_key: @secret_access_key,
1122
+ session_token: @session_token,
1123
+ region: @region,
1124
+ service_endpoint: @service_endpoint,
1125
+ }
1126
+ end
1127
+ end
1128
+ end
1129
+ end