Module: AWS::S3::Client::XML

Defined in:
lib/aws/s3/client/xml.rb

Constant Summary collapse

BaseGrammar =
Core::XML::Grammar.new({}, :inflect_rename => true)
ListBuckets =
BaseGrammar.customize do
  element "Buckets" do
    list "Bucket"
  end
end
GetBucketAcl =
GetObjectAcl = BaseGrammar.customize do
  element "AccessControlList" do
    ignore
    element "Grant" do
      rename :grants
      list
      element "Grantee" do
        element "ID" do
          rename :canonical_user_id
        end
      end
      element "Permission" do
        symbol_value
      end
    end
  end
end
ListObjects =
BaseGrammar.customize do

  element("Name") { rename :bucket_name }
  element("MaxKeys") { integer_value }
  element("IsTruncated") { rename :truncated; boolean_value }
  element("Delimiter") { force }

  element("Contents") do
    list
    element("Owner") do
      element("ID") { }
      element("DisplayName") { }
    end
    element("Key") { }
    element("Size") { }
    element("StorageClass") { }
    element("ETag") { rename :etag }

    element("LastModified") { time_value }
  end

  element "CommonPrefixes" do
    collect_values
  end

end
GetBucketVersioning =
BaseGrammar.customize do
  default_value :status, :unversioned
  element("Status") do
    symbol_value
  end
end
ListObjectVersions =
BaseGrammar.customize do

  element("MaxKeys") { integer_value }
  element("IsTruncated") { rename :truncated; boolean_value }
  element("NextKeyMarker") { force }
  element("NextVersionIdMarker") { force }

  %w(DeleteMarker Version).each do |element_name|
    element(element_name) do
      collect_values
      rename(:versions)
      element("IsLatest") { rename :latest; boolean_value }
      element("LastModified") { datetime_value }
      element("ETag") { rename :etag }
      element("Size") { integer_value }
      element("StorageClass") { symbol_value }
    end
  end

  element "DeleteMarker" do
    default_value(:delete_marker, true)
    default_value(:version, false)
  end

  element "Version" do
    default_value(:delete_marker, false)
    default_value(:version, true)
  end

  element "CommonPrefixes" do
    collect_values
  end

end
InitiateMultipartUpload =
BaseGrammar.customize do
  element("UploadId") { force }
end
ListMultipartUploads =
BaseGrammar.customize do

  element("IsTruncated") { rename :truncated; boolean_value }
  element("MaxUploads") { integer_value }
  element("NextKeyMarker") { force }
  element("NextUploadIdMarker") { force }
  element("Upload") do
    collect_values
    rename :uploads
    element("StorageClass") { symbol_value }
    element("Initiated") { datetime_value }
  end

  element "CommonPrefixes" do
    collect_values
  end

end
DeleteObjects =
BaseGrammar.customize do
  element("Deleted") do
    element("DeleteMarker") { boolean_value }
    list
  end
  element("Error") { list; rename(:errors) }  
end
CompleteMultipartUpload =
BaseGrammar.customize
ListParts =
BaseGrammar.customize do
  element("StorageClass") { symbol_value }
  element("IsTruncated") { rename :truncated; boolean_value }
  element("MaxParts") { integer_value }
  element("PartNumberMarker") { integer_value }
  element("NextPartNumberMarker") { integer_value }
  element("Part") do
    collect_values
    rename :parts
    element("PartNumber") { integer_value }
    element("LastModified") { datetime_value }
    element("Size") { integer_value }
  end
end
GetBucketLifecycleConfiguration =
BaseGrammar.customize do
  element("Rule") do
    list
    rename(:rules)  
    element("Expiration") do
      element("Days") { integer_value }
    end
  end
end