class DownloadBundleParameters

Constants

DIRECTORY_DESCRIPTION
MANIFEST_DESCRIPTION
PREFIX_DESCRIPTION
RETRY_DESCRIPTION

Attributes

directory[RW]
manifest[RW]
prefix[RW]
privatekey[RW]
retry[RW]

Public Instance Methods

mandatory_params() click to toggle source
Calls superclass method S3ToolParameters#mandatory_params
# File lib/ec2/amitools/downloadbundleparameters.rb, line 32
def mandatory_params()
  super()
  
  on('-k', '--privatekey KEY', String, USER_PK_PATH_DESCRIPTION) do |privatekey|
    assert_file_exists(privatekey, '--privatekey')
    @privatekey = privatekey
  end
end
optional_params() click to toggle source
Calls superclass method S3ToolParameters#optional_params
# File lib/ec2/amitools/downloadbundleparameters.rb, line 43
def optional_params()
  super()
  
  on('-m', '--manifest FILE', String, *MANIFEST_DESCRIPTION) do |manifest|
    assert_good_key(manifest, '--manifest')
    @manifest = manifest
  end
  
  on('-p', '--prefix PREFIX', String, PREFIX_DESCRIPTION) do |prefix|
    assert_good_key(prefix, '--prefix')
    @prefix = prefix
  end
  
  on('-d', '--directory DIRECTORY', String, *DIRECTORY_DESCRIPTION) do |directory|
    assert_directory_exists(directory, '--directory')
    @directory = directory
  end
  
  on('--retry', RETRY_DESCRIPTION) do
    @retry = true
  end
end
set_defaults() click to toggle source
Calls superclass method S3ToolParameters#set_defaults
# File lib/ec2/amitools/downloadbundleparameters.rb, line 76
def set_defaults()
  super()
  @directory = Dir::pwd() unless @directory
  @prefix = @manifest.split('.')[0..-2].join('.') if (@manifest)
  @prefix = 'image' unless @prefix
  @manifest = "#{@prefix}.manifest.xml" unless @manifest
end
validate_params() click to toggle source
Calls superclass method S3ToolParameters#validate_params
# File lib/ec2/amitools/downloadbundleparameters.rb, line 68
def validate_params()
  super()
  raise MissingMandatory.new('--privatekey') unless @privatekey
  raise InvalidCombination.new('--prefix', '--manifest') if (@prefix and @manifest)
end