cf_light_api 2.5.0 → 2.5.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
  SHA1:
3
- metadata.gz: ebbc487391ec0d46cee3d3b12dfc162c44d0a4a6
4
- data.tar.gz: 9a9a92b041a9ece7bdee042bb3c7cb358a09d63a
3
+ metadata.gz: 18df9e343201fa390b2e742b91d088e41d78b922
4
+ data.tar.gz: 3312d769e6a5fec35b40e3cd1753823c17119205
5
5
  SHA512:
6
- metadata.gz: 1e7d7f2ceb29072dd7ad41dda11fe9533aadf00f15c0ec28b3418a18465f3ec80f2dc0235a70b5c0b4ff3b84466e881d347f7d5045b04d34a033a51279aba6e6
7
- data.tar.gz: f4655642b2a4601bde54562809a1948762d1e903cb022faf8572337f281f21dc11d1f4b68dd7aef6258e59f69d90b868ee086de60fb63b44718f4bff45ad3c93
6
+ metadata.gz: fd5a3218fb2a0e54962c396a65a56f73738ad8b897742375189b02ae13166f5e52468e425bd0ae50fb88afef8b1ae52980755a19120960e7c7556b7e18b8aef8
7
+ data.tar.gz: e8c6a23ca2bd1127970a0d11a7adc31ee5a49c5e09e5b79aaf26866a6755438e2c59a42be227f948b41d43e4eeabac4dac2b007daf5ede9496bda2a2b5e39789
@@ -176,6 +176,7 @@ class CFLightAPIWorker
176
176
  @spaces = cf_rest('/v2/spaces?results-per-page=100')
177
177
  @stacks = cf_rest('/v2/stacks?results-per-page=100')
178
178
  @domains = cf_rest('/v2/domains?results-per-page=100')
179
+ cf_info = cf_rest('/v2/info').first
179
180
 
180
181
  formatted_orgs = @orgs.map do |org|
181
182
  quota = @quotas.find{|a_quota| a_quota['metadata']['guid'] == org['entity']['quota_definition_guid']}
@@ -200,7 +201,6 @@ class CFLightAPIWorker
200
201
  space = @spaces.find{|a_space| a_space['metadata']['guid'] == app['entity']['space_guid']}
201
202
  org = @orgs.find{|an_org| an_org['metadata']['guid'] == space['entity']['organization_guid']}
202
203
  stack = @stacks.find{|a_stack| a_stack['metadata']['guid'] == app['entity']['stack_guid']}
203
- routes = format_routes_for_app(app)
204
204
 
205
205
  running = (app['entity']['state'] == "STARTED")
206
206
 
@@ -214,7 +214,6 @@ class CFLightAPIWorker
214
214
  :last_uploaded => app['metadata']['updated_at'] ? DateTime.parse(app['metadata']['updated_at']).strftime('%Y-%m-%d %T %z') : nil,
215
215
  :name => app['entity']['name'],
216
216
  :org => org['entity']['name'],
217
- :routes => routes,
218
217
  :space => space['entity']['name'],
219
218
  :stack => stack['entity']['name'],
220
219
  :state => app['entity']['state']
@@ -239,9 +238,12 @@ class CFLightAPIWorker
239
238
  end
240
239
  end
241
240
 
241
+ routes = format_routes_for_app(app)
242
+
242
243
  additional_data = {
243
244
  :running => running,
244
245
  :instances => instance_stats,
246
+ :routes => routes,
245
247
  :error => nil
246
248
  }
247
249
 
@@ -253,6 +255,7 @@ class CFLightAPIWorker
253
255
  additional_data = {
254
256
  :running => 'error',
255
257
  :instances => [],
258
+ :routes => [],
256
259
  :error => e.message
257
260
  }
258
261
  end
@@ -260,6 +263,7 @@ class CFLightAPIWorker
260
263
  base_data.merge additional_data
261
264
  end
262
265
 
266
+ put_in_redis "#{ENV['REDIS_KEY_PREFIX']}:info", cf_info
263
267
  put_in_redis "#{ENV['REDIS_KEY_PREFIX']}:orgs", formatted_orgs
264
268
  put_in_redis "#{ENV['REDIS_KEY_PREFIX']}:apps", formatted_apps
265
269
  put_in_redis "#{ENV['REDIS_KEY_PREFIX']}:last_updated", {:last_updated => Time.now}
@@ -42,6 +42,12 @@ module Sinatra
42
42
  status 503 if seconds_since_update >= (ENV['DATA_AGE_VALIDITY'] || '600'.to_i)
43
43
  return updated_json
44
44
  end
45
+
46
+ app.get '/v1/info' do
47
+ content_type :json
48
+ return REDIS.get("#{ENV['REDIS_KEY_PREFIX']}:info")
49
+ end
50
+
45
51
  end
46
52
 
47
53
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf_light_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Springer Platform Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-19 00:00:00.000000000 Z
11
+ date: 2017-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cfoundry
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.7.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.7.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: redis
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 3.2.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 3.2.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rufus-scheduler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 3.0.9
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.0.9
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sinatra
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.4.5
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.4.5
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: redlock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.1.1
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.1.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: graphite-api
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 0.1.6
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.1.6
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: newrelic_rpm
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: 3.17.1
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 3.17.1
111
111
  description: A super lightweight API for reading App and Org data from CloudFoundry,
@@ -116,9 +116,9 @@ executables:
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
- - ./lib/sinatra/cf_light_api.rb
120
- - ./lib/cf_light_api/redis.rb
121
- - ./lib/cf_light_api/worker.rb
119
+ - "./lib/cf_light_api/redis.rb"
120
+ - "./lib/cf_light_api/worker.rb"
121
+ - "./lib/sinatra/cf_light_api.rb"
122
122
  - bin/cf_light_api
123
123
  homepage: https://github.com/springerpe/cf-light-api
124
124
  licenses:
@@ -130,17 +130,17 @@ require_paths:
130
130
  - lib
131
131
  required_ruby_version: !ruby/object:Gem::Requirement
132
132
  requirements:
133
- - - '>='
133
+ - - ">="
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  requirements:
138
- - - '>='
138
+ - - ">="
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  requirements: []
142
142
  rubyforge_project:
143
- rubygems_version: 2.0.14
143
+ rubygems_version: 2.5.1
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: A super lightweight API for reading App and Org data from CloudFoundry, cached