Sha256: 3d446924752f76ece30086a6c8a52a6a02b5125687a540da6530310d751ba355

Contents?: true

Size: 1.67 KB

Versions: 2

Compression:

Stored size: 1.67 KB

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'bundler/setup'
require 'optparse'
require 'methadone'

require 'vcloud/core'

class App

  include Methadone::Main
  include Methadone::CLILogging
  include Vcloud

  main do |type|
    Query.new(type, options).run
  end

  on('-A', '--sort-asc', '=ATTRIBUTE', 'Sort ascending') do |v|
    options[:sortAsc] = v
  end

  on('-D', '--sort-desc', '=ATTRIBUTE', 'Sort descending') do |v|
    options[:sortDesc] = v
  end

  on('--fields', '=NAMES', 'Attribute or metadata key names') do |v|
    options[:fields] = v
  end

  on('--filter', '=FILTER', 'Filter expression') do |v|
    options[:filter] = v
  end

  on('-o', '--output-format', '=FORMAT', 'Output format: csv, tsv, yaml') do |v|
    options[:output_format] = v.downcase
  end

  arg :type, :optional

  description '
  vcloud-query takes a query type and returns all vCloud entities of
  that type, obeying supplied filter rules.

  Query types map to vCloud entities, for example: vApp, vm, orgVdc, orgVdcNetwork.

  Without a type argument, returns a list of available Entity Types to query.

  See https://github.com/alphagov/vcloud-tools/blob/master/README.md for more info.

  Example use:

    # get a list of all vApps, returning all available parameters, in YAML

    vcloud-query -o yaml vApp

    # get a list of all powered off VMs return the name and containerName (vapp
    # name)

    vcloud-query --filter "status==POWERED_OFF" --fields name,containerName vm

    # list all query types (types are left-most column, possible formats listed
    # on the left (records is default, and most useful)

    vcloud-query

  '


  version Vcloud::Core::VERSION

  #use_log_level_option

  go!
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vcloud-core-0.1.0 bin/vcloud-query
vcloud-core-0.0.13 bin/vcloud-query