Class: VagrantPlugins::Vrealize::VraClient

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vrealize/vra_client.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ VraClient

Returns a new instance of VraClient.



14
15
16
# File 'lib/vagrant-vrealize/vra_client.rb', line 14

def initialize(client)
  @client = client
end

Class Method Details

.build(vra_params) ⇒ Object



8
9
10
11
# File 'lib/vagrant-vrealize/vra_client.rb', line 8

def self.build(vra_params)
  pagination_bugfix_params = {page_size: 99999}.merge(vra_params)
  new(Vra::Client.new(pagination_bugfix_params))
end

Instance Method Details

#authorize!Object



19
20
21
# File 'lib/vagrant-vrealize/vra_client.rb', line 19

def authorize!
  @client.authorize!
end

#destroy(machine_id) ⇒ Object



46
47
48
49
50
51
# File 'lib/vagrant-vrealize/vra_client.rb', line 46

def destroy(machine_id)
  resource = @client.resources.by_id(machine_id)
  if resource
    resource.destroy
  end
end

#entitled_catalog_itemsObject



29
30
31
# File 'lib/vagrant-vrealize/vra_client.rb', line 29

def entitled_catalog_items
  @client.catalog.entitled_items
end

#request(catalog_item_id, params) {|req| ... } ⇒ Object

Yields:

  • (req)


33
34
35
36
37
# File 'lib/vagrant-vrealize/vra_client.rb', line 33

def request(catalog_item_id,params)
  req = @client.catalog.request(catalog_item_id, params)
  yield req if block_given?
  req.submit
end

#resourcesObject



24
25
26
# File 'lib/vagrant-vrealize/vra_client.rb', line 24

def resources
  @client.resources
end

#ssh_info(machine_id) ⇒ Object



39
40
41
42
43
44
# File 'lib/vagrant-vrealize/vra_client.rb', line 39

def ssh_info(machine_id)
  resource = @client.resources.by_id(machine_id)
  host = resource.ip_addresses.first

  {host: host, port: 22}
end