mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
removed references to s3; removed unimplemented requests
This commit is contained in:
parent
a21c59bbc5
commit
42d452f567
23 changed files with 21 additions and 333 deletions
|
@ -5,7 +5,7 @@ module Fog
|
|||
|
||||
require 'fog/google/parsers/storage/copy_object'
|
||||
|
||||
# Copy an object from one S3 bucket to another
|
||||
# Copy an object from one Google Storage bucket to another
|
||||
#
|
||||
# ==== Parameters
|
||||
# * source_bucket_name<~String> - Name of source bucket
|
||||
|
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class Storage
|
||||
class Real
|
||||
|
||||
# Delete an S3 bucket
|
||||
# Delete an Google Storage bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - name of bucket to delete
|
||||
|
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class Storage
|
||||
class Real
|
||||
|
||||
# Delete an object from S3
|
||||
# Delete an object from Google Storage
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - Name of bucket containing object to delete
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
|
||||
require 'fog/google/parsers/storage/get_bucket'
|
||||
|
||||
# List information about objects in an S3 bucket
|
||||
# List information about objects in an Google Storage bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - name of bucket to list object keys from
|
||||
|
|
|
@ -5,7 +5,7 @@ module Fog
|
|||
|
||||
require 'fog/google/parsers/storage/access_control_list'
|
||||
|
||||
# Get access control list for an S3 bucket
|
||||
# Get access control list for an Google Storage bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - name of bucket to get access control list for
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
module Fog
|
||||
module Google
|
||||
class Storage
|
||||
class Real
|
||||
|
||||
require 'fog/google/parsers/storage/get_bucket_logging'
|
||||
|
||||
# Get logging status for an S3 bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - name of bucket to get logging status for
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'BucketLoggingStatus'<~Hash>: (will be empty if logging is disabled)
|
||||
# * 'LoggingEnabled'<~Hash>:
|
||||
# * 'TargetBucket'<~String> - bucket where logs are stored
|
||||
# * 'TargetPrefix'<~String> - prefix logs are stored with
|
||||
# * 'TargetGrants'<~Array>:
|
||||
# * 'Grant'<~Hash>:
|
||||
# * 'Grantee'<~Hash>:
|
||||
# * 'DisplayName'<~String> - Display name of grantee
|
||||
# * 'ID'<~String> - Id of grantee
|
||||
# or
|
||||
# * 'URI'<~String> - URI of group to grant access for
|
||||
# * 'Permission'<~String> - Permission, in [FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP]
|
||||
#
|
||||
def get_bucket_logging(bucket_name)
|
||||
unless bucket_name
|
||||
raise ArgumentError.new('bucket_name is required')
|
||||
end
|
||||
request({
|
||||
:expects => 200,
|
||||
:headers => {},
|
||||
:host => "#{bucket_name}.#{@host}",
|
||||
:idempotent => true,
|
||||
:method => 'GET',
|
||||
:parser => Fog::Parsers::Google::Storage::GetBucketLogging.new,
|
||||
:query => {'logging' => nil}
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def get_bucket_logging(bucket_name)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,80 +0,0 @@
|
|||
module Fog
|
||||
module Google
|
||||
class Storage
|
||||
class Real
|
||||
|
||||
require 'fog/google/parsers/storage/get_bucket_object_versions'
|
||||
|
||||
# List information about object versions in an S3 bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - name of bucket to list object keys from
|
||||
# * options<~Hash> - config arguments for list. Defaults to {}.
|
||||
# * 'delimiter'<~String> - causes keys with the same string between the prefix
|
||||
# value and the first occurence of delimiter to be rolled up
|
||||
# * 'key-marker'<~String> - limits object keys to only those that appear
|
||||
# lexicographically after its value.
|
||||
# * 'max-keys'<~Integer> - limits number of object keys returned
|
||||
# * 'prefix'<~String> - limits object keys to those beginning with its value.
|
||||
# * 'version-id-marker'<~String> - limits object versions to only those that
|
||||
# appear lexicographically after its value
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'Delimeter'<~String> - Delimiter specified for query
|
||||
# * 'KeyMarker'<~String> - Key marker specified for query
|
||||
# * 'MaxKeys'<~Integer> - Maximum number of keys specified for query
|
||||
# * 'Name'<~String> - Name of the bucket
|
||||
# * 'Prefix'<~String> - Prefix specified for query
|
||||
# * 'VersionIdMarker'<~String> - Version id marker specified for query
|
||||
# * 'IsTruncated'<~Boolean> - Whether or not this is the totality of the bucket
|
||||
# * 'Versions'<~Array>:
|
||||
# * 'DeleteMarker'<~Hash>:
|
||||
# * 'IsLatest'<~Boolean> - Whether or not this is the latest version
|
||||
# * 'Key'<~String> - Name of object
|
||||
# * 'LastModified'<~String>: Timestamp of last modification of object
|
||||
# * 'Owner'<~Hash>:
|
||||
# * 'DisplayName'<~String> - Display name of object owner
|
||||
# * 'ID'<~String> - Id of object owner
|
||||
# * 'VersionId'<~String> - The id of this version
|
||||
# or
|
||||
# * 'Version'<~Hash>:
|
||||
# * 'ETag'<~String>: Etag of object
|
||||
# * 'IsLatest'<~Boolean> - Whether or not this is the latest version
|
||||
# * 'Key'<~String> - Name of object
|
||||
# * 'LastModified'<~String>: Timestamp of last modification of object
|
||||
# * 'Owner'<~Hash>:
|
||||
# * 'DisplayName'<~String> - Display name of object owner
|
||||
# * 'ID'<~String> - Id of object owner
|
||||
# * 'Size'<~Integer> - Size of object
|
||||
# * 'StorageClass'<~String> - Storage class of object
|
||||
# * 'VersionId'<~String> - The id of this version
|
||||
#
|
||||
def get_bucket_object_versions(bucket_name, options = {})
|
||||
unless bucket_name
|
||||
raise ArgumentError.new('bucket_name is required')
|
||||
end
|
||||
request({
|
||||
:expects => 200,
|
||||
:headers => {},
|
||||
:host => "#{bucket_name}.#{@host}",
|
||||
:idempotent => true,
|
||||
:method => 'GET',
|
||||
:parser => Fog::Parsers::Google::Storage::GetBucketObjectVersions.new,
|
||||
:query => {'versions' => nil}.merge!(options)
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def get_bucket_object_versions(bucket_name, options = {})
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,45 +0,0 @@
|
|||
module Fog
|
||||
module Google
|
||||
class Storage
|
||||
class Real
|
||||
|
||||
require 'fog/google/parsers/storage/get_bucket_versioning'
|
||||
|
||||
# Get versioning status for an S3 bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - name of bucket to get versioning status for
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'VersioningConfiguration'<~Hash>
|
||||
# * Status<~String>: Versioning status in ['Enabled', 'Suspended', nil]
|
||||
#
|
||||
def get_bucket_versioning(bucket_name)
|
||||
unless bucket_name
|
||||
raise ArgumentError.new('bucket_name is required')
|
||||
end
|
||||
request({
|
||||
:expects => 200,
|
||||
:headers => {},
|
||||
:host => "#{bucket_name}.#{@host}",
|
||||
:idempotent => true,
|
||||
:method => 'GET',
|
||||
:parser => Fog::Parsers::Google::Storage::GetBucketVersioning.new,
|
||||
:query => {'versioning' => nil}
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def get_bucket_versioning(bucket_name)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class Storage
|
||||
class Real
|
||||
|
||||
# Get an object from S3
|
||||
# Get an object from Google Storage
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - Name of bucket to read from
|
||||
|
|
|
@ -5,7 +5,7 @@ module Fog
|
|||
|
||||
require 'fog/google/parsers/storage/access_control_list'
|
||||
|
||||
# Get access control list for an S3 object
|
||||
# Get access control list for an Google Storage object
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - name of bucket containing object
|
||||
|
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class Storage
|
||||
class Real
|
||||
|
||||
# Get torrent for an S3 object
|
||||
# Get torrent for an Google Storage object
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - name of bucket containing object
|
||||
|
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class Storage
|
||||
class Real
|
||||
|
||||
# Get an expiring object url from S3
|
||||
# Get an expiring object url from Google Storage
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - Name of bucket containing object
|
||||
|
|
|
@ -5,7 +5,7 @@ module Fog
|
|||
|
||||
require 'fog/google/parsers/storage/get_service'
|
||||
|
||||
# List information about S3 buckets for authorized user
|
||||
# List information about Google Storage buckets for authorized user
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
|
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class Storage
|
||||
class Real
|
||||
|
||||
# Get headers for an object from S3
|
||||
# Get headers for an object from Google Storage
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - Name of bucket to read from
|
||||
|
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class Storage
|
||||
class Real
|
||||
|
||||
# Create an S3 bucket
|
||||
# Create an Google Storage bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - name of bucket to create
|
||||
|
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class Storage
|
||||
class Real
|
||||
|
||||
# Change access control list for an S3 bucket
|
||||
# Change access control list for an Google Storage bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - name of bucket to modify
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
module Fog
|
||||
module Google
|
||||
class Storage
|
||||
class Real
|
||||
|
||||
# Change logging status for an S3 bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - name of bucket to modify
|
||||
# * logging_status<~Hash>:
|
||||
# * Owner<~Hash>:
|
||||
# * ID<~String>: id of owner
|
||||
# * DisplayName<~String>: display name of owner
|
||||
# * AccessControlList<~Array>:
|
||||
# * Grantee<~Hash>:
|
||||
# * 'DisplayName'<~String> - Display name of grantee
|
||||
# * 'ID'<~String> - Id of grantee
|
||||
# or
|
||||
# * 'EmailAddress'<~String> - Email address of grantee
|
||||
# or
|
||||
# * 'URI'<~String> - URI of group to grant access for
|
||||
# * Permission<~String> - Permission, in [FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP]
|
||||
def put_bucket_logging(bucket_name, logging_status)
|
||||
if logging_status['LoggingEnabled'].empty?
|
||||
data =
|
||||
<<-DATA
|
||||
<BucketLoggingStatus xmlns="http://doc.s3.amazongoogle.com/2006-03-01" />
|
||||
DATA
|
||||
else
|
||||
data =
|
||||
<<-DATA
|
||||
<BucketLoggingStatus xmlns="http://doc.s3.amazongoogle.com/2006-03-01">
|
||||
<LoggingEnabled>
|
||||
<TargetBucket>#{logging_status['LoggingEnabled']['TargetBucket']}</TargetBucket>
|
||||
<TargetPrefix>#{logging_status['LoggingEnabled']['TargetBucket']}</TargetPrefix>
|
||||
<TargetGrants>
|
||||
DATA
|
||||
|
||||
acl['AccessControlList'].each do |grant|
|
||||
data << " <Grant>"
|
||||
type = case grant['Grantee'].keys.sort
|
||||
when ['DisplayName', 'ID']
|
||||
'CanonicalUser'
|
||||
when ['EmailAddress']
|
||||
'AmazonCustomerByEmail'
|
||||
when ['URI']
|
||||
'Group'
|
||||
end
|
||||
data << " <Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"#{type}\">"
|
||||
for key, value in grant['Grantee']
|
||||
data << " <#{key}>#{value}</#{key}>"
|
||||
end
|
||||
data << " </Grantee>"
|
||||
data << " <Permission>#{grant['Permission']}</Permission>"
|
||||
data << " </Grant>"
|
||||
end
|
||||
|
||||
data <<
|
||||
<<-DATA
|
||||
</TargetGrants>
|
||||
</LoggingEnabled>
|
||||
</BucketLoggingStatus>
|
||||
DATA
|
||||
end
|
||||
|
||||
request({
|
||||
:body => data,
|
||||
:expects => 200,
|
||||
:headers => {},
|
||||
:host => "#{bucket_name}.#{@host}",
|
||||
:method => 'PUT',
|
||||
:query => {'logging' => nil}
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def put_bucket_logging(bucket_name, logging_status)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,40 +0,0 @@
|
|||
module Fog
|
||||
module Google
|
||||
class Storage
|
||||
class Real
|
||||
|
||||
# Change versioning status for an S3 bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - name of bucket to modify
|
||||
# * status<~String> - Status to change to in ['Enabled', 'Suspended']
|
||||
def put_bucket_versioning(bucket_name, status)
|
||||
data =
|
||||
<<-DATA
|
||||
<VersioningConfiguration xmlns="http://s3.amazongoogle.com/doc/2006-03-01/">
|
||||
<Status>#{status}</Status>
|
||||
</VersioningConfiguration>
|
||||
DATA
|
||||
|
||||
request({
|
||||
:body => data,
|
||||
:expects => 200,
|
||||
:headers => {},
|
||||
:host => "#{bucket_name}.#{@host}",
|
||||
:method => 'PUT',
|
||||
:query => {'versioning' => nil}
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def put_bucket_versioning(bucket_name, status)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class Storage
|
||||
class Real
|
||||
|
||||
# Create an object in an S3 bucket
|
||||
# Create an object in an Google Storage bucket
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - Name of bucket to create object in
|
||||
|
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class Storage
|
||||
class Real
|
||||
|
||||
# Get an expiring object url from S3 for putting an object
|
||||
# Get an expiring object url from Google Storage for putting an object
|
||||
#
|
||||
# ==== Parameters
|
||||
# * bucket_name<~String> - Name of bucket containing object
|
||||
|
|
|
@ -16,9 +16,6 @@ module Fog
|
|||
request :delete_object
|
||||
request :get_bucket
|
||||
request :get_bucket_acl
|
||||
request :get_bucket_logging
|
||||
request :get_bucket_object_versions
|
||||
request :get_bucket_versioning
|
||||
request :get_object
|
||||
request :get_object_acl
|
||||
request :get_object_torrent
|
||||
|
@ -27,8 +24,6 @@ module Fog
|
|||
request :head_object
|
||||
request :put_bucket
|
||||
request :put_bucket_acl
|
||||
request :put_bucket_logging
|
||||
request :put_bucket_versioning
|
||||
request :put_object
|
||||
request :put_object_url
|
||||
|
||||
|
@ -98,14 +93,14 @@ module Fog
|
|||
extend Fog::Deprecation
|
||||
deprecate(:reset, :reload)
|
||||
|
||||
# Initialize connection to S3
|
||||
# Initialize connection to Google Storage
|
||||
#
|
||||
# ==== Notes
|
||||
# options parameter must include values for :google_storage_access_key_id and
|
||||
# :google_storage_secret_access_key in order to create a connection
|
||||
#
|
||||
# ==== Examples
|
||||
# s3 = S3.new(
|
||||
# google_storage = Storage.new(
|
||||
# :google_storage_access_key_id => your_google_storage_access_key_id,
|
||||
# :google_storage_secret_access_key => your_google_storage_secret_access_key
|
||||
# )
|
||||
|
@ -114,7 +109,7 @@ module Fog
|
|||
# * options<~Hash> - config arguments for connection. Defaults to {}.
|
||||
#
|
||||
# ==== Returns
|
||||
# * S3 object with connection to google.
|
||||
# * Storage object with connection to google.
|
||||
def initialize(options={})
|
||||
@google_storage_access_key_id = options[:google_storage_access_key_id]
|
||||
@google_storage_secret_access_key = options[:google_storage_secret_access_key]
|
||||
|
@ -164,7 +159,7 @@ DATA
|
|||
|
||||
subdomain = params[:host].split(".#{@host}").first
|
||||
unless subdomain =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
|
||||
Formatador.display_line("[yellow][WARN] fog: the specified s3 bucket name(#{subdomain}) is not a valid dns name. See: http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?Introduction.html[/]")
|
||||
Formatador.display_line("[yellow][WARN] fog: the specified google storage bucket name(#{subdomain}) is not a valid dns name. See: http://code.google.com/apis/storage/docs/developer-guide.html#naming ")
|
||||
params[:host] = params[:host].split("#{subdomain}.")[-1]
|
||||
if params[:path]
|
||||
params[:path] = "#{subdomain}/#{params[:path]}"
|
||||
|
|
|
@ -14,7 +14,7 @@ describe 'Fog::Google::Storage::Directories' do
|
|||
|
||||
describe "#create" do
|
||||
|
||||
it "should exist on s3" do
|
||||
it "should exist on google storage" do
|
||||
directory = Google[:storage].directories.create(:key => 'fogdirectorykey')
|
||||
Google[:storage].directories.get(directory.key).should_not be_nil
|
||||
directory.destroy
|
||||
|
|
|
@ -63,7 +63,7 @@ describe 'Fog::Google::Storage::Files' do
|
|||
|
||||
describe "#create" do
|
||||
|
||||
it "should exist on s3" do
|
||||
it "should exist on google storage" do
|
||||
data = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
||||
file = @directory.files.create(:key => 'fogfilename', :body => data)
|
||||
@directory.files.get('fogfilename').should_not be_nil
|
||||
|
|
Loading…
Reference in a new issue