right_api_client 1.5.28 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 304eb8dc7fffc201f86fd38ea6af1aa114e47a6d
4
+ data.tar.gz: c15da2ef2793b2a8c90488f41cf7e4310ce073e6
5
+ SHA512:
6
+ metadata.gz: 11d74155efd40389bf64cde1b1e97c34f3e1610ff3da7f563de386cb63c70b24d2e61b4e8e80cf09f5832af4752a3aa689295b241b2f6aa5bf0720466c45715b
7
+ data.tar.gz: 272edd8cfecd3e92bd32b61295b03fa364ac5faca26035f20c403ab846f94f93c1ff1ec493c543c6092654ad325068dfacf00ed8af1043269aa2c0d937e65cbf
@@ -1,7 +1,6 @@
1
1
  language: ruby
2
+ sudo: false
2
3
  rvm:
3
- - 1.8.7
4
- - 1.9.3
5
4
  - 2.0.0
6
5
  - 2.1.0
7
6
  script:
@@ -3,6 +3,10 @@
3
3
  ## Next
4
4
  - Your info here
5
5
 
6
+ ## 1.6
7
+ - \#101 Deprecate support for ruby 1.x
8
+ - \#100 Add support for using local proxy with RightLink10
9
+
6
10
  ## 1.5.28
7
11
  - \#98 Update do_put to add text/plain Content-type
8
12
  - \#97 Added put action for the runnable_binding resource
data/Gemfile CHANGED
@@ -16,9 +16,7 @@ end
16
16
 
17
17
  # Gems used during test and development that should be OMITTED from the gemspec
18
18
  group :test do
19
- gem 'ruby-debug',
20
- :platforms => [:ruby_18]
21
- gem 'debugger',
22
- :platforms => [:ruby_19, :ruby_20, :ruby_21]
19
+ gem 'byebug',
20
+ :platforms => [:ruby_20, :ruby_21]
23
21
  gem 'jeweler', '~> 2.0'
24
22
  end
@@ -3,20 +3,14 @@ GEM
3
3
  specs:
4
4
  addressable (2.3.6)
5
5
  builder (3.2.2)
6
+ byebug (6.0.2)
6
7
  coderay (1.1.0)
7
- columnize (0.3.6)
8
8
  coveralls (0.7.1)
9
9
  multi_json (~> 1.3)
10
10
  rest-client
11
11
  simplecov (>= 0.7)
12
12
  term-ansicolor
13
13
  thor
14
- debugger (1.6.6)
15
- columnize (>= 0.3.1)
16
- debugger-linecache (~> 1.2.0)
17
- debugger-ruby_core_source (~> 1.3.2)
18
- debugger-linecache (1.2.0)
19
- debugger-ruby_core_source (1.3.2)
20
14
  diff-lcs (1.1.3)
21
15
  docile (1.1.5)
22
16
  faraday (0.8.9)
@@ -44,8 +38,6 @@ GEM
44
38
  json (1.8.1)
45
39
  jwt (0.1.11)
46
40
  multi_json (>= 1.5)
47
- linecache (0.46)
48
- rbx-require-relative (> 0.0.4)
49
41
  method_source (0.8.2)
50
42
  mime-types (1.25.1)
51
43
  multi_json (1.10.1)
@@ -64,7 +56,6 @@ GEM
64
56
  slop (~> 3.4)
65
57
  rack (1.5.2)
66
58
  rake (0.8.7)
67
- rbx-require-relative (0.0.9)
68
59
  rdoc (4.1.1)
69
60
  json (~> 1.4)
70
61
  rest-client (1.6.8)
@@ -78,11 +69,6 @@ GEM
78
69
  rspec-expectations (2.9.1)
79
70
  diff-lcs (~> 1.1.3)
80
71
  rspec-mocks (2.9.0)
81
- ruby-debug (0.10.4)
82
- columnize (>= 0.1)
83
- ruby-debug-base (~> 0.10.4.0)
84
- ruby-debug-base (0.10.4)
85
- linecache (>= 0.3)
86
72
  simplecov (0.9.0)
87
73
  docile (~> 1.1.0)
88
74
  multi_json
@@ -98,8 +84,8 @@ PLATFORMS
98
84
  ruby
99
85
 
100
86
  DEPENDENCIES
87
+ byebug
101
88
  coveralls
102
- debugger
103
89
  flexmock (= 0.8.7)
104
90
  jeweler (~> 2.0)
