opensearch-aws-sigv4 1.2.0 → 1.2.1

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: 8afd49d01221929f86b5bf1792d12a963cb969b5edc6a9abb242241c31170221
4
- data.tar.gz: 278f930240341ab20ed9fe5f8182c1344b1825f7af7232001d096a320c90d9f7
3
+ metadata.gz: 3653f0078c0217fcf752f3a3dbd8f5fb69d528f1792c8f15bab2d227729befc4
4
+ data.tar.gz: 41e8d376d24bb217f766970265a50c4502d8b7ca6995099619bb5c9051a8e6c4
5
5
  SHA512:
6
- metadata.gz: cf3e31f4899441290c6ea65c452d52a1a21b5c36debc1c3bb1c0545d963526b86321ccaf0b136c75dd0dda5851bfe91a869154a08a3b01db2368ebe45c56955d
7
- data.tar.gz: 2f5d79ef941d038d2c2f04a39266a8919c1c09626492da0946476b73b57c34565d8fcc05863c084e98f46e75f5d9e9f42416f5048a9674cd179ce1fbcf62c2c5
6
+ metadata.gz: 65bd6720403fb13d258a21c0e21c28312d57b04346435388f23ddf976e1aedf190abbb7c469b4cacc0c418b0bd29bb7ee700eae59fb58cac388be5e8067eed72
7
+ data.tar.gz: ae9eb85688027bb1b9de52fc62f5c8a3829d99e8414c397b80486e94f225f3393a47ea7cad47bf2b448247d136c9da0b777408fd6ec927b626dd534794862e37
checksums.yaml.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
- - [OpenSearch AWS Sigv4 Client](#opensearch-aws-sigv4-client)
2
- - [Compatibility](#compatibility)
3
- - [User Guide](#user-guide)
4
- - [License](#license)
1
+ [<img src="OpenSearch.svg" width="400">](https://opensearch.org)
2
+
5
3
  # OpenSearch AWS Sigv4 Client
6
4
 
7
5
  The `opensearch-aws-sigv4` library provides an AWS Sigv4 client for connecting to [Amazon OpenSearch Service](https://docs.aws.amazon.com/opensearch-service/index.html).
8
6
 
7
+ This library is an AWS Sigv4 wrapper for [`opensearch-ruby`](https://github.com/opensearch-project/opensearch-ruby/tree/main), which is a Ruby client for OpenSearch. The `OpenSearch::Aws::Sigv4Client`, therefore, has all features of `OpenSearch::Client`.
8
+
9
9
  ## Compatibility
10
10
 
11
- See [COMPATIBILITY](../COMPATIBILITY.md).
11
+ The `opensearch-aws-sigv4` library is compatible with all versions of `opensearch-ruby`.
12
12
 
13
13
  ## User Guide
14
14
 
@@ -16,4 +16,4 @@ See [USER_GUIDE](USER_GUIDE.md).
16
16
 
17
17
  ## License
18
18
 
19
- This software is licensed under the [Apache 2 license](./LICENSE).
19
+ This software is licensed under the [Apache 2 license](LICENSE).
data/USER_GUIDE.md CHANGED
@@ -2,6 +2,7 @@
2
2
  - [Setup](#setup)
3
3
  - [Usage](#usage)
4
4
  - [Amazon OpenSearch Service](#amazon-opensearch-service)
5
+ - [Enable Sigv4 Debug Logging](#enable-sigv4-debug-logging)
5
6
  # User Guide
6
7
  ## Setup
7
8
 
@@ -22,7 +23,7 @@ bundle install
22
23
 
23
24
  ## Usage
24
25
 
25
- This library is an AWS Sigv4 wrapper for [`opensearch-ruby`](https://github.com/opensearch-project/opensearch-ruby/tree/main/opensearch-ruby), which is a Ruby client for OpenSearch. The `OpenSearch::Aws::Sigv4Client`, therefore, has all features of `OpenSearch::Client`.
26
+ This library is an AWS Sigv4 wrapper for [`opensearch-ruby`](https://github.com/opensearch-project/opensearch-ruby/tree/main), which is a Ruby client for OpenSearch. The `OpenSearch::Aws::Sigv4Client`, therefore, has all features of `OpenSearch::Client`.
26
27
 
27
28
  ### Amazon OpenSearch Service
28
29
  To sign requests for the Amazon OpenSearch Service:
@@ -57,3 +58,39 @@ client.delete(index: index, id: '1')
57
58
  # delete the index
58
59
  client.indices.delete(index: index)
59
60
  ```
61
+
62
+ ### Enable Sigv4 Debug Logging
63
+ If you run into credentials errors, usually from expired session, set the `sigv4_debug` option to `true` when creating the client to print out the Sigv4 Signing Debug information.
64
+
65
+ ```ruby
66
+ client = OpenSearch::Aws::Sigv4Client.new({
67
+ host: 'https://your.amz-managed-opensearch.domain',
68
+ }, signer, sigv4_debug: true)
69
+
70
+ client.info
71
+ ```
72
+
73
+ ```shell
74
+ (2023-04-25 11:02:59 -0600) Sigv4 - STRING TO SIGN:
75
+ AWS4-HMAC-SHA256
76
+ 20230425T170259Z
77
+ 20230425/us-east-1/aoss/aws4_request
78
+ 0e20bdc5eda484f2b0e65f8a33514c48471500da91b1f0c8bb6b86770b5dc6c4
79
+
80
+ (2023-04-25 11:02:59 -0600) Sigv4 - CANONICAL REQUEST:
81
+ GET
82
+ /
83
+
84
+ host:your.amz-managed-opensearch.domain
85
+ x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
86
+ x-amz-date:20230425T170259Z
87
+
88
+ host;x-amz-content-sha256;x-amz-date
89
+ e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
90
+
91
+ (2023-04-25 11:02:59 -0600) Sigv4 - SIGNATURE HEADERS:
92
+ {"host"=>"your.amz-managed-opensearch.domain",
93
+ "x-amz-date"=>"20230425T170259Z",
94
+ "x-amz-content-sha256"=>"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
95
+ "authorization"=>"AWS4-HMAC-SHA256 Credential=ABCDEFGH/20230425/us-east-1/aoss/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=858f171c834231ae3c885c670217f94c68f010e85c50b0ad095444966fb5df0c"}
96
+ ```
@@ -1,43 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- $LOAD_PATH.unshift(File.expand_path('../../opensearch-aws-sigv4/lib', __dir__))
4
- $LOAD_PATH.unshift(File.expand_path('../../opensearch-ruby/lib', __dir__))
5
- $LOAD_PATH.unshift(File.expand_path('../../opensearch-transport/lib', __dir__))
6
- $LOAD_PATH.unshift(File.expand_path('../../opensearch-dsl/lib', __dir__))
7
- $LOAD_PATH.unshift(File.expand_path('../../opensearch-api/lib', __dir__))
4
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
8
5
 
9
6
  require 'opensearch-aws-sigv4'
10
-
11
- gems_not_loaded = ['opensearch-dsl'].reject do |gem|
12
- begin
13
- (require gem) || true
14
- rescue LoadError
15
- false
16
- end
17
- end
18
-
19
- unless gems_not_loaded.empty?
20
- warn "The following gems were not loaded: [#{gems_not_loaded.join(', ')}]. Please install and require them explicitly."
21
- end
22
-
23
- include OpenSearch
24
- include OpenSearch::DSL if defined?(OpenSearch::DSL)
7
+ require 'aws-sigv4'
25
8
 
26
9
  begin
27
10
  require 'pry'
11
+ Pry.start
28
12
  rescue LoadError
29
- end
30
-
31
- begin
32
13
  require 'irb'
33
- rescue LoadError
34
- end
35
-
36
- if defined?(Pry)
37
- Pry.config.prompt_name = 'opensearch_sigv4'
38
- Pry.start
39
- elsif defined?(IRB)
40
14
  IRB.start
41
- else
42
- abort 'LoadError: opensearch_sigv4_console requires Pry or IRB'
43
15
  end
@@ -7,10 +7,12 @@
7
7
  # Modifications Copyright OpenSearch Contributors. See
8
8
  # GitHub history for details.
9
9
 
10
+ # frozen_string_literal: true
11
+
10
12
  module OpenSearch
11
13
  module Aws
12
14
  module Sigv4
13
- VERSION = '1.2.0'.freeze
15
+ VERSION = '1.2.1'
14
16
  end
15
17
  end
16
18
  end
@@ -1,3 +1,4 @@
1
+ # rubocop:disable Naming/FileName
1
2
  # SPDX-License-Identifier: Apache-2.0
2
3
  #
3
4
  # The OpenSearch Contributors require contributions made to
@@ -7,6 +8,8 @@
7
8
  # Modifications Copyright OpenSearch Contributors. See
8
9
  # GitHub history for details.
9
10
 
11
+ # frozen_string_literal: true
12
+
10
13
  require 'opensearch-ruby'
11
14
  require 'aws-sigv4/signer'
12
15
  require 'faraday'
@@ -41,7 +44,7 @@ module OpenSearch
41
44
  # @param [Aws::Sigv4::Signer] sigv4_signer an instance of AWS Sigv4 Signer.
42
45
  # @param [Hash] options
43
46
  # @option options [Boolean] :sigv4_debug whether to log debug info for Sigv4 Signing
44
- def initialize(transport_args = {}, sigv4_signer, options: {}, &block)
47
+ def initialize(transport_args, sigv4_signer, options: {}, &block)
45
48
  unless sigv4_signer.is_a?(::Aws::Sigv4::Signer)
46
49
  raise ArgumentError, "Please pass a Aws::Sigv4::Signer. A #{sigv4_signer.class} was given."
47
50
  end
@@ -59,11 +62,12 @@ module OpenSearch
59
62
  http_method: method,
60
63
  url: signature_url(path, params),
61
64
  headers: headers,
62
- body: signature_body)
65
+ body: signature_body
66
+ )
63
67
  headers = (headers || {}).merge(signature.headers)
64
68
 
65
69
  log_signature_info(signature)
66
- super(method, path, params, body, headers)
70
+ super(method, path, params, signature_body, headers)
67
71
  end
68
72
 
69
73
  private
@@ -74,8 +78,8 @@ module OpenSearch
74
78
 
75
79
  def signature_url(path, params)
76
80
  host = @transport.transport.hosts.dig(0, :host)
77
- path = '/' + path unless path.start_with?('/')
78
- query_string = params.empty? ? '' : "#{Faraday::Utils::ParamsHash[params].to_query}"
81
+ path = "/#{path}" unless path.start_with?('/')
82
+ query_string = params.empty? ? '' : Faraday::Utils::ParamsHash[params].to_query.to_s
79
83
  URI::HTTP.build(host: host, path: path, query: query_string)
80
84
  end
81
85
 
@@ -97,10 +101,12 @@ module OpenSearch
97
101
 
98
102
  require 'logger'
99
103
  @logger = Logger.new(
100
- STDOUT,
104
+ $stdout,
101
105
  progname: 'Sigv4',
102
- formatter: proc { |_severity, datetime, progname, msg| "\e[34m(#{datetime}) #{progname} - #{msg}\e[0m\n\n" })
106
+ formatter: proc { |_severity, datetime, progname, msg| "\e[34m(#{datetime}) #{progname} - #{msg}\e[0m\n\n" }
107
+ )
103
108
  end
104
109
  end
105
110
  end
106
111
  end
112
+ # rubocop:enable Naming/FileName
@@ -7,22 +7,6 @@
7
7
  # Modifications Copyright OpenSearch Contributors. See
8
8
  # GitHub history for details.
9
9
 
10
- *.gem
11
- *.rbc
12
- .bundle
13
- .config
14
- .yardoc
15
- .ruby-version
16
- .idea/
17
- Gemfile.lock
18
- InstalledFiles
19
- _yardoc
20
- coverage
21
- doc/
22
- lib/bundler/man
23
- pkg
24
- rdoc
25
- spec/reports
26
- test/tmp
27
- test/version_tmp
28
- tmp
10
+ # frozen_string_literal: true
11
+
12
+ require 'opensearch-aws-sigv4'
@@ -7,58 +7,48 @@
7
7
  # Modifications Copyright OpenSearch Contributors. See
8
8
  # GitHub history for details.
9
9
 
10
- lib = File.expand_path('../lib', __FILE__)
11
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
12
- require 'opensearch-aws-sigv4/version'
10
+ # frozen_string_literal: true
13
11
 
14
- signing_key_path = File.expand_path("../gem-private_key.pem")
12
+ require_relative 'lib/opensearch-aws-sigv4/version'
15
13
 
16
14
  Gem::Specification.new do |s|
17
15
  s.name = 'opensearch-aws-sigv4'
18
16
  s.version = OpenSearch::Aws::Sigv4::VERSION
19
- s.authors = ['Theo Truong', 'Robin Roestenburg']
20
- s.email = ['theo.nam.truong@gmail.com', 'robin.roestenburg@4me.com']
21
- s.summary = 'Ruby AWS Sigv4 Client for OpenSearch'
22
- s.homepage = 'https://opensearch.org/docs/latest'
17
+ s.homepage = 'https://github.com/opensearch-project/opensearch-ruby-aws-sigv4'
23
18
  s.license = 'Apache-2.0'
19
+ s.authors = ['OpenSearch Contributors']
20
+ s.email = 'opensearch@amazon.com'
21
+ s.summary = 'Ruby AWS Sigv4 Client for OpenSearch'
22
+ s.description = <<~DESC
23
+ A wrapper for opensearch-ruby gem that provides AWS Sigv4 signing.
24
+ It behaves like OpenSearch::Client, but signs every request with AWS Sigv4
25
+ using the credentials provided during the client's initialization.
26
+ DESC
24
27
  s.metadata = {
25
- 'homepage_uri' => 'https://opensearch.org/docs/latest/',
26
- 'source_code_uri' => 'https://github.com/opensearch-project/opensearch-ruby/tree/main',
27
- 'bug_tracker_uri' => 'https://github.com/opensearch-project/opensearch-ruby/issues'
28
+ 'homepage_uri' => 'https://github.com/opensearch-project/opensearch-ruby-aws-sigv4',
29
+ 'documentation_uri' => 'https://rubydoc.info/gems/opensearch-aws-sigv4/OpenSearch/Aws/Sigv4Client',
30
+ 'source_code_uri' => 'https://github.com/opensearch-project/opensearch-ruby-aws-sigv4/tree/main',
31
+ 'bug_tracker_uri' => 'https://github.com/opensearch-project/opensearch-ruby-aws-sigv4/issues',
32
+ 'changelog_uri' => 'https://github.com/opensearch-project/opensearch-ruby-aws-sigv4/blob/main/CHANGELOG.md'
28
33
  }
29
- s.files = `git ls-files`.split($/)
30
- s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
31
- s.executables << 'opensearch_sigv4_console'
32
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
33
-
34
- if $PROGRAM_NAME.end_with?("gem") && ARGV == ["build", __FILE__] && File.exist?(signing_key_path)
35
- s.signing_key = signing_key_path
36
- s.cert_chain = ['../certs/opensearch-rubygems.pem']
37
- end
38
34
 
35
+ s.files = Dir['lib/**/*', '*.gemspec']
36
+ s.test_files = Dir['spec/unit/**/*']
39
37
  s.require_paths = ['lib']
40
- s.bindir = 'bin'
38
+ s.bindir = 'bin'
39
+ s.executables = 'opensearch_sigv4_console'
41
40
 
42
- s.extra_rdoc_files = [ 'README.md', 'LICENSE' ]
43
- s.rdoc_options = [ '--charset=UTF-8' ]
41
+ s.extra_rdoc_files = %w[README.md USER_GUIDE.md LICENSE]
42
+ s.rdoc_options = ['--charset=UTF-8']
44
43
 
45
- s.required_ruby_version = '>= 2.5'
46
-
47
- s.add_dependency 'aws-sigv4', '~> 1'
48
- s.add_dependency 'opensearch-ruby', '>= 1.0.1'
44
+ signing_key = File.expand_path('gem-private_key.pem')
45
+ if $PROGRAM_NAME.end_with?('gem') && ARGV.first == 'build' && File.exist?(signing_key)
46
+ s.signing_key = signing_key
47
+ s.cert_chain = ['.github/opensearch-rubygems.pem']
48
+ end
49
49
 
50
- s.add_development_dependency 'bundler'
51
- s.add_development_dependency 'byebug' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
52
- s.add_development_dependency 'pry'
53
- s.add_development_dependency 'rake', '~> 13'
54
- s.add_development_dependency 'require-prof' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
55
- s.add_development_dependency 'rspec'
56
- s.add_development_dependency 'ruby-prof' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
57
- s.add_development_dependency 'simplecov'
58
- s.add_development_dependency 'yard'
59
- s.add_development_dependency 'timecop'
50
+ s.required_ruby_version = '>= 2.4'
60
51
 
61
- s.description = <<-DESC.gsub(/^ /, '')
62
- Ruby AWS Sigv4 Client for OpenSearch
63
- DESC
52
+ s.add_dependency 'aws-sigv4', '>= 1'
53
+ s.add_dependency 'opensearch-ruby', '>= 1.0.1'
64
54
  end
@@ -7,7 +7,9 @@
7
7
  # Modifications Copyright OpenSearch Contributors. See
8
8
  # GitHub history for details.
9
9
 
10
- require_relative '../spec_helper'
10
+ # frozen_string_literal: true
11
+
12
+ require_relative '../../../spec_helper'
11
13
  require 'aws-sigv4'
12
14
  require 'timecop'
13
15
 
@@ -16,7 +18,8 @@ describe OpenSearch::Aws::Sigv4Client do
16
18
  described_class.new(
17
19
  { host: 'http://localhost:9200',
18
20
  transport_options: { ssl: { verify: false } } },
19
- signer)
21
+ signer
22
+ )
20
23
  end
21
24
 
22
25
  let(:signer) do
@@ -37,7 +40,7 @@ describe OpenSearch::Aws::Sigv4Client do
37
40
 
38
41
  context 'when a Sigv4 Signer is provided' do
39
42
  it 'does NOT raise any error' do
40
- expect { client }.to_not raise_error
43
+ expect { client }.not_to raise_error
41
44
  end
42
45
  end
43
46
  end
@@ -45,25 +48,25 @@ describe OpenSearch::Aws::Sigv4Client do
45
48
  describe '#perform_request' do
46
49
  let(:response) { { body: 'Response Body' } }
47
50
  let(:transport_double) do
48
- _double = instance_double('OpenSearch::Transport::Client', perform_request: response)
49
- _double.stub_chain(:transport, :hosts, :dig).and_return('localhost')
50
- _double
51
+ double = instance_double(OpenSearch::Transport::Client, perform_request: response)
52
+ allow(double).to receive_message_chain(:transport, :hosts, :dig).and_return('localhost')
53
+ double
51
54
  end
52
55
  let(:signed_headers) do
53
56
  { 'authorization' => 'AWS4-HMAC-SHA256 Credential=key_id/20220101/us-west-2/es/aws4_request, '\
54
- 'SignedHeaders=host;x-amz-content-sha256;x-amz-date, ' \
55
- 'Signature=9c4c690110483308f62a91c2ca873857750bca2607ba1aabdae0d2303950310a',
57
+ 'SignedHeaders=host;x-amz-content-sha256;x-amz-date, ' \
58
+ 'Signature=9c4c690110483308f62a91c2ca873857750bca2607ba1aabdae0d2303950310a',
56
59
  'host' => 'localhost',
57
60
  'x-amz-content-sha256' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
58
61
  'x-amz-date' => '20220101T000000Z' }
59
62
  end
60
63
 
61
- before(:each) do
64
+ before do
62
65
  Timecop.freeze(Time.utc(2022))
63
66
  client.transport = transport_double
64
67
  end
65
68
 
66
- after(:each) { Timecop.return }
69
+ after { Timecop.return }
67
70
 
68
71
  it 'signs the request before passing it to @transport' do
69
72
  output = client.perform_request('GET', '/', {}, '', {})
@@ -72,8 +75,27 @@ describe OpenSearch::Aws::Sigv4Client do
72
75
  end
73
76
 
74
77
  it 'skips the opensearch verification' do
75
- expect(client).to_not receive(:open_search_validation_request)
78
+ allow(client).to receive(:open_search_validation_request)
76
79
  client.perform_request('GET', '/_stats', {}, '', {})
80
+ expect(client).not_to have_received(:open_search_validation_request)
81
+ end
82
+
83
+ it 'passes the same body to sign_request and super' do
84
+ body = {
85
+ char_filter: {
86
+ test: {
87
+ type: 'mapping',
88
+ mappings: ["’ => '"]
89
+ }
90
+ }
91
+ }
92
+ signature_body = body.to_json
93
+
94
+ allow(signer).to receive(:sign_request).with(a_hash_including(body: signature_body)).and_call_original
95
+
96
+ client.perform_request('GET', '/', {}, body, {})
97
+
98
+ expect(transport_double).to have_received(:perform_request).with('GET', '/', {}, signature_body, kind_of(Hash))
77
99
  end
78
100
  end
79
101
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,19 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opensearch-aws-sigv4
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
- - Theo Truong
8
- - Robin Roestenburg
7
+ - OpenSearch Contributors
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain:
12
11
  - |
13
12
  -----BEGIN CERTIFICATE-----
14
- MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRMwEQYDVQQDDApvcGVu
13
+ MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQsFADBCMRMwEQYDVQQDDApvcGVu
15
14
  c2VhcmNoMRYwFAYKCZImiZPyLGQBGRYGYW1hem9uMRMwEQYKCZImiZPyLGQBGRYD
16
- Y29tMB4XDTIyMDgxNzE3NTIzNFoXDTIzMDgxNzE3NTIzNFowQjETMBEGA1UEAwwK
15
+ Y29tMB4XDTIzMDgyNDIwNDIwNFoXDTI0MDgyMzIwNDIwNFowQjETMBEGA1UEAwwK
17
16
  b3BlbnNlYXJjaDEWMBQGCgmSJomT8ixkARkWBmFtYXpvbjETMBEGCgmSJomT8ixk
18
17
  ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM1z3/jcitjV
19
18
  umXwRFn+JSBBd36qZB54Dtucf6+E2fmNPzBRhgYN5XJy/+clQJ9NIJV7C8H52P3V
@@ -24,27 +23,27 @@ cert_chain:
24
23
  zfR37/NQFkECAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
25
24
  BBYEFJJ2myhLXK742btavNbG0IWrMNBIMCAGA1UdEQQZMBeBFW9wZW5zZWFyY2hA
26
25
  YW1hem9uLmNvbTAgBgNVHRIEGTAXgRVvcGVuc2VhcmNoQGFtYXpvbi5jb20wDQYJ
27
- KoZIhvcNAQEFBQADggEBAH5pWLYwKWFh1OjdCReGz/VEAiF4jXXputoN5Z8ga+1Z
28
- lg8/diJf0PlP2B46PdmxH/TVc/o+qglNO2cHVEp8xZfEd83dfioOBeK90URQUpC5
29
- UZmO0LZusg46SQKwKa2ukpIy2fNi3PeHRiV+W2Zv69GoWppyLun+fMez7wVoah2r
30
- r5ROUYuAvFUvga1Vm+49pKiPM5n+MAYP5t/vWhgymY3SYQ1TfewkvKAFiFXikOR+
31
- r+j7FLyKuk5DzIxiCp8QN5dU71BbGUmsHf/C5UV76WLPOFX/szeaHhPwpjR3sK7r
32
- 5zLgCV1KP7cgDdCYMlmZGeSViU8NV+Yy8/ghrzGpqVw=
26
+ KoZIhvcNAQELBQADggEBABAQpnELuY5AgdNUIlIVRVATO6iZOXTbt3a9oVbQdLPe
27
+ BfMObZyJydg0+leyR3oFyN9ZIFiEFwpd0biFf39DuC0M6Oge0Rv4oO9GRI3yyv77
28
+ 9m59he+5DI3hbqtGje108oqRe61NZMlKcy/DCBVkzzZFsJ17GC09tY/gwhmNRtLV
29
+ 3vYIEY6vmn57wrGn1NUzWdG+x/XVjYPw5Kwo+/rCxxZqpVTklMqVWV43N/lFrUOe
30
+ 1DlemA1SsUBIoF7CwtVd/RTG/K1iT6nBD08fdKxodMhI5ujkP3N7gkxzRf6aKN4z
31
+ glnDJYZjluKBUsKTOLdPW1CZpb0AHLpNqDf8SVHsPFk=
33
32
  -----END CERTIFICATE-----
34
- date: 2023-02-28 00:00:00.000000000 Z
33
+ date: 2023-10-03 00:00:00.000000000 Z
35
34
  dependencies:
36
35
  - !ruby/object:Gem::Dependency
37
36
  name: aws-sigv4
38
37
  requirement: !ruby/object:Gem::Requirement
39
38
  requirements:
40
- - - "~>"
39
+ - - ">="
41
40
  - !ruby/object:Gem::Version
42
41
  version: '1'
43
42
  type: :runtime
44
43
  prerelease: false
45
44
  version_requirements: !ruby/object:Gem::Requirement
46
45
  requirements:
47
- - - "~>"
46
+ - - ">="
48
47
  - !ruby/object:Gem::Version
49
48
  version: '1'
50
49
  - !ruby/object:Gem::Dependency
@@ -61,180 +60,37 @@ dependencies:
61
60
  - - ">="
62
61
  - !ruby/object:Gem::Version
63
62
  version: 1.0.1
64
- - !ruby/object:Gem::Dependency
65
- name: bundler
66
- requirement: !ruby/object:Gem::Requirement
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: '0'
71
- type: :development
72
- prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: byebug
80
- requirement: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- version: '0'
85
- type: :development
86
- prerelease: false
87
- version_requirements: !ruby/object:Gem::Requirement
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- version: '0'
92
- - !ruby/object:Gem::Dependency
93
- name: pry
94
- requirement: !ruby/object:Gem::Requirement
95
- requirements:
96
- - - ">="
97
- - !ruby/object:Gem::Version
98
- version: '0'
99
- type: :development
100
- prerelease: false
101
- version_requirements: !ruby/object:Gem::Requirement
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- version: '0'
106
- - !ruby/object:Gem::Dependency
107
- name: rake
108
- requirement: !ruby/object:Gem::Requirement
109
- requirements:
110
- - - "~>"
111
- - !ruby/object:Gem::Version
112
- version: '13'
113
- type: :development
114
- prerelease: false
115
- version_requirements: !ruby/object:Gem::Requirement
116
- requirements:
117
- - - "~>"
118
- - !ruby/object:Gem::Version
119
- version: '13'
120
- - !ruby/object:Gem::Dependency
121
- name: require-prof
122
- requirement: !ruby/object:Gem::Requirement
123
- requirements:
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- version: '0'
127
- type: :development
128
- prerelease: false
129
- version_requirements: !ruby/object:Gem::Requirement
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- version: '0'
134
- - !ruby/object:Gem::Dependency
135
- name: rspec
136
- requirement: !ruby/object:Gem::Requirement
137
- requirements:
138
- - - ">="
139
- - !ruby/object:Gem::Version
140
- version: '0'
141
- type: :development
142
- prerelease: false
143
- version_requirements: !ruby/object:Gem::Requirement
144
- requirements:
145
- - - ">="
146
- - !ruby/object:Gem::Version
147
- version: '0'
148
- - !ruby/object:Gem::Dependency
149
- name: ruby-prof
150
- requirement: !ruby/object:Gem::Requirement
151
- requirements:
152
- - - ">="
153
- - !ruby/object:Gem::Version
154
- version: '0'
155
- type: :development
156
- prerelease: false
157
- version_requirements: !ruby/object:Gem::Requirement
158
- requirements:
159
- - - ">="
160
- - !ruby/object:Gem::Version
161
- version: '0'
162
- - !ruby/object:Gem::Dependency
163
- name: simplecov
164
- requirement: !ruby/object:Gem::Requirement
165
- requirements:
166
- - - ">="
167
- - !ruby/object:Gem::Version
168
- version: '0'
169
- type: :development
170
- prerelease: false
171
- version_requirements: !ruby/object:Gem::Requirement
172
- requirements:
173
- - - ">="
174
- - !ruby/object:Gem::Version
175
- version: '0'
176
- - !ruby/object:Gem::Dependency
177
- name: yard
178
- requirement: !ruby/object:Gem::Requirement
179
- requirements:
180
- - - ">="
181
- - !ruby/object:Gem::Version
182
- version: '0'
183
- type: :development
184
- prerelease: false
185
- version_requirements: !ruby/object:Gem::Requirement
186
- requirements:
187
- - - ">="
188
- - !ruby/object:Gem::Version
189
- version: '0'
190
- - !ruby/object:Gem::Dependency
191
- name: timecop
192
- requirement: !ruby/object:Gem::Requirement
193
- requirements:
194
- - - ">="
195
- - !ruby/object:Gem::Version
196
- version: '0'
197
- type: :development
198
- prerelease: false
199
- version_requirements: !ruby/object:Gem::Requirement
200
- requirements:
201
- - - ">="
202
- - !ruby/object:Gem::Version
203
- version: '0'
204
- description: 'Ruby AWS Sigv4 Client for OpenSearch
205
-
206
- '
207
- email:
208
- - theo.nam.truong@gmail.com
209
- - robin.roestenburg@4me.com
63
+ description: |
64
+ A wrapper for opensearch-ruby gem that provides AWS Sigv4 signing.
65
+ It behaves like OpenSearch::Client, but signs every request with AWS Sigv4
66
+ using the credentials provided during the client's initialization.
67
+ email: opensearch@amazon.com
210
68
  executables:
211
69
  - opensearch_sigv4_console
212
70
  extensions: []
213
71
  extra_rdoc_files:
214
72
  - README.md
73
+ - USER_GUIDE.md
215
74
  - LICENSE
216
75
  files:
217
- - ".gitignore"
218
- - CHANGELOG.md
219
- - Gemfile
220
76
  - LICENSE
221
77
  - README.md
222
- - Rakefile
223
78
  - USER_GUIDE.md
224
79
  - bin/opensearch_sigv4_console
225
80
  - lib/opensearch-aws-sigv4.rb
226
81
  - lib/opensearch-aws-sigv4/version.rb
82
+ - lib/opensearch_aws_sigv4.rb
227
83
  - opensearch-aws-sigv4.gemspec
228
- - spec/integration/sigv4_client_integration_spec.rb
229
- - spec/spec_helper.rb
230
- - spec/unit/sigv4_client_spec.rb
231
- homepage: https://opensearch.org/docs/latest
84
+ - spec/unit/open_search/aws/sigv4_client_spec.rb
85
+ homepage: https://github.com/opensearch-project/opensearch-ruby-aws-sigv4
232
86
  licenses:
233
87
  - Apache-2.0
234
88
  metadata:
235
- homepage_uri: https://opensearch.org/docs/latest/
236
- source_code_uri: https://github.com/opensearch-project/opensearch-ruby/tree/main
237
- bug_tracker_uri: https://github.com/opensearch-project/opensearch-ruby/issues
89
+ homepage_uri: https://github.com/opensearch-project/opensearch-ruby-aws-sigv4
90
+ documentation_uri: https://rubydoc.info/gems/opensearch-aws-sigv4/OpenSearch/Aws/Sigv4Client
91
+ source_code_uri: https://github.com/opensearch-project/opensearch-ruby-aws-sigv4/tree/main
92
+ bug_tracker_uri: https://github.com/opensearch-project/opensearch-ruby-aws-sigv4/issues
93
+ changelog_uri: https://github.com/opensearch-project/opensearch-ruby-aws-sigv4/blob/main/CHANGELOG.md
238
94
  post_install_message:
239
95
  rdoc_options:
240
96
  - "--charset=UTF-8"
@@ -244,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
244
100
  requirements:
245
101
  - - ">="
246
102
  - !ruby/object:Gem::Version
247
- version: '2.5'
103
+ version: '2.4'
248
104
  required_rubygems_version: !ruby/object:Gem::Requirement
249
105
  requirements:
250
106
  - - ">="
@@ -256,6 +112,4 @@ signing_key:
256
112
  specification_version: 4
257
113
  summary: Ruby AWS Sigv4 Client for OpenSearch
258
114
  test_files:
259
- - spec/integration/sigv4_client_integration_spec.rb
260
- - spec/spec_helper.rb
261
- - spec/unit/sigv4_client_spec.rb
115
+ - spec/unit/open_search/aws/sigv4_client_spec.rb
metadata.gz.sig CHANGED
Binary file
data/CHANGELOG.md DELETED
@@ -1,24 +0,0 @@
1
- # CHANGELOG
2
- Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
3
-
4
- ## [Unreleased]
5
- ### Added
6
- - Ability to printout Sigv4 Signature for debugging ([#149](https://github.com/opensearch-project/opensearch-ruby/issues/149))
7
- ### Changed
8
- ### Deprecated
9
- ### Removed
10
- ### Fixed
11
-
12
- ### Security
13
-
14
- ## [1.1.0]
15
- ### Added
16
- - Added support for Amazon OpenSearch Serverless ([#131](https://github.com/opensearch-project/opensearch-ruby/issues/131))
17
- ### Fixed
18
- - Sign validation requests when using AWS Sigv4 ([#134](https://github.com/opensearch-project/opensearch-ruby/pull/134))
19
-
20
- ### Security
21
-
22
- ## 1.0.0
23
- ### Added
24
- - Added `OpenSearch::AWS::Sigv4Client` ([#110](https://github.com/opensearch-project/opensearch-ruby/pull/110))
data/Gemfile DELETED
@@ -1,25 +0,0 @@
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
- source 'https://rubygems.org'
11
-
12
- # Specify your gem's dependencies in opensearch-aws-sigv4.gemspec
13
- gemspec
14
-
15
- if File.exist? File.expand_path("../../opensearch-api/opensearch-api.gemspec", __FILE__)
16
- gem 'opensearch-api', :path => File.expand_path("../../opensearch-api", __FILE__), :require => false
17
- end
18
-
19
- if File.exist? File.expand_path("../../opensearch-transport/opensearch-transport.gemspec", __FILE__)
20
- gem 'opensearch-transport', :path => File.expand_path("../../opensearch-transport", __FILE__), :require => false
21
- end
22
-
23
- if File.exist? File.expand_path("../../opensearch-ruby/opensearch-ruby.gemspec", __FILE__)
24
- gem 'opensearch-ruby', :path => File.expand_path("../../opensearch-ruby", __FILE__), :require => false
25
- end
data/Rakefile DELETED
@@ -1,41 +0,0 @@
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
- require 'bundler/gem_tasks'
11
-
12
- task(:default) { system 'rake --tasks' }
13
-
14
- desc 'Run unit tests'
15
- task test: 'test:spec'
16
-
17
- # ----- Test tasks ------------------------------------------------------------
18
- require 'rspec/core/rake_task'
19
-
20
- namespace :test do
21
- RSpec::Core::RakeTask.new(:integration) do |t|
22
- t.pattern = 'spec/integration/**{,/*/**}/*_spec.rb'
23
- end
24
-
25
- RSpec::Core::RakeTask.new(:unit) do |t|
26
- t.pattern = 'spec/unit/**{,/*/**}/*_spec.rb'
27
- end
28
-
29
- desc 'Run unit and integration tests'
30
- task :all do
31
- Rake::Task['test:unit'].invoke
32
- Rake::Task['test:integration'].invoke
33
- end
34
- end
35
-
36
- # ----- Documentation tasks ---------------------------------------------------
37
-
38
- require 'yard'
39
- YARD::Rake::YardocTask.new(:doc) do |t|
40
- t.options = %w| --embed-mixins --markup=markdown |
41
- end
@@ -1,42 +0,0 @@
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
- require_relative '../spec_helper'
11
- require 'logger'
12
- require 'aws-sigv4'
13
-
14
- describe OpenSearch::Aws::Sigv4Client do
15
- let(:client) do
16
- signer = Aws::Sigv4::Signer.new(service: 'es',
17
- region: 'us-west-2',
18
- access_key_id: 'key_id',
19
- secret_access_key: 'secret')
20
-
21
- OpenSearch::Aws::Sigv4Client.new({ host: OPENSEARCH_URL, logger: Logger.new($stdout) }, signer)
22
- end
23
-
24
- it 'performs API actions without throwing any errors' 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
data/spec/spec_helper.rb DELETED
@@ -1,18 +0,0 @@
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
- require 'opensearch-aws-sigv4'
11
- require 'rspec'
12
-
13
- OPENSEARCH_URL = ENV['TEST_OPENSEARCH_SERVER'] || "http://localhost:#{(ENV['PORT'] || 9200)}"
14
- raise URI::InvalidURIError unless OPENSEARCH_URL =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
15
-
16
- RSpec.configure do |config|
17
- config.formatter = :documentation
18
- end