class AwsCli::CLI::Sss::Directories
Public Instance Methods
method_option :x_amz_acl, :aliases => “-x”, :type => :string, :desc => “Permissions, must be in [‘private’, ‘public-read’, ‘public-read-write’, ‘authenticated-read’]”
# File lib/awscli/cli/s3/directories.rb, line 17 def create create_s3_object @s3.create options[:bucket], options[:public] end
# File lib/awscli/cli/s3/directories.rb, line 24 def delete create_s3_object @s3.delete options[:bucket] end
# File lib/awscli/cli/s3/directories.rb, line 31 def delete_rec create_s3_object @s3.delete_rec options[:bucket] end
# File lib/awscli/cli/s3/directories.rb, line 46 def get_acl create_s3_object @s3.get_acl options[:bucket] end
# File lib/awscli/cli/s3/directories.rb, line 53 def get_logging_status create_s3_object @s3.get_logging_status options[:bucket] end
# File lib/awscli/cli/s3/directories.rb, line 8 def list create_s3_object @s3.list end
# File lib/awscli/cli/s3/directories.rb, line 39 def set_acl create_s3_object @s3.set_acl options[:bucket], options[:acl] end
Private Instance Methods
desc “set_logging_status”, “Change logging status for an S3
bucket” method_option :bucket, :aliases => “-b”, :type => :string, :required => true, :desc => “name of the bucket” method_option :owner, :aliases => “-o”, :type => :hash, :banner => “ID:NAME”, :desc => “set id and displayname of the owner” method_option :grantee, :aliases => “-g”, :type => :hash, :banner => “NAME:ID|EMAIL|URI”, :desc => “Grantee hash containing, <Display name of the grantee>: <ID of the grantee (or) Email of the grantee (or) Uri of the group to grant access>” method_option :permission, :aliases => “-p”, :type => :string, :desc => “Permission, in [FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP]” def set_logging_status
create_s3_object (acl ||= []) << options[:grantee] if options[:grantee] acl << options[:permission] if options[:permission] logging_status = Hash.new logging_status['Owner'] = options[:owner] if options[:owner] logging_status['AccessControlList'] = acl if acl puts "Empty logging_status will disable logging" if logging_status.nil? puts "#{logging_status}" @s3.set_logging_status options[:bucket], logging_status
end
# File lib/awscli/cli/s3/directories.rb, line 77 def create_s3_object puts "S3 Establishing Connetion..." $s3_conn = Awscli::Connection.new.request_s3 puts "S3 Establishing Connetion... OK" @s3 = Awscli::S3::Directories.new($s3_conn) end