opensearch-ruby 1.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87b12f335bb618b7804ea4458f75b3a3486277d996dbb3bb51dbca8cc9dfe427
4
- data.tar.gz: 969a386faae41efeddc3d7d667d8a1479ce49355b3fd56bb8bad1a43981045e8
3
+ metadata.gz: 38310bc415727f6cde26b579ee5da55f01beb87233d736a480058da59ff41198
4
+ data.tar.gz: b5b7cfcc566ebe29bad4dae3298c96c934b741b50a6b4aa1594482a25e8e4492
5
5
  SHA512:
6
- metadata.gz: c984cce0c114bf7def5aac8a59c5c0f3f7f799011ce2e7c8b2d40ab9f090be182dd5b26948a47955a46d9c5052b21da4f338ca9871a3b1e62ebf3a70b298ec78
7
- data.tar.gz: b415ab64f55bc9d722476a1fbc2e0687f4c188e45a658b124ccce049e3508247eb7b517977f42427834e966e4c89c86adf97d3863eb2d676230b19fbc624d037
6
+ metadata.gz: f9cac12bcda9f52c5b4def25b9d315701c6c2c0c3481dd2fc2a909a87450ebd0608bd7027b60af191d2f2bd9bc936c0ca0d9a11d9a63b22a4f188ee75a37efbd
7
+ data.tar.gz: 1613868fbee729529dc5ce975a621b142841894588899abf54c47dc1acb225700ede78da5165ff2048f5de719b9ac48b117ef3f907c837860198647fb300671a
checksums.yaml.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -20,6 +20,8 @@ The OpenSearch client for Ruby is compatible with Ruby 1.9 and higher.
20
20
 
21
21
  The client's API is compatible with OpenSearch's API versions from 1.0.0 till current.
22
22
 
23
+ See [COMPATIBILITY](../COMPATIBILITY.md) for more details.
24
+
23
25
  ## Installation
24
26
 
