strongdm 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 513889a71f5229ea623c7e6700bad921d2fa66ea7677040c9c007b9a971be94a
4
- data.tar.gz: 01b66d9bb0699d690e39b80980c73add3fd5a58ee9d799e3d6b5b2e02d2820c0
3
+ metadata.gz: 1b6e8f6265ce3592ff88385cb196161bdd2f54169e3145c59136c7b8e96a726e
4
+ data.tar.gz: 7895128b0ddc5a7fa52cce02d398fb5566a5139c706745b49b337a766d13ab07
5
5
  SHA512:
6
- metadata.gz: e40159083a623c69f8b9f14294a38d437e97128cb5a5a1cc49a83b832204265d94be0fe60ee18bf143cc03e0c18d6b04bb4981e2eccb152816daf462b8a8233f
7
- data.tar.gz: 247079fcb881f598acb01015d94bd7bdc36a31dfd98e8776ef455cd649e5eff77f2f1802905c2813a532e6fc2089dd722744c861817a756a488bdcb0b2a18eea
6
+ metadata.gz: eef164f34da7ead4c9fd4586810029ddcb487e24d799bd5738b495cf8702108838b1d3cf07974ce0515636afc0bb4b888e6f50dbc13abac0c568dafce46fb162
7
+ data.tar.gz: 245a3d329f792fbda7cc98713d3ff2ba4c054fc8ad563c64f8c4e033211db8db43abb2696800da1ee65ad09a0fbefdf1f6a653c1a8d2045b9619435bfd0ff69b
data/.git/ORIG_HEAD CHANGED
@@ -1 +1 @@
1
- e0b1ec0134c7015ccb8c14464cc713c20034159e
1
+ 62a146d9d56852b2ad14ec5d2796cad158d66e1c
data/.git/index CHANGED
Binary file
data/.git/logs/HEAD CHANGED
@@ -1,3 +1,3 @@
1
- 0000000000000000000000000000000000000000 e0b1ec0134c7015ccb8c14464cc713c20034159e sdmrelease <support@strongdm.com> 1650659439 +0000 clone: from git@github.com:strongdm/strongdm-sdk-ruby.git
2
- e0b1ec0134c7015ccb8c14464cc713c20034159e e0b1ec0134c7015ccb8c14464cc713c20034159e sdmrelease <support@strongdm.com> 1650659439 +0000 checkout: moving from master to master
3
- e0b1ec0134c7015ccb8c14464cc713c20034159e 62a146d9d56852b2ad14ec5d2796cad158d66e1c sdmrelease <support@strongdm.com> 1650659439 +0000 merge origin/development: Fast-forward
1
+ 0000000000000000000000000000000000000000 62a146d9d56852b2ad14ec5d2796cad158d66e1c sdmrelease <support@strongdm.com> 1652276439 +0000 clone: from git@github.com:strongdm/strongdm-sdk-ruby.git
2
+ 62a146d9d56852b2ad14ec5d2796cad158d66e1c 62a146d9d56852b2ad14ec5d2796cad158d66e1c sdmrelease <support@strongdm.com> 1652276439 +0000 checkout: moving from master to master
3
+ 62a146d9d56852b2ad14ec5d2796cad158d66e1c 9de04e628082f4ad0eb9511311479a089d302008 sdmrelease <support@strongdm.com> 1652276439 +0000 merge origin/development: Fast-forward
@@ -1,2 +1,2 @@
1
- 0000000000000000000000000000000000000000 e0b1ec0134c7015ccb8c14464cc713c20034159e sdmrelease <support@strongdm.com> 1650659439 +0000 clone: from git@github.com:strongdm/strongdm-sdk-ruby.git
2
- e0b1ec0134c7015ccb8c14464cc713c20034159e 62a146d9d56852b2ad14ec5d2796cad158d66e1c sdmrelease <support@strongdm.com> 1650659439 +0000 merge origin/development: Fast-forward
1
+ 0000000000000000000000000000000000000000 62a146d9d56852b2ad14ec5d2796cad158d66e1c sdmrelease <support@strongdm.com> 1652276439 +0000 clone: from git@github.com:strongdm/strongdm-sdk-ruby.git
2
+ 62a146d9d56852b2ad14ec5d2796cad158d66e1c 9de04e628082f4ad0eb9511311479a089d302008 sdmrelease <support@strongdm.com> 1652276439 +0000 merge origin/development: Fast-forward
@@ -1 +1 @@
1
- 0000000000000000000000000000000000000000 e0b1ec0134c7015ccb8c14464cc713c20034159e sdmrelease <support@strongdm.com> 1650659439 +0000 clone: from git@github.com:strongdm/strongdm-sdk-ruby.git
1
+ 0000000000000000000000000000000000000000 62a146d9d56852b2ad14ec5d2796cad158d66e1c sdmrelease <support@strongdm.com> 1652276439 +0000 clone: from git@github.com:strongdm/strongdm-sdk-ruby.git
data/.git/packed-refs CHANGED
@@ -1,6 +1,6 @@
1
1
  # pack-refs with: peeled fully-peeled sorted
2
- 62a146d9d56852b2ad14ec5d2796cad158d66e1c refs/remotes/origin/development
3
- e0b1ec0134c7015ccb8c14464cc713c20034159e refs/remotes/origin/master
2
+ 9de04e628082f4ad0eb9511311479a089d302008 refs/remotes/origin/development
3
+ 62a146d9d56852b2ad14ec5d2796cad158d66e1c refs/remotes/origin/master
4
4
  2e4fe8087177ddea9b3991ca499f758384839c89 refs/tags/untagged-84fd83a4484c785cce63
