Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 Invalidation #96

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Forked from appoxy
Added invalidation method for Cloudfront

# Appoxy AWS Library

A Ruby gem for all Amazon Web Services.
Expand Down
2 changes: 1 addition & 1 deletion VERSION.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
:major: 2
:minor: 4
:patch: 2
:patch: 3
:build:
6 changes: 3 additions & 3 deletions aws.gemspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec'
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{aws}
s.version = "2.4.2"
s.version = "2.4.3"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Travis Reeder", "Chad Arimura", "RightScale"]
s.date = %q{2011-01-21}
s.date = %q{2011-02-06}
s.description = %q{AWS Ruby Library for interfacing with Amazon Web Services including EC2, S3, SQS, SimpleDB and most of their other services as well. By http://www.appoxy.com}
s.email = %q{[email protected]}
s.extra_rdoc_files = [
Expand Down
25 changes: 25 additions & 0 deletions lib/acf/acf_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,31 @@ def list_streaming_distributions
request_hash = generate_request('GET', 'streaming-distribution')
request_cache_or_info :list_streaming_distributions, request_hash, AcfStreamingDistributionListParser, @@bench
end

# Invalidate list of files
# Returns the just created Invalidation or Aws::AwsError exception.
#
# acf.invalidate_files( 'distribution-id',
# ['path/to/file1', 'path/to/file2'],
# 'some-id-string')
#
def invalidate_files(distribution_id, files=[], caller_reference=nil)
caller_reference ||= generate_call_reference

files_str = ''
files.to_a.each { |file_path| files_str += "\n <Path>#{file_path}</Path>" }

body = <<-EOXML
<?xml version="1.0" encoding="UTF-8"?>
<InvalidationBatch>
#{files_str.lstrip}
<CallerReference>#{caller_reference}</CallerReference>
</InvalidationBatch>
EOXML

request_hash = generate_request('POST', "distribution/#{distribution_id}/invalidation", body.strip)
merge_headers(request_info(request_hash, AcfDistributionParser.new))
end

# Create a new distribution.
# Returns the just created distribution or Aws::AwsError exception.
Expand Down
4 changes: 2 additions & 2 deletions lib/awsbase/awsbase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ def generate_request2(aws_access_key, aws_secret_key, action, api_version, lib_p
request = Net::HTTP::Get.new("#{service}?#{service_params}")
end

#puts "\n\n --------------- QUERY REQUEST TO AWS -------------- \n\n"
#puts "#{@params[:service]}?#{service_params}\n\n"
puts "\n\n --------------- QUERY REQUEST TO AWS -------------- \n\n"
puts "#{@params[:service]}?#{service_params}\n\n"

# prepare output hash
{:request => request,
Expand Down