25
27
  Install the package from [Rubygems](https://rubygems.org):
data/Rakefile CHANGED
@@ -35,13 +35,8 @@ task test: 'test:spec'
35
35
  require 'rspec/core/rake_task'
36
36
 
37
37
  namespace :test do
38
- desc 'Wait for OpenSearch to be in a green state'
39
- task :wait_for_green do
40
- sh '../scripts/wait-cluster.sh'
41
- end
42
-
43
38
  RSpec::Core::RakeTask.new(:integration) do |t|
44
- t.pattern = 'spec/integration/**{,/*/**}/*_spec.rb'
39
+ t.pattern = 'spec/integration/security_disabled/**{,/*/**}/*_spec.rb'
45
40
  end
46
41
 
47
42
  RSpec::Core::RakeTask.new(:unit) do |t|
@@ -55,6 +50,17 @@ namespace :test do
55
50
  end
56
51
  end
57
52
 
53
+ namespace :test_security do
54
+ RSpec::Core::RakeTask.new(:integration) do |t|
55
+ t.pattern = 'spec/integration/security_enabled/**{,/*/**}/*_spec.rb'
56
+ end
57
+
58
+ desc 'Run security integration tests'
59
+ task :all do
60
+ Rake::Task['test_security:integration'].invoke
61
+ end
62
+ end
63
+
58
64
  # ----- Documentation tasks ---------------------------------------------------
59
65
 
60
66
  require 'yard'
@@ -25,5 +25,5 @@
25
25
  # under the License.
26
26
 
27
27
  module OpenSearch
28
- VERSION = '1.0.0'.freeze
28
+ VERSION = '2.1.0'.freeze
29
29
  end
data/lib/opensearch.rb CHANGED
@@ -65,7 +65,7 @@ module OpenSearch
65
65
 
66
66
  body = if response.headers['content-type'] == 'application/yaml'
67
67
  require 'yaml'
68
- YAML.load(response.body)
68
+ YAML.safe_load(response.body)
69
69
  else
70
70
  response.body
71
71
  end
@@ -61,8 +61,8 @@ Gem::Specification.new do |s|
61
61
 
62
62
  s.required_ruby_version = '>= 2.4'
63
63
 
64
- s.add_dependency 'opensearch-transport', '1.0.0'
65
- s.add_dependency 'opensearch-api', '1.0.0'
64
+ s.add_dependency 'opensearch-transport', '~> 2.0'
65
+ s.add_dependency 'opensearch-api', '~> 2.1'
66
66
 
67
67
  s.add_development_dependency 'bundler'
68
68
  s.add_development_dependency 'byebug' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
@@ -26,7 +26,7 @@
26
26
  require 'spec_helper'
27
27
  require 'logger'
28
28
 
29
- context 'OpenSearch client' do
29
+ context 'OpenSearch client ' do
30
30
  let(:logger) { Logger.new($stderr) }
31
31
 
32
32
  let(:client) do
@@ -27,7 +27,7 @@ require 'spec_helper'
27
27
  require 'logger'
28
28
 
29
29
  describe 'OpenSearch validation integration' do
30
- it 'Validates for OpenSearch 1.0.0-SNAPSHOT' do
30
+ it 'Validates for OpenSearch' do
31
31
  client = OpenSearch::Client.new(
32
32
  host: OPENSEARCH_URL,
33
33
  logger: Logger.new($stderr)
@@ -0,0 +1,43 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+ require 'spec_helper'
10
+ require 'logger'
11
+
12
+ context 'OpenSearch client with security plugin enabled' do
13
+ let(:logger) { Logger.new($stderr) }
14
+
15
+ let(:client) do
16
+ OpenSearch::Client.new(
17
+ host: OPENSEARCH_URL,
18
+ logger: logger,
19
+ transport_options: { ssl: { verify: false } }
20
+ )
21
+ end
22
+
23
+ context 'Integrates with opensearch API' do
24
+ it 'should perform the API methods' do
25
+ expect do
26
+ # Index a document
27
+ client.index(index: 'test-index', id: '1', body: { title: 'Test' })
28
+
29
+ # Refresh the index
30
+ client.indices.refresh(index: 'test-index')
31
+
32
+ # Search
33
+ response = client.search(index: 'test-index', body: { query: { match: { title: 'test' } } })
34
+
35
+ expect(response['hits']['total']['value']).to eq 1
36
+ expect(response['hits']['hits'][0]['_source']['title']).to eq 'Test'
37
+
38
+ # Delete the index
39
+ client.indices.delete(index: 'test-index')
40
+ end.not_to raise_error
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,40 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+ #
10
+ # Licensed to Elasticsearch B.V. under one or more contributor
11
+ # license agreements. See the NOTICE file distributed with
12
+ # this work for additional information regarding copyright
13
+ # ownership. Elasticsearch B.V. licenses this file to you under
14
+ # the Apache License, Version 2.0 (the "License"); you may
15
+ # not use this file except in compliance with the License.
16
+ # You may obtain a copy of the License at
17
+ #
18
+ # http://www.apache.org/licenses/LICENSE-2.0
19
+ #
20
+ # Unless required by applicable law or agreed to in writing,
21
+ # software distributed under the License is distributed on an
22
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+ # KIND, either express or implied. See the License for the
24
+ # specific language governing permissions and limitations
25
+ # under the License.
26
+ require 'spec_helper'
27
+ require 'logger'
28
+
29
+ describe 'OpenSearch validation integration with security plugin enabled' do
30
+ it 'Validates for OpenSearch' do
31
+ client = OpenSearch::Client.new(
32
+ host: OPENSEARCH_URL,
33
+ logger: Logger.new($stderr),
34
+ transport_options: { ssl: { verify: false } }
35
+ )
36
+ expect(client.instance_variable_get('@verified')).to be false
37
+ client.count
38
+ expect(client.instance_variable_get('@verified')).to be true
39
+ end
40
+ end
@@ -84,7 +84,7 @@ describe 'OpenSearch: Validation' do
84
84
  end
85
85
  end
86
86
 
87
- context 'When Elasticsearch replies with status 403' do
87
+ context 'When OpenSearch replies with status 403' do
88
88
  let(:status) { 403 }
89
89
  let(:body) { {}.to_json }
90
90
 
@@ -105,9 +105,9 @@ describe 'OpenSearch: Validation' do
105
105
  end
106
106
  end
107
107
 
108
- context 'When the OpenSearch version is 1.0.0-SNAPSHOT' do
108
+ context 'When the OpenSearch version is 2.0.0' do
109
109
  context 'With a valid OpenSearch response' do
110
- let(:body) { { 'version' => { 'number' => '1.0.0-SNAPSHOT', 'distribution' => 'opensearch' } }.to_json }
110
+ let(:body) { { 'version' => { 'number' => '2.0.0', 'distribution' => 'opensearch' } }.to_json }
111
111
  let(:headers) do
112
112
  {
113
113
  'content-type' => 'json'
@@ -123,7 +123,7 @@ describe 'OpenSearch: Validation' do
123
123
  end
124
124
 
125
125
  context 'When the distribution is not present' do
126
- let(:body) { { 'version' => { 'number' => '1.0.0-SNAPSHOT' } }.to_json }
126
+ let(:body) { { 'version' => { 'number' => '2.0.0' } }.to_json }
127
127
  it 'Fails validation' do
128
128
  verify_request_stub
129
129
 
@@ -187,7 +187,7 @@ describe 'OpenSearch: Validation' do
187
187
  end
188
188
 
189
189
  let(:headers) { { 'content-type' => 'application/yaml'} }
190
- let(:body) { "---\nversion:\n number: \"1.0.0-SNAPSHOT\"\n distribution: \"opensearch\"\n" }
190
+ let(:body) { "---\nversion:\n number: \"2.0.0\"\n distribution: \"opensearch\"\n" }
191
191
 
192
192
  it 'validates' do
193
193
  verify_request_stub
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opensearch-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jayesh Hathila
@@ -15,7 +15,7 @@ cert_chain:
15
15
  -----BEGIN CERTIFICATE-----
16
16
  MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRMwEQYDVQQDDApvcGVu
17
17
  c2VhcmNoMRYwFAYKCZImiZPyLGQBGRYGYW1hem9uMRMwEQYKCZImiZPyLGQBGRYD
18
- Y29tMB4XDTIxMDgwMjIxMDQwM1oXDTIyMDgwMjIxMDQwM1owQjETMBEGA1UEAwwK
18
+ Y29tMB4XDTIyMDgxNzE3NTIzNFoXDTIzMDgxNzE3NTIzNFowQjETMBEGA1UEAwwK
19
19
  b3BlbnNlYXJjaDEWMBQGCgmSJomT8ixkARkWBmFtYXpvbjETMBEGCgmSJomT8ixk
20
20
  ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM1z3/jcitjV
21
21
  umXwRFn+JSBBd36qZB54Dtucf6+E2fmNPzBRhgYN5XJy/+clQJ9NIJV7C8H52P3V
@@ -26,43 +26,43 @@ cert_chain:
26
26
  zfR37/NQFkECAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
27
27
  BBYEFJJ2myhLXK742btavNbG0IWrMNBIMCAGA1UdEQQZMBeBFW9wZW5zZWFyY2hA
28
28
  YW1hem9uLmNvbTAgBgNVHRIEGTAXgRVvcGVuc2VhcmNoQGFtYXpvbi5jb20wDQYJ
29
- KoZIhvcNAQEFBQADggEBAE7gBP5ecTtKb04qmEsnbJ6+yn0LUSmxPabFBnB6h1+T
30
- XW8BvBw9MpE//5fQf4HSia3m9XjRpl4WxBcJiyfLER64tk/c1JLhV2+rq3CCV/be
31
- DFSP6gY93kK7jwauajGQvyHzORaW1TBM6diIRYCMLY7Isf+PTHl0xhZZBSVm8wl6
32
- IstV+mTP2KC1l7hSzUDb4rrOSnpRB7AEczcDdkjwzHKIlw8rcL+PLLnFTOgqKyq3
33
- yXikuH6LEVykA8pgOcB9gKsB2/zMd2ZlSj2monM8Qw9EfB14ZSDTYS8VYuwWCeF0
34
- eFmXXk0ufQFKl1Yll7quHkmQ0PzKkvXTpONBT6qPkXE=
29
+ KoZIhvcNAQEFBQADggEBAH5pWLYwKWFh1OjdCReGz/VEAiF4jXXputoN5Z8ga+1Z
30
+ lg8/diJf0PlP2B46PdmxH/TVc/o+qglNO2cHVEp8xZfEd83dfioOBeK90URQUpC5
31
+ UZmO0LZusg46SQKwKa2ukpIy2fNi3PeHRiV+W2Zv69GoWppyLun+fMez7wVoah2r
32
+ r5ROUYuAvFUvga1Vm+49pKiPM5n+MAYP5t/vWhgymY3SYQ1TfewkvKAFiFXikOR+
33
+ r+j7FLyKuk5DzIxiCp8QN5dU71BbGUmsHf/C5UV76WLPOFX/szeaHhPwpjR3sK7r
34
+ 5zLgCV1KP7cgDdCYMlmZGeSViU8NV+Yy8/ghrzGpqVw=
35
35
  -----END CERTIFICATE-----
36
- date: 2021-12-06 00:00:00.000000000 Z
36
+ date: 2022-11-30 00:00:00.000000000 Z
37
37
  dependencies:
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: opensearch-transport
40
40
  requirement: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - '='
42
+ - - "~>"
43
43
  - !ruby/object:Gem::Version
44
- version: 1.0.0
44
+ version: '2.0'
45
45
  type: :runtime
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
48
48
  requirements:
49
- - - '='
49
+ - - "~>"
50
50
  - !ruby/object:Gem::Version
51
- version: 1.0.0
51
+ version: '2.0'
52
52
  - !ruby/object:Gem::Dependency
53
53
  name: opensearch-api
54
54
  requirement: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - '='
56
+ - - "~>"
57
57
  - !ruby/object:Gem::Version
58
- version: 1.0.0
58
+ version: '2.1'
59
59
  type: :runtime
60
60
  prerelease: false
61
61
  version_requirements: !ruby/object:Gem::Requirement
62
62
  requirements:
63
- - - '='
63
+ - - "~>"
64
64
  - !ruby/object:Gem::Version
65
- version: 1.0.0
65
+ version: '2.1'
66
66
  - !ruby/object:Gem::Dependency
67
67
  name: bundler
68
68
  requirement: !ruby/object:Gem::Requirement
@@ -205,7 +205,7 @@ dependencies:
205
205
  version: '0'
206
206
  description: 'Ruby integrations for OpenSearch (client, API, etc.)
207
207
 
208
- '
208
+ '
209
209
  email:
210
210
  - jayehh@amazon.com
211
211
  - vamshin@amazon.com
@@ -227,9 +227,11 @@ files:
227
227
  - lib/opensearch-ruby.rb
228
228
  - lib/opensearch.rb
229
229
  - lib/opensearch/version.rb
230
- - opensearch.gemspec
231
- - spec/integration/client_integration_spec.rb
232
- - spec/integration/validation_integration_spec.rb
230
+ - opensearch-ruby.gemspec
231
+ - spec/integration/security_disabled/client_integration_spec.rb
232
+ - spec/integration/security_disabled/validation_integration_spec.rb
233
+ - spec/integration/security_enabled/client_integration_spec.rb
234
+ - spec/integration/security_enabled/validation_integration_spec.rb
233
235
  - spec/spec_helper.rb
234
236
  - spec/unit/opensearch_product_validation_spec.rb
235
237
  - spec/unit/wrapper_gem_spec.rb
@@ -256,13 +258,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
258
  - !ruby/object:Gem::Version
257
259
  version: '0'
258
260
  requirements: []
259
- rubygems_version: 3.0.8
261
+ rubygems_version: 3.3.26
260
262
  signing_key:
261
263
  specification_version: 4
262
264
  summary: Ruby integrations for OpenSearch
263
265
  test_files:
264
- - spec/integration/client_integration_spec.rb
265
- - spec/integration/validation_integration_spec.rb
266
+ - spec/integration/security_disabled/client_integration_spec.rb
267
+ - spec/integration/security_disabled/validation_integration_spec.rb
268
+ - spec/integration/security_enabled/client_integration_spec.rb
269
+ - spec/integration/security_enabled/validation_integration_spec.rb
266
270
  - spec/spec_helper.rb
267
271
  - spec/unit/opensearch_product_validation_spec.rb
268
272
  - spec/unit/wrapper_gem_spec.rb
metadata.gz.sig CHANGED
Binary file