ibm_cloud_sdk_core 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ibm_cloud_sdk_core/base_service.rb +27 -26
- data/lib/ibm_cloud_sdk_core/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c6d79aace47898352195c90bf0370d3aa0701d119ad3ee36ee824942923cea5
|
4
|
+
data.tar.gz: b1f487702b107da90008af40bc2340907e605896dbc5e4e685c2d9dba57be5d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 436285acaf7458850cd949be3d72bce3ba3665909ce2149a4de7b2ac96aac93ee867f56620256fe39db56d81e83eba8bb76f7c0411d8378e7a83c960b70335b0
|
7
|
+
data.tar.gz: 109f48faa8e6e3f47a0450dc171d3f766a0477d25a92863fe4dffa4daed807ed2da643732b446ea874369a13932b46e7c40e6ead718858c25d8ab346838b43c3
|
@@ -45,37 +45,13 @@ module IBMCloudSdkCore
|
|
45
45
|
@icp4d_url = vars[:icp4d_url]
|
46
46
|
@iam_url = vars[:iam_url]
|
47
47
|
@iam_apikey = vars[:iam_apikey]
|
48
|
+
@iam_access_token = vars[:iam_access_token]
|
48
49
|
@token_manager = nil
|
49
50
|
@authentication_type = vars[:authentication_type].downcase unless vars[:authentication_type].nil?
|
50
51
|
@temp_headers = nil
|
51
52
|
@disable_ssl_verification = false
|
52
53
|
@display_name = vars[:display_name]
|
53
54
|
|
54
|
-
if @authentication_type == "iam" || ((!vars[:iam_access_token].nil? || !vars[:iam_apikey].nil?) && !@icp_prefix)
|
55
|
-
iam_token_manager(iam_apikey: vars[:iam_apikey], iam_access_token: vars[:iam_access_token],
|
56
|
-
iam_url: vars[:iam_url], iam_client_id: vars[:iam_client_id],
|
57
|
-
iam_client_secret: vars[:iam_client_secret])
|
58
|
-
elsif !vars[:iam_apikey].nil? && @icp_prefix
|
59
|
-
@username = "apikey"
|
60
|
-
@password = vars[:iam_apikey]
|
61
|
-
elsif @authentication_type == "icp4d" || !vars[:icp4d_access_token].nil?
|
62
|
-
icp4d_token_manager(icp4d_access_token: vars[:icp4d_access_token], icp4d_url: vars[:icp4d_url],
|
63
|
-
username: vars[:username], password: vars[:password])
|
64
|
-
elsif !vars[:username].nil? && !vars[:password].nil?
|
65
|
-
if vars[:username] == "apikey" && !@icp_prefix
|
66
|
-
iam_apikey(iam_apikey: vars[:password])
|
67
|
-
else
|
68
|
-
@username = vars[:username]
|
69
|
-
@password = vars[:password]
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
if @display_name && !@username && !@iam_apikey
|
74
|
-
service_name = @display_name.sub(" ", "_").downcase
|
75
|
-
load_from_credential_file(service_name)
|
76
|
-
@icp_prefix = @password&.start_with?("icp-") || @iam_apikey&.start_with?("icp-") ? true : false
|
77
|
-
end
|
78
|
-
|
79
55
|
if vars[:use_vcap_services] && !@username && !@iam_apikey
|
80
56
|
@vcap_service_credentials = load_from_vcap_services(service_name: vars[:vcap_services_name])
|
81
57
|
if !@vcap_service_credentials.nil? && @vcap_service_credentials.instance_of?(Hash)
|
@@ -91,6 +67,31 @@ module IBMCloudSdkCore
|
|
91
67
|
end
|
92
68
|
end
|
93
69
|
|
70
|
+
if @display_name && !@username && !@iam_apikey
|
71
|
+
service_name = @display_name.sub(" ", "_").downcase
|
72
|
+
load_from_credential_file(service_name)
|
73
|
+
@icp_prefix = @password&.start_with?("icp-") || @iam_apikey&.start_with?("icp-") ? true : false
|
74
|
+
end
|
75
|
+
|
76
|
+
if @authentication_type == "iam" || ((!@iam_access_token.nil? || !@iam_apikey.nil?) && !@icp_prefix)
|
77
|
+
iam_token_manager(iam_apikey: @iam_apikey, iam_access_token: @iam_access_token,
|
78
|
+
iam_url: @iam_url, iam_client_id: @iam_client_id,
|
79
|
+
iam_client_secret: @iam_client_secret)
|
80
|
+
elsif !@iam_apikey.nil? && @icp_prefix
|
81
|
+
@username = "apikey"
|
82
|
+
@password = vars[:iam_apikey]
|
83
|
+
elsif @authentication_type == "icp4d" || !@icp4d_access_token.nil?
|
84
|
+
icp4d_token_manager(icp4d_access_token: @icp4d_access_token, icp4d_url: @icp4d_url,
|
85
|
+
username: @username, password: @password)
|
86
|
+
elsif !@username.nil? && !@password.nil?
|
87
|
+
if @username == "apikey" && !@icp_prefix
|
88
|
+
iam_apikey(iam_apikey: @password)
|
89
|
+
else
|
90
|
+
@username = @username
|
91
|
+
@password = @password
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
94
95
|
raise ArgumentError.new('The username shouldn\'t start or end with curly brackets or quotes. Be sure to remove any {} and \" characters surrounding your username') if check_bad_first_or_last_char(@username)
|
95
96
|
raise ArgumentError.new('The password shouldn\'t start or end with curly brackets or quotes. Be sure to remove any {} and \" characters surrounding your password') if check_bad_first_or_last_char(@password)
|
96
97
|
raise ArgumentError.new('The url shouldn\'t start or end with curly brackets or quotes. Be sure to remove any {} and \" characters surrounding your url') if check_bad_first_or_last_char(@url)
|
@@ -110,7 +111,7 @@ module IBMCloudSdkCore
|
|
110
111
|
|
111
112
|
# Home directory
|
112
113
|
if credential_file_path.nil?
|
113
|
-
file_path = ENV["HOME"] + DEFAULT_CREDENTIALS_FILE_NAME
|
114
|
+
file_path = ENV["HOME"] + "/" + DEFAULT_CREDENTIALS_FILE_NAME
|
114
115
|
credential_file_path = file_path if File.exist?(file_path)
|
115
116
|
end
|
116
117
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibm_cloud_sdk_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mamoon Raja
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -265,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
265
|
- !ruby/object:Gem::Version
|
266
266
|
version: '0'
|
267
267
|
requirements: []
|
268
|
-
rubygems_version: 3.0.
|
268
|
+
rubygems_version: 3.0.4
|
269
269
|
signing_key:
|
270
270
|
specification_version: 4
|
271
271
|
summary: Official IBM Cloud SDK core library
|