5
5
  04f604866214fab4d5663b5171a3e596331577bd refs/tags/v0.9.4
6
6
  6f9a7b75b345c65fb554884907b7060680c807b7 refs/tags/v0.9.5
@@ -34,3 +34,4 @@ f05d3be5bc992d5a37ba13bc4ce092056769d9c8 refs/tags/v1.0.4
34
34
  d035aa3acb4c3a0935121bc00bfbb0a9e999d410 refs/tags/v1.0.7
35
35
  5b01475679f3312831a0fa1009e7cf90889effa8 refs/tags/v1.0.8
36
36
  e0b1ec0134c7015ccb8c14464cc713c20034159e refs/tags/v2.0.0
37
+ 62a146d9d56852b2ad14ec5d2796cad158d66e1c refs/tags/v2.1.0
@@ -1 +1 @@
1
- 62a146d9d56852b2ad14ec5d2796cad158d66e1c
1
+ 9de04e628082f4ad0eb9511311479a089d302008
data/lib/strongdm.rb CHANGED
@@ -18,6 +18,7 @@
18
18
  require_relative "./svc"
19
19
  require "base64"
20
20
  require "openssl"
21
+ require "time"
21
22
 
22
23
  module SDM #:nodoc:
23
24
 
@@ -27,11 +28,11 @@ module SDM #:nodoc:
27
28
  DEFAULT_BASE_RETRY_DELAY = 0.0030 # 30 ms
28
29
  DEFAULT_MAX_RETRY_DELAY = 300 # 300 seconds
29
30
  API_VERSION = "2021-08-23"
30
- USER_AGENT = "strongdm-sdk-ruby/2.1.0"
31
+ USER_AGENT = "strongdm-sdk-ruby/2.2.0"
31
32
  private_constant :DEFAULT_MAX_RETRIES, :DEFAULT_BASE_RETRY_DELAY, :DEFAULT_MAX_RETRY_DELAY, :API_VERSION, :USER_AGENT
32
33
 
33
34
  # Creates a new strongDM API client.
34
- def initialize(api_access_key, api_secret_key, host: "api.strongdm.com:443", insecure: false)
35
+ def initialize(api_access_key, api_secret_key, host: "api.strongdm.com:443", insecure: false, retry_rate_limit_errors: true)
35
36
  raise TypeError, "client access key must be a string" unless api_access_key.kind_of?(String)
36
37
  raise TypeError, "client secret key must be a string" unless api_secret_key.kind_of?(String)
37
38
  raise TypeError, "client host must be a string" unless host.kind_of?(String)
@@ -40,6 +41,7 @@ module SDM #:nodoc:
40
41
  @max_retries = DEFAULT_MAX_RETRIES
41
42
  @base_retry_delay = DEFAULT_BASE_RETRY_DELAY
42
43
  @max_retry_delay = DEFAULT_MAX_RETRY_DELAY
44
+ @expose_rate_limit_errors = (not retry_rate_limit_errors)
43
45
  @account_attachments = AccountAttachments.new(host, insecure, self)
44
46
  @account_grants = AccountGrants.new(host, insecure, self)
45
47
  @accounts = Accounts.new(host, insecure, self)
@@ -94,6 +96,17 @@ module SDM #:nodoc:
94
96
  if not err.is_a? GRPC::BadStatus
95
97
  return true
96
98
  end
99
+ porcelainErr = Plumbing::convert_error_to_porcelain(err)
100
+ if (not @expose_rate_limit_errors) and (porcelainErr.is_a? RateLimitError)
101
+ sleep_for = porcelainErr.rate_limit.reset_at - Time.now
102
+ # If timezones or clock drift causes this calculation to fail,
103
+ # wait at most one minute.
104
+ if sleep_for < 0 or sleep_for > 60
105
+ sleep_for = 60
106
+ end
107
+ sleep(sleep_for)
108
+ return true
109
+ end
97
110
  return err.code() == 13
98
111
  end
99
112
 
data/lib/version CHANGED
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
  #
15
15
  module SDM
16
- VERSION = "2.1.0"
16
+ VERSION = "2.2.0"
17
17
  end
data/lib/version.rb CHANGED
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
  #
15
15
  module SDM
16
- VERSION = "2.1.0"
16
+ VERSION = "2.2.0"
17
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongdm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - strongDM Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-22 00:00:00.000000000 Z
11
+ date: 2022-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grpc
@@ -79,8 +79,8 @@ files:
79
79
  - "./.git/logs/HEAD"
80
80
  - "./.git/logs/refs/heads/master"
81
81
  - "./.git/logs/refs/remotes/origin/HEAD"
82
- - "./.git/objects/pack/pack-a86846bb97666919e629e876c52e6b012d588625.idx"
83
- - "./.git/objects/pack/pack-a86846bb97666919e629e876c52e6b012d588625.pack"
82
+ - "./.git/objects/pack/pack-ae9c31d15ecb69c51d515e053295673b38840788.idx"
83
+ - "./.git/objects/pack/pack-ae9c31d15ecb69c51d515e053295673b38840788.pack"
84
84
  - "./.git/packed-refs"
85
85
  - "./.git/refs/heads/master"
86
86
  - "./.git/refs/remotes/origin/HEAD"