cf_light_api 3.0.0 → 3.1.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cf_light_api/worker.rb +16 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03af503b7c5d152f5929036c82bd9ad4ef1a750c
|
4
|
+
data.tar.gz: cded94cbf4dbdbd7e9bdcf941150946e630a5491
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de6c455dbebf3c3261f8ddbf7cfdfa43f2f5ba725de02587147aa6e9141907bdb0db66738d8ff9b33c9d9c3451d1a515c2933c2db9d49ab6b973e6ca31dde0e2
|
7
|
+
data.tar.gz: cd9cbc6c8172285bf197dfd5e7c3899e4597a75bc1f5aa8176a2d3cfa0e3d46317f677dfd7b9917829f29a63f76157c6084a87c71bd4e6bd49a4758006b142a7
|
data/lib/cf_light_api/worker.rb
CHANGED
@@ -178,6 +178,11 @@ class CFLightAPIWorker
|
|
178
178
|
@domains = cf_rest('/v2/domains?results-per-page=100')
|
179
179
|
end
|
180
180
|
|
181
|
+
def get_buildpacks_by_guid
|
182
|
+
buildpacks = cf_rest('/v2/buildpacks?results-per-page=100')
|
183
|
+
buildpacks_by_guid = buildpacks.map { |buildpack| [buildpack['metadata']['guid'], buildpack] }.to_h
|
184
|
+
end
|
185
|
+
|
181
186
|
def find_domain_for_route route
|
182
187
|
return @domains.find{|a_domain| a_domain['metadata']['guid'] == route['entity']['domain_guid']}
|
183
188
|
end
|
@@ -301,6 +306,7 @@ class CFLightAPIWorker
|
|
301
306
|
|
302
307
|
@apps = cf_rest('/v2/apps?results-per-page=100&inline-relations-depth=1&include-relations=routes,stack')
|
303
308
|
@spaces = cf_rest('/v2/spaces?results-per-page=100')
|
309
|
+
@buildpacks = get_buildpacks_by_guid() # Sets @buildpacks to a map of buildpack resources indexed by guid
|
304
310
|
|
305
311
|
update_domains() # Sets @domain by hitting the CF API
|
306
312
|
|
@@ -327,6 +333,16 @@ class CFLightAPIWorker
|
|
327
333
|
v2_document['routes'] = []
|
328
334
|
v2_document['meta'] = { 'error' => false }
|
329
335
|
|
336
|
+
# Add buildpack_name as a top level string attribute and looks it up using its guid when the buildpack field is null
|
337
|
+
buildpack_name = app['entity']['buildpack']
|
338
|
+
buildpack_guid = app['entity']['detected_buildpack_guid']
|
339
|
+
|
340
|
+
v2_document['buildpack_name'] = buildpack_name
|
341
|
+
|
342
|
+
if buildpack_name.nil? or buildpack_name.empty?
|
343
|
+
v2_document['buildpack_name'] = @buildpacks[buildpack_guid]['entity']['name']
|
344
|
+
end
|
345
|
+
|
330
346
|
# Add space, stack and org names as a top level string attribute for ease of use:
|
331
347
|
v2_document['stack'] = app['entity']['stack']['entity']['name']
|
332
348
|
|
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: 3.0.
|
4
|
+
version: 3.1.0.pre1
|
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: 2018-
|
11
|
+
date: 2018-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cfoundry
|
@@ -150,12 +150,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
150
|
version: '0'
|
151
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
|
-
- - "
|
153
|
+
- - ">"
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version:
|
155
|
+
version: 1.3.1
|
156
156
|
requirements: []
|
157
157
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.5.
|
158
|
+
rubygems_version: 2.5.2
|
159
159
|
signing_key:
|
160
160
|
specification_version: 4
|
161
161
|
summary: A super lightweight API for reading App and Org data from CloudFoundry, cached
|