ManageIQ / manageiq-api-client

Ruby client library to the ManageIQ REST API
MIT License
11 stars 26 forks source link

document usage #35

Open abellotti opened 8 years ago

abellotti commented 8 years ago

once the dust settles and we have a good percentage of the API working, the main README should be updated and possibly another file with more examples.

b-long commented 7 years ago

@abellotti @Fryguy I'd like to help out with this issue.

I've used the REST interface to provision and delete all types of VMs in Ruby, but now I want to develop better control & understanding using the Ruby API. Here's the sort of thing I've managed to do so far:

miq_client = ManageIQ::API::Client.new(
  url: @auth_config.url,
  user: @auth_config.user,
  password: @auth_config.password
)

result_set = miq_client.vms.where(name: 'my-vm*')
@logger.info("Number of instances created by me: #{result_set.count}")
@logger.debug('Instances created by me')
result_set.each do |vm|
  @logger.debug("VM: #{vm}")
end

I don't have a deep ruby background, so excuse my ignorance. Could you tell me for starters how I can find other data or collections that are accessible?

Can I manipulate ManageIQ::API::Client::Collection::Users or inspect objects like ManageIQ::Providers::Amazon::CloudManager::Vm?

b-long commented 7 years ago

Assume I'm starting from scratch, what is the current method to get the collection of type ManageIQ::Providers::Amazon::CloudManager::Vm ? Sorry if my rails / Ruby vocabulary is incorrect.