Class: Bosh::Cli::Client::CompiledPackagesClient

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/client/compiled_packages_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(director) ⇒ CompiledPackagesClient

Returns a new instance of CompiledPackagesClient.



3
4
5
# File 'lib/cli/client/compiled_packages_client.rb', line 3

def initialize(director)
  @director = director
end

Instance Method Details

#export(release_name, release_version, stemcell_name, stemcell_version) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cli/client/compiled_packages_client.rb', line 7

def export(release_name, release_version, stemcell_name, stemcell_version)
  path = "/compiled_package_groups/export"
  content_type = 'application/json'

  body = JSON.dump(
    stemcell_name: stemcell_name,
    stemcell_version: stemcell_version,
    release_name: release_name,
    release_version: release_version,
  )

  _, file_path, _ = @director.post(path, content_type, body, {}, file: true)
  file_path
end

#import(exported_tar_path) ⇒ Object



22
23
24
25
26
# File 'lib/cli/client/compiled_packages_client.rb', line 22

def import(exported_tar_path)
  path = '/compiled_package_groups/import'

  @director.upload_and_track(:post, path, exported_tar_path, {content_type: 'application/x-compressed'})
end