105
91
  json (~> 1.0)
@@ -108,4 +94,6 @@ DEPENDENCIES
108
94
  rake (= 0.8.7)
109
95
  rest-client (~> 1.6)
110
96
  rspec (= 2.9.0)
111
- ruby-debug
97
+
98
+ BUNDLED WITH
99
+ 1.10.6
data/README.md CHANGED
@@ -13,14 +13,14 @@ It is assumed that users are already familiar with the RightScale API:
13
13
  Maintained by the RightScale QA ServerTemplate and Ivory Automation Team
14
14
 
15
15
  ## Installation
16
- Ruby 1.8.7 or higher is required.
16
+ Ruby 2.0 or higher is required as of version 1.6
17
17
 
18
18
  gem install right_api_client
19
19
 
20
20
  ## Versioning
21
21
  The right\_api\_client gem is versioned using the usual X.Y.Z notation, where X.Y is the
22
22
  RightScale API version, and Z is the client version. For example, if you want to use
23
- RightScale API 1.5, you should use the latest version of the 1.5 gem. This will ensure
23
+ RightScale API 1.5, you should use the latest version of the 1.6 gem. This will ensure
24
24
  that you get the latest bug fixes for the client that is compatible with that API version.
25
25
 
26
26
  ## Usage Instructions
@@ -33,7 +33,7 @@ navigate to the Settings > Account Settings page. The account is is at the end o
33
33
  puts "Available methods: #{@client.api_methods}"
34
34
 
35
35
  The client makes working with and getting to know the API much easier. It spiders the API dynamically to
36
- discover its resources on the fly. At every step, the user has the ability to query api_methods(), which
36
+ discover its resources on the fly. At every step, the user has the ability to query api\_methods(), which
37
37
  indicates the potential methods that can be called. **The ```config/login.yml.example``` file provides
38
38
  details of different login parameters, for example, oauth authentication.**
39
39
 
@@ -162,7 +162,7 @@ Launch the newly created server. Inputs are a bit tricky so they have to be set
162
162
  inputs = "inputs[][name]=NAME1&inputs[][value]=text:VALUE1&inputs[][name]=NAME2&inputs[][value]=text:VALUE2"
163
163
  new_server.show.launch(inputs)
164
164
 
165
- Run a script on the server. The API does not currently expose right_scripts, hence, the script href has
165
+ Run a script on the server. The API does not currently expose right\_scripts, hence, the script href has
166
166
  to be retrieved from the dashboard and put in the following href format.
167
167
 
168
168
  script_href = "right_script_href=/api/right_scripts/382371"
@@ -174,7 +174,7 @@ Update the server's name
174
174
  params = { :server => {:name => 'New Server Name'}}
175
175
  @client.servers(:id => 'my_server_id').update(params)
176
176
 
177
- Terminate the server (i.e. shutdown its current_instance)
177
+ Terminate the server (i.e. shutdown its current\_instance)
178
178
 
179
179
  @client.servers(:id => 'my_server_id').show.terminate
180
180
 
@@ -238,6 +238,17 @@ Due to the limiting scope of the instance-facing calls, only a subset of these m
238
238
  (see the API Reference Docs for valid methods). If you call a method that instance's are not authorized to access,
239
239
  you will get a 403 Permission Denied error.
240
240
 
