Sha256: 3289beb6bace291b1e7dcf3b14abcd5fc8ad0bfc1282db2cf0b75a2855b1cdf3

Contents?: true

Size: 914 Bytes

Versions: 1

Compression:

Stored size: 914 Bytes

Contents

#!/usr/bin/env ruby

require 'lib/trollop'
require 'pp'

$options = Trollop::options do
  banner <<-EOS
#{File.read('README')}
Options:    
  EOS
  opt :url, "Base url of ESOD service", :required => true, :type => :string
  opt :resource, "Resource to retrieve (ex: server)", :type => :string, :required => true
  opt :id, "Id of resource to retrieve (ex: 12345)", :type => :string, :required => true
  opt :property, "Property of the resource, dotted notation (ex: vm_configuration_parameters.first.name)", :type => :string, :required => false
  opt :api_token, "User authentication token", :type => :string, :required => true
end

require 'esodclient'

def main
  client = ESODClient.new($options[:url], $options[:api_token])
  response = client.get($options[:resource], $options[:id])

  if $options[:property]
    response = response.value_of_dotted_property($options[:property])
  end

  pp response
end

main

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
esod-client-0.2.0 esod-client.rb