module BaseCommands
Public Instance Methods
Enable/disable bucket access logging
# File lib/dsl/commands/base_commands.rb, line 171 def accesslog(bucket = nil) @commands[:accesslog] = @bucket || bucket self end
Make a copy of a file (cp) or move a file (mv). Destination can be in the same bucket with a dif‐ ferent name or in another bucket with the same or different name. Adding –acl-public will make the destination object publicly accessible (see below).
# File lib/dsl/commands/base_commands.rb, line 135 def cp(src_bucket, dest_bucket) # s3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2] @commands[:cp] = "#{src_bucket} #{dest_bucket}" self end
Delete file from bucket
# File lib/dsl/commands/base_commands.rb, line 112 def del(object = nil) # s3://BUCKET/OBJECT @commands[:del] = @bucket || object self end
Disk usage - amount of data stored in S3
# File lib/dsl/commands/base_commands.rb, line 164 def du(bucket = nil) # [s3://BUCKET[/PREFIX]] @commands[:du] = @bucket || bucket self end
Fix invalid file names in a bucket
# File lib/dsl/commands/base_commands.rb, line 185 def fixbucket(bucket = nil) @commands[:fixbucket] = @bucket || bucket self end
Get file from bucket (i.e. download from S3)
# File lib/dsl/commands/base_commands.rb, line 102 def get(object = nil, files = nil) # s3://BUCKET/OBJECT LOCAL_FILE get_files = @files || files get_object = @bucket || object @commands[:get] = "#{get_object} #{get_files}" self end
Get various information about a Bucket or Object
# File lib/dsl/commands/base_commands.rb, line 158 def info(bucket = nil) # s3://BUCKET[/OBJECT] @commands[:info] = @bucket || bucket self end
List all object in all buckets
# File lib/dsl/commands/base_commands.rb, line 84 def la @commands[:la] = '' self end
List objects or buckets
# File lib/dsl/commands/base_commands.rb, line 76 def ls(bucket = nil) # s3://BUCKET[/PREFIX]] @commands[:ls] = bucket || @bucket self end
Make bucket
# File lib/dsl/commands/base_commands.rb, line 57 def mb(bucket = nil) # s3://BUCKET @commands[:mb] = bucket || @bucket self end
Make a copy of a file (cp) or move a file (mv). Destination can be in the same bucket with a dif‐ ferent name or in another bucket with the same or different name. Adding –acl-public will make the destination object publicly accessible (see below).
# File lib/dsl/commands/base_commands.rb, line 144 def mv(src_bucket, dest_bucket) # s3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2] @commands[:mv] = "#{src_bucket} #{dest_bucket}" self end
Put file into bucket (i.e. upload to S3)
# File lib/dsl/commands/base_commands.rb, line 92 def put(files = nil, bucket = nil) # FILE [FILE...] s3://BUCKET[/PREFIX] put_files = @files || files put_bucket = @bucket || bucket @commands[:put] = "#{put_files} #{put_bucket}" self end
Remove bucket
# File lib/dsl/commands/base_commands.rb, line 67 def rb(bucket = nil) # s3://BUCKET @commands[:rb] = bucket || @bucket self end
Modify Access control list for Bucket or Files. Use with –acl-public or –acl-private
# File lib/dsl/commands/base_commands.rb, line 151 def setacl(bucket = nil) # s3://BUCKET[/OBJECT] @commands[:setacl] = @bucket || bucket self end
Sign arbitrary string using the secret key
# File lib/dsl/commands/base_commands.rb, line 178 def sign(string) @commands[:sign] = string self end
Backup a directory tree to S3 Restore a tree from S3 to local directory
# File lib/dsl/commands/base_commands.rb, line 124 def sync(src_object, dest_object) # LOCAL_DIR s3://BUCKET[/PREFIX] or s3://BUCKET[/PREFIX] LOCAL_DIR @commands[:sync] = "#{src_object} #{dest_object}" self end