class Fog::AWS::Storage
Constants
- ACCELERATION_HOST
- ALLOWED_UPLOAD_PART_OPTIONS
From docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPartCopy.html
- COMPLIANT_BUCKET_NAMES
- DEFAULT_REGION
- DEFAULT_SCHEME
- DEFAULT_SCHEME_PORT
- MAX_SINGLE_PUT_SIZE
- MIN_MULTIPART_CHUNK_SIZE
- VALID_QUERY_KEYS
Private Class Methods
acl_to_hash(acl_xml)
click to toggle source
# File lib/fog/aws/requests/storage/acl_utils.rb, line 53 def self.acl_to_hash(acl_xml) parser = Fog::Parsers::AWS::Storage::AccessControlList.new Nokogiri::XML::SAX::Parser.new(parser).parse(acl_xml) parser.response end
cors_to_hash(cors_xml)
click to toggle source
# File lib/fog/aws/requests/storage/cors_utils.rb, line 32 def self.cors_to_hash(cors_xml) parser = Fog::Parsers::AWS::Storage::CorsConfiguration.new Nokogiri::XML::SAX::Parser.new(parser).parse(cors_xml) parser.response end
hash_to_acl(acl)
click to toggle source
# File lib/fog/aws/requests/storage/acl_utils.rb, line 7 def self.hash_to_acl(acl) data = "<AccessControlPolicy>\n" if acl['Owner'] && (acl['Owner']['ID'] || acl['Owner']['DisplayName']) data << " <Owner>\n" data << " <ID>#{acl['Owner']['ID']}</ID>\n" if acl['Owner']['ID'] data << " <DisplayName>#{acl['Owner']['DisplayName']}</DisplayName>\n" if acl['Owner']['DisplayName'] data << " </Owner>\n" end grants = [acl['AccessControlList']].flatten.compact data << " <AccessControlList>\n" if grants.any? grants.each do |grant| data << " <Grant>\n" grantee = grant['Grantee'] type = case when grantee.key?('ID') 'CanonicalUser' when grantee.key?('EmailAddress') 'AmazonCustomerByEmail' when grantee.key?('URI') 'Group' end data << " <Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"#{type}\">\n" case type when 'CanonicalUser' data << " <ID>#{grantee['ID']}</ID>\n" if grantee['ID'] data << " <DisplayName>#{grantee['DisplayName']}</DisplayName>\n" if grantee['DisplayName'] when 'AmazonCustomerByEmail' data << " <EmailAddress>#{grantee['EmailAddress']}</EmailAddress>\n" if grantee['EmailAddress'] when 'Group' data << " <URI>#{grantee['URI']}</URI>\n" if grantee['URI'] end data << " </Grantee>\n" data << " <Permission>#{grant['Permission']}</Permission>\n" data << " </Grant>\n" end data << " </AccessControlList>\n" if grants.any? data << "</AccessControlPolicy>" data end
hash_to_cors(cors)
click to toggle source
# File lib/fog/aws/requests/storage/cors_utils.rb, line 8 def self.hash_to_cors(cors) data = "<CORSConfiguration>\n" [cors['CORSConfiguration']].flatten.compact.each do |rule| data << " <CORSRule>\n" ['ID', 'MaxAgeSeconds'].each do |key| data << " <#{key}>#{rule[key]}</#{key}>\n" if rule[key] end ['AllowedOrigin', 'AllowedMethod', 'AllowedHeader', 'ExposeHeader'].each do |key| [rule[key]].flatten.compact.each do |value| data << " <#{key}>#{value}</#{key}>\n" end end data << " </CORSRule>\n" end data << "</CORSConfiguration>" data end