241
+ ## RightLink10 and Instance Facing Calls:
242
+ Having RightLink10 installed on an instance allows 'instance facing calls' via a local
243
+ [reverse proxy](http://docs.rightscale.com/rl10/reference/rl10_local_and_proxied_http_requests.html). To use
244
+ the reverse proxy on the instance, you will only need to provide the following parameter:
245
+
246
+ - ```:rl10``` Set this to ```true```
247
+
248
+ Setting this parameter to `true` will use the information in the proxy authentication file to create the client.
249
+
250
+ ### Example
251
+ @instance_client = RightApi::Client.new(:rl10 => true)
241
252
 
242
253
  # Design Decisions
243
254
  In the code, we only hard-code CRUD operations for resources. We use the .show and .index methods to make the client
@@ -296,20 +307,23 @@ bundle exec rspec spec/functional
296
307
 
297
308
  # Troubleshooting
298
309
 
310
+ ## Known issues:
311
+ * Cookies are lost on follow redirect. This is a bug introduced in rest-client.
312
+ [Github issue #406](https://github.com/rest-client/rest-client/issues/406)
313
+ has already been filed for this. To work around this, please lock the rest-client version
314
+ to 1.7 until the issue is fixed.
315
+
316
+
299
317
  ## Wrong ruby version
300
318
 
301
- Ruby 1.8.7 or higher is required.
319
+ * As of right\_api\_client gem version 1.6, only Ruby 2.0 or higher is supported.
320
+ * right\_api\_client version 1.5.28 was tested with ruby 1.9, but it no longer supported.
302
321
 
303
322
  ## Warning message: To disable read timeouts, please set timeout to nil instead of -1
304
323
 
305
324
  To avoid this message you can set ```:timeout``` when creating your RightAp::Client object. You will need
306
325
  to use a different value depending on which version of rest-client is being used.
307
326
 
308
- ### rest-client 1.6.x supports ruby 1.8.x
309
- * ```:timeout => nil```, 60 second timeout (default of Net::HTTP)
310
- * ```:timeout => -1```, infinite timeout.
311
-
312
- ### rest-client 1.7.x supports ruby >= 1.9.x
313
327
  * **```:timeout => nil```, infinite timeout - no warning message.**
314
328
  * ```:timeout => -1```, infinite timeout - plus the error message above being displayed.
315
329
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.28
1
+ 1.6.0
@@ -3,6 +3,7 @@ require 'json'
3
3
  require 'set'
4
4
  require 'cgi'
5
5
  require 'base64'
6
+ require 'rbconfig'
6
7
 
7
8
  require File.expand_path('../version', __FILE__) unless defined?(RightApi::Client::VERSION)
8
9
  require File.expand_path('../helper', __FILE__)
@@ -74,6 +75,7 @@ module RightApi
74
75
  account_id api_url api_version
75
76
  timeout open_timeout max_attempts
76
77
  enable_retry rest_client_class
78
+ rl10
77
79
  ]
78
80
 
79
81
  # @return [String] OAuth 2.0 refresh token if provided
@@ -128,6 +130,19 @@ module RightApi
128
130
 
129
131
  raise 'This API client is only compatible with the RightScale API 1.5 and upwards.' if (Float(@api_version) < 1.5)
130
132
 
133
+ # If rl10 parameter was passed true, read secrets file to set @local_token, and @api_url
134
+ if @rl10
135
+ case RbConfig::CONFIG['host_os']
136
+ when /mswin|mingw|cygwin/
137
+ local_secret_file = File.join(ENV['ProgramData'] || 'C:/ProgramData', 'RightScale/RightLink/secret')
138
+ else
139
+ local_secret_file = '/var/run/rightlink/secret'
140
+ end
141
+ local_auth_info = Hash[File.readlines(local_secret_file).map{ |line| line.chomp.split('=', 2) }]
142
+ @local_token = local_auth_info['RS_RLL_SECRET']
143
+ @api_url = "http://localhost:#{local_auth_info['RS_RLL_PORT']}"
144
+ end
145
+
131
146
  # allow a custom resource-style REST client (for special logging, etc.)
132
147
  @rest_client_class ||= ::RestClient::Resource
133
148
  @rest_client = @rest_client_class.new(@api_url, :open_timeout => @open_timeout, :timeout => @timeout, :ssl_version => @ssl_version)
@@ -147,7 +162,7 @@ module RightApi
147
162
  timestamp_cookies
148
163
 
149
164
  # Add the top level links for instance_facing_calls
150
- if @instance_token
165
+ if @instance_token || @local_token
151
166
  resource_type, path, data = self.do_get(ROOT_INSTANCE_RESOURCE)
152
167
  instance_href = get_href_from_links(data['links'])
153
168
  cloud_href = instance_href.split('/instances')[0]
@@ -316,6 +331,10 @@ module RightApi
316
331
  h[:cookies] = @cookies
317
332
  end
318
333
 
334
+ if @local_token
335
+ h['X-RLL-Secret'] = @local_token
336
+ end
337
+
319
338
  h
320
339
  end
321
340
 
@@ -523,7 +542,11 @@ module RightApi
523
542
  #
524
543
  # @return [Boolean] true if re-login is known to be required
525
544
  def need_login?
526
- if @access_token
545
+ # @local_token is the key to use the local proxy. Connecting using this key
546
+ # and the local proxy does not require login.
547
+ if @local_token
548
+ false
549
+ elsif @access_token
527
550
  # If our access token is expired and we know it...
528
551
  @access_token_expires_at && @access_token_expires_at - Time.now < 900
529
552
  elsif @cookies
metadata CHANGED
@@ -1,113 +1,132 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.28
5
- prerelease:
4
+ version: 1.6.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - RightScale, Inc.
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-09-24 00:00:00.000000000 Z
11
+ date: 2015-10-15 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: json
16
- requirement: &15775520 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *15775520
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: mime-types
27
- requirement: &15774740 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ~>
31
32
  - !ruby/object:Gem::Version
32
33
  version: '1.0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *15774740
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: rest-client
38
- requirement: &15774060 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
45
  - - ~>
42
46
  - !ruby/object:Gem::Version
43
47
  version: '1.6'
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *15774060
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: rake
49
- requirement: &15773220 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - =
59
+ - - '='
53
60
  - !ruby/object:Gem::Version
54
61
  version: 0.8.7
55
62
  type: :development
56
63
  prerelease: false
57
- version_requirements: *15773220
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.8.7
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: rspec
60
- requirement: &15772120 !ruby/object:Gem::Requirement
61
- none: false
71
+ requirement: !ruby/object:Gem::Requirement
62
72
  requirements:
63
- - - =
73
+ - - '='
64
74
  - !ruby/object:Gem::Version
65
75
  version: 2.9.0
66
76
  type: :development
67
77
  prerelease: false
68
- version_requirements: *15772120
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 2.9.0
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: flexmock
71
- requirement: &15787100 !ruby/object:Gem::Requirement
72
- none: false
85
+ requirement: !ruby/object:Gem::Requirement
73
86
  requirements:
74
- - - =
87
+ - - '='
75
88
  - !ruby/object:Gem::Version
76
89
  version: 0.8.7
77
90
  type: :development
78
91
  prerelease: false
79
- version_requirements: *15787100
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.8.7
80
97
  - !ruby/object:Gem::Dependency
81
98
  name: coveralls
82
- requirement: &15786180 !ruby/object:Gem::Requirement
83
- none: false
99
+ requirement: !ruby/object:Gem::Requirement
84
100
  requirements:
85
- - - ! '>='
101
+ - - '>='
86
102
  - !ruby/object:Gem::Version
87
103
  version: '0'
88
104
  type: :development
89
105
  prerelease: false
90
- version_requirements: *15786180
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
91
111
  - !ruby/object:Gem::Dependency
92
112
  name: pry
93
- requirement: &15785100 !ruby/object:Gem::Requirement
94
- none: false
113
+ requirement: !ruby/object:Gem::Requirement
95
114
  requirements:
96
- - - ! '>='
115
+ - - '>='
97
116
  - !ruby/object:Gem::Version
98
117
  version: '0'
99
118
  type: :development
100
119
  prerelease: false
101
- version_requirements: *15785100
102
- description: ! '
103
-
104
- The right_api_client gem simplifies the use of RightScale''s MultiCloud API.
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: |2
105
126
 
127
+ The right_api_client gem simplifies the use of RightScale's MultiCloud API.
106
128
  It provides a simple object model of the API resources, and handles all of the
107
-
108
129
  fine details involved in making HTTP calls and translating their responses.
109
-
110
- '
111
130
  email: rubygems@rightscale.com
112
131
  executables: []
113
132
  extensions: []
@@ -138,29 +157,25 @@ files:
138
157
  homepage: https://github.com/rightscale/right_api_client
139
158
  licenses:
140
159
  - MIT
160
+ metadata: {}
141
161
  post_install_message:
142
162
  rdoc_options: []
143
163
  require_paths:
144
164
  - lib
145
165
  required_ruby_version: !ruby/object:Gem::Requirement
146
- none: false
147
166
  requirements:
148
- - - ! '>='
167
+ - - '>='
149
168
  - !ruby/object:Gem::Version
150
169
  version: '0'
151
- segments:
152
- - 0
153
- hash: -65157902423218437
154
170
  required_rubygems_version: !ruby/object:Gem::Requirement
155
- none: false
156
171
  requirements:
157
- - - ! '>='
172
+ - - '>='
158
173
  - !ruby/object:Gem::Version
159
174
  version: '0'
160
175
  requirements: []
161
176
  rubyforge_project:
162
- rubygems_version: 1.8.11
177
+ rubygems_version: 2.0.14
163
178
  signing_key:
164
- specification_version: 3
179
+ specification_version: 4
165
180
  summary: RightScale MultiCloud API HTTP Client
166
181
  test_files: []