Class: Bosh::Cli::PublicStemcells
Constant Summary collapse
- PUBLIC_STEMCELLS_BASE_URL =
'https://bosh-jenkins-artifacts.s3.amazonaws.com'
Instance Method Summary collapse
- #all ⇒ Object
- #find(stemcell_filename) ⇒ Object
- #has_stemcell?(stemcell_filename) ⇒ Boolean
- #recent ⇒ Object
Instance Method Details
#all ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cli/public_stemcells.rb', line 19 def all response = HTTPClient.new.get(PUBLIC_STEMCELLS_BASE_URL, {'prefix' => 'bosh-stemcell'}) doc = REXML::Document.new(response.body) = parse_document(doc) stemcells = parse_stemcells() while is_truncated(doc) response = HTTPClient.new.get(PUBLIC_STEMCELLS_BASE_URL, { 'prefix' => 'bosh-stemcell', 'marker' => .last.get_text('Key').value }) doc = REXML::Document.new(response.body) = parse_document(doc) stemcells += parse_stemcells() end stemcells end |
#find(stemcell_filename) ⇒ Object
15 16 17 |
# File 'lib/cli/public_stemcells.rb', line 15 def find(stemcell_filename) all.detect { |stemcell| stemcell.name == stemcell_filename } end |
#has_stemcell?(stemcell_filename) ⇒ Boolean
11 12 13 |
# File 'lib/cli/public_stemcells.rb', line 11 def has_stemcell?(stemcell_filename) all.any? { |stemcell| stemcell.name == stemcell_filename } end |
#recent ⇒ Object
39 40 41 42 |
# File 'lib/cli/public_stemcells.rb', line 39 def recent stemcell_varietes = all.reject(&:legacy?).group_by(&:variety).values stemcell_varietes.map { |stemcells| stemcells.sort_by(&:version).last } end |