oso-cloud 1.7.0 → 1.7.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: 747cf1fda61eae9e9a96076e782a503e3c440a3aa7049a6b8f74ce8d0c697273
4
- data.tar.gz: 5a3fcbb8574c21416fa81dbf8e1054dfef59337da6c72ff686c06304b3c27711
3
+ metadata.gz: 78d81ade4fd246a2398c1a0224ecc8a6ff3852b968e03c0c79c1d28295358cfd
4
+ data.tar.gz: cdfa7bb5f957f1aaf7d801d8b5bca4e3e2dc4b1df8044d9cc30114aae5d012fe
5
5
  SHA512:
6
- metadata.gz: 1f0a4732c2f76b499f1dc962a0ee806fd6d2c17abdb734d2a1ce448c35eff4781dafce6aec90f39ede78e06fac44bcdbbb11033949867d562007c3f15a3fcee7
7
- data.tar.gz: 41b95a2e852e431e1e1598277abeaad8b76bb174ea562d52a6e9c1d9c644f12a5799e1cde75063bf1d6757eb4cd62be0463c369192f8644353bb791a69391e43
6
+ metadata.gz: dc3fa7da1c706b47ffe89e6d9ed03ed9950cb8c756051ef2cc3e7ed81e2931f34dbdad8e6c8e217f9d061a4c9a2d5ad36784acdbba0772a3d16102bc43d8e09f
7
+ data.tar.gz: e48be352ec530bfb99afe81723abbfca673a9c63d295388d68f34bebf97b973a8c911d68133cc11668622cef26553cb92e5336346b1410d081bd1dac41c9c881
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oso-cloud (1.7.0)
4
+ oso-cloud (1.7.1)
5
5
  faraday (~> 2.5.2)
6
6
  faraday-net_http_persistent (~> 2.0)
7
7
  faraday-retry (~> 2.0.0)
data/lib/oso/api.rb CHANGED
@@ -3,6 +3,7 @@ require 'uri'
3
3
  require 'faraday'
4
4
  require 'faraday/retry'
5
5
  require 'faraday/net_http_persistent'
6
+ require 'securerandom'
6
7
 
7
8
  require 'oso/helpers'
8
9
  require 'oso/version'
@@ -332,6 +333,7 @@ module OsoCloud
332
333
  @user_agent = "Oso Cloud (ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}; rv:#{VERSION})"
333
334
  @last_offset = nil
334
335
  @data_bindings = IO.read(data_bindings) unless data_bindings.nil?
336
+ @client_id = SecureRandom.uuid
335
337
  end
336
338
 
337
339
  def fallback_eligible(path)
@@ -484,6 +486,8 @@ module OsoCloud
484
486
  Accept: 'application/json',
485
487
  'Content-Type': 'application/json',
486
488
  'X-OsoApiVersion': '0',
489
+ 'X-Request-ID' => SecureRandom.uuid,
490
+ 'X-Oso-Instance-Id' => @client_id
487
491
  }
488
492
  # set OsoOffset is last_offset is not nil
489
493
  default_headers[:OsoOffset] = @last_offset unless @last_offset.nil?
@@ -549,12 +553,18 @@ module OsoCloud
549
553
 
550
554
  def handle_faraday_error(error)
551
555
  resp = error.response
556
+ formatted_request_id = if resp.nil? || resp[:headers].nil? || resp[:headers]['X-Request-ID'].nil?
557
+ ""
558
+ else
559
+ " (Request ID: " + resp[:headers]['X-Request-ID'] + ")"
560
+ end
561
+
552
562
  err = if resp.nil? || resp[:body].nil? || resp[:body][:message].nil?
553
563
  error.message
554
564
  else
555
565
  resp[:body][:message]
556
566
  end
557
- raise ApiError.new(message: err)
567
+ raise ApiError.new(message: err + formatted_request_id)
558
568
  end
559
569
  end
560
570
  end
data/lib/oso/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module OsoCloud
2
- VERSION = '1.7.0'.freeze
2
+ VERSION = '1.7.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oso-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oso Security, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-24 00:00:00.000000000 Z
11
+ date: 2024-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday