class Swa::CLI::S3Command

Public Instance Methods

aws_bucket() click to toggle source
# File lib/swa/cli/s3_command.rb, line 22
def aws_bucket
  s3.bucket(bucket_name)
end
bucket() click to toggle source
# File lib/swa/cli/s3_command.rb, line 26
def bucket
  Swa::S3::Bucket.new(aws_bucket)
end
bucket_name=(arg) click to toggle source
# File lib/swa/cli/s3_command.rb, line 30
def bucket_name=(arg)
  @bucket_name = arg.sub(%r{^s3://}, "")
end
collection() click to toggle source
# File lib/swa/cli/s3_command.rb, line 165
def collection
  query_for(:buckets, Swa::S3::Bucket)
end
default_payload() click to toggle source
# File lib/swa/cli/s3_command.rb, line 60
def default_payload
  $stdin.read
end
execute() click to toggle source
# File lib/swa/cli/s3_command.rb, line 44
def execute
  IO.copy_stream(object.get_body, $stdout)
end
object() click to toggle source
# File lib/swa/cli/s3_command.rb, line 87
def object
  Swa::S3::Object.new(aws_bucket.object(object_key))
end
objects() click to toggle source
# File lib/swa/cli/s3_command.rb, line 134
def objects
  bucket.objects(:prefix => prefix)
end

Protected Instance Methods

query_for(query_method, resource_model) click to toggle source
# File lib/swa/cli/s3_command.rb, line 177
def query_for(query_method, resource_model)
  aws_resources = s3.public_send(query_method)
  resource_model.list(aws_resources)
end
s3() click to toggle source
# File lib/swa/cli/s3_command.rb, line 173
def s3
  ::Aws::S3::Resource.new(aws_config)
end