class UploadBundleParameters

Constants

ACL_DESCRIPTION
DIRECTORY_DESCRIPTION
LOCATION_DESCRIPTION
MANIFEST_DESCRIPTION
PART_DESCRIPTION
RETRY_DESCRIPTION
SKIP_MANIFEST_DESCRIPTION

Attributes

acl[RW]
directory[RW]
location[RW]
manifest[RW]
part[RW]
retry[RW]
skipmanifest[RW]

Public Instance Methods

mandatory_params() click to toggle source
Calls superclass method S3ToolParameters#mandatory_params
# File lib/ec2/amitools/uploadbundleparameters.rb, line 38
def mandatory_params()
  super()
  
  on('-m', '--manifest PATH', String, MANIFEST_DESCRIPTION) do |manifest|
    assert_file_exists(manifest, '--manifest')
    @manifest = manifest
  end
end
optional_params() click to toggle source
Calls superclass method S3ToolParameters#optional_params
# File lib/ec2/amitools/uploadbundleparameters.rb, line 49
def optional_params()
  super()
  
  on('--acl ACL', String, *ACL_DESCRIPTION) do |acl|
    assert_option_in(acl, ['public-read', 'aws-exec-read'], '--acl')
    @acl = acl
  end
  
  on('-d', '--directory DIRECTORY', String, *DIRECTORY_DESCRIPTION) do |directory|
    assert_directory_exists(directory, '--directory')
    @directory = directory
  end
  
  on('--part PART', Integer, PART_DESCRIPTION) do |part|
    @part = part
  end
  
  on('--retry', RETRY_DESCRIPTION) do
    @retry = true
  end
  
  on('--skipmanifest', SKIP_MANIFEST_DESCRIPTION) do
    @skipmanifest = true
  end
  
  on('--location LOCATION', LOCATION_DESCRIPTION) do |location|
    assert_option_in(location, AwsRegion.s3_locations, '--location')
    @location = case location
      when "eu-west-1" then "EU"
      when "US" then :unconstrained
      else location
    end
  end
end
set_defaults() click to toggle source
Calls superclass method S3ToolParameters#set_defaults
# File lib/ec2/amitools/uploadbundleparameters.rb, line 93
def set_defaults()
  super()
  @acl ||= 'aws-exec-read'
  @directory ||= File::dirname(@manifest)
  # If no location is given, set it equal to the region.
  # For legacy reasons if no location is given the location is set to US
  # If the region is us-east-1, we must not set the location. By not setting
  # the location S3 will default to the correct US location (which can't be
  # specified).
  if @region && !@location && !(@region == 'us-east-1')
    STDERR.puts "No location specified, setting location to conform with region: #{@region}"
    @location = @region
  end
end
validate_params() click to toggle source
Calls superclass method S3ToolParameters#validate_params
# File lib/ec2/amitools/uploadbundleparameters.rb, line 86
def validate_params()
  super()
  raise MissingMandatory.new('--manifest') unless @manifest
end