Sha256: 8399de294edf90ef824ea921b180814da3e78f6ff43d8fec30e504af669f8d84

Contents?: true

Size: 1.03 KB

Versions: 24

Compression:

Stored size: 1.03 KB

Contents

class Snapshot < CloudstackCli::Base

  desc 'list', 'list snapshots'
  option :account, desc: "the account associated with the snapshot"
  option :project, desc: "the project associated with the snapshot"
  option :domain, desc: "the domain name of the snapshot's account"
  option :listall, default: true, desc: "list all resources the caller has rights on"
  option :state, desc: "filter snapshots by state"
  def list
    resolve_account
    resolve_project
    resolve_domain
    snapshots = client.list_snapshots(options)
    if snapshots.size < 1
      say "No snapshots found."
    else
      table = [%w(Account Name Volume Created Type State)]
      snapshots = filter_by(snapshots, :state, options[:state]) if options[:state]
      snapshots.each do |snapshot|
        table << [
        	snapshot['account'], snapshot['name'], snapshot['volumename'],
        	snapshot['created'], snapshot['snapshottype'], snapshot['state']
        ]
      end
      print_table table
      say "Total number of snapshots: #{snapshots.size}"
    end
  end

end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
cloudstack-cli-1.4.1 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.4.0 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.3.3 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.3.2 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.3.1 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.3.0 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.2.7 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.2.6 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.2.5 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.2.4 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.2.3 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.2.1 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.2.0 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.1.0 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.0.8 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.0.7 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.0.6 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.0.5 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.0.4 lib/cloudstack-cli/commands/snapshot.rb
cloudstack-cli-1.0.3 lib/cloudstack-cli/commands/snapshot.rb