cf_light_api 1.6.7 → 1.7.0

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: b5afa1da4d96084a76354c0bcd8544b2c2412896
4
- data.tar.gz: e9bb6e37de0d1af87e8ab9555a292e282869b473
3
+ metadata.gz: 3067cac56cd133c9fc4fd246f29e0874335f2998
4
+ data.tar.gz: 4fb42dd6f9e61ee969b6d966c15ac5bfc636cc6d
5
5
  SHA512:
6
- metadata.gz: 50106d0b2aaba20a1e07d17ce2eb415954904b52479a2097583315b75451faff00706aea6c84b4b7927028a0cade97035ac8db6aa66faf6cb48931bed2190418
7
- data.tar.gz: 5eace511a6f414778cdddc4db00c7ed1579c690558756dd49a77abc2d476ca92ec1d74ef566e2517fd28c30ab7ba113dcee73b8a68959ea23e79bb78b40fdb40
6
+ metadata.gz: 348c46fd0ae464fb196b78598a713ed1b620a989757bdb1d8dcdf61d542df19b8d7edf5bd985e921b4cd5b61ad3c05ded7831c5f49ec6c4b458c85043ea4fbf9
7
+ data.tar.gz: 64723974aad403fb3cff89385976ce7f7a8c2bb4214a3a5fd325f9ff65c8734a6fba658dde1496ca2f6c1e5e123c1ec3bdafa795ad208f5c54a9c2e1bc37ca97
@@ -114,11 +114,11 @@ end
114
114
 
115
115
  def get_org_data(cf_client)
116
116
  Parallel.map( cf_client.organizations, :in_threads=> PARALLEL_MAPS) do |org|
117
- org_name = org.name
118
- @logger.info "Getting org data for #{org_name}..."
117
+ @logger.info "Getting org data for #{org.name}..."
119
118
  # The CFoundry client returns memory_limit in MB, so we need to normalise to bytes to match the Apps.
120
119
  {
121
- :name => org_name,
120
+ :guid => org.guid,
121
+ :name => org.name,
122
122
  :quota => {
123
123
  :total_services => org.quota_definition.total_services,
124
124
  :memory_limit => org.quota_definition.memory_limit * 1024 * 1024
@@ -151,7 +151,7 @@ def format_app_data(app, org_name, space_name)
151
151
  :error => nil
152
152
  }
153
153
  rescue => e
154
- # @logger.info " #{org_name} #{space_name}: '#{app.name}'' error: #{e.message}"
154
+ @logger.info " #{org_name} #{space_name}: '#{app.name}'' error: #{e.message}"
155
155
  additional_data = {
156
156
  :running => 'error',
157
157
  :instances => [],
@@ -5,9 +5,8 @@ module Sinatra
5
5
 
6
6
  def self.registered(app)
7
7
  app.get '/v1/apps/?:org?' do
8
- all_apps = JSON.parse(REDIS.get("#{ENV['REDIS_KEY_PREFIX']}:apps"))
9
-
10
8
  content_type :json
9
+ all_apps = JSON.parse(REDIS.get("#{ENV['REDIS_KEY_PREFIX']}:apps"))
11
10
 
12
11
  if params[:org]
13
12
  return all_apps.select{|an_app| an_app['org'] == params[:org]}.to_json
@@ -16,9 +15,15 @@ module Sinatra
16
15
  return all_apps.to_json
17
16
  end
18
17
 
19
- app.get '/v1/orgs/?' do
18
+ app.get '/v1/orgs/?:guid?' do
20
19
  content_type :json
21
- REDIS.get "#{ENV['REDIS_KEY_PREFIX']}:orgs"
20
+ all_orgs = JSON.parse(REDIS.get("#{ENV['REDIS_KEY_PREFIX']}:orgs"))
21
+
22
+ if params[:guid]
23
+ return all_orgs.select{|an_org| an_org['guid'] == params[:guid]}.to_json
24
+ end
25
+
26
+ return all_orgs.to_json
22
27
  end
23
28
 
24
29
  app.get '/v1/last_updated' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf_light_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.7
4
+ version: 1.7.0
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: 2016-02-04 00:00:00.000000000 Z
11
+ date: 2016-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cfoundry