strongdm 2.0.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.git/ORIG_HEAD +1 -1
- data/.git/index +0 -0
- data/.git/logs/HEAD +3 -3
- data/.git/logs/refs/heads/master +2 -2
- data/.git/logs/refs/remotes/origin/HEAD +1 -1
- data/.git/objects/pack/{pack-799dc839a811c2fbe50b5281a9266fcc3a8f5154.idx → pack-c180677ba60e518124a696667c7cc0c268db3b1a.idx} +0 -0
- data/.git/objects/pack/{pack-799dc839a811c2fbe50b5281a9266fcc3a8f5154.pack → pack-c180677ba60e518124a696667c7cc0c268db3b1a.pack} +0 -0
- data/.git/packed-refs +5 -2
- data/.git/refs/heads/master +1 -1
- data/lib/grpc/account_attachments_services_pb.rb +5 -5
- data/lib/grpc/account_grants_services_pb.rb +5 -5
- data/lib/grpc/accounts_services_pb.rb +6 -6
- data/lib/grpc/control_panel_services_pb.rb +3 -3
- data/lib/grpc/drivers_pb.rb +94 -0
- data/lib/grpc/nodes_services_pb.rb +6 -6
- data/lib/grpc/plumbing.rb +218 -0
- data/lib/grpc/resources_services_pb.rb +7 -7
- data/lib/grpc/role_attachments_services_pb.rb +5 -5
- data/lib/grpc/role_grants_services_pb.rb +5 -5
- data/lib/grpc/roles_services_pb.rb +6 -6
- data/lib/grpc/secret_stores_services_pb.rb +6 -6
- data/lib/models/porcelain.rb +403 -0
- data/lib/strongdm.rb +15 -2
- data/lib/svc.rb +1 -0
- data/lib/version +1 -1
- data/lib/version.rb +1 -1
- metadata +4 -4
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.
|
31
|
+
USER_AGENT = "strongdm-sdk-ruby/2.5.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/svc.rb
CHANGED
data/lib/version
CHANGED
data/lib/version.rb
CHANGED
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.
|
4
|
+
version: 2.5.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-03
|
11
|
+
date: 2022-06-03 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-
|
83
|
-
- "./.git/objects/pack/pack-
|
82
|
+
- "./.git/objects/pack/pack-c180677ba60e518124a696667c7cc0c268db3b1a.idx"
|
83
|
+
- "./.git/objects/pack/pack-c180677ba60e518124a696667c7cc0c268db3b1a.pack"
|
84
84
|
- "./.git/packed-refs"
|
85
85
|
- "./.git/refs/heads/master"
|
86
86
|
- "./.git/refs/remotes/origin/HEAD"
|