mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws] rename ec2/s3 to compute/storage
This commit is contained in:
parent
a5411d8cf9
commit
58577e17bf
119 changed files with 687 additions and 643 deletions
46
lib/fog/aws/parsers/storage/access_control_list.rb
Normal file
46
lib/fog/aws/parsers/storage/access_control_list.rb
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module Storage
|
||||
|
||||
class AccessControlList < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@in_access_control_list = false
|
||||
@grant = { 'Grantee' => {} }
|
||||
@response = { 'Owner' => {}, 'AccessControlList' => [] }
|
||||
end
|
||||
|
||||
def start_element(name, attrs = [])
|
||||
super
|
||||
if name == 'AccessControlList'
|
||||
@in_access_control_list = true
|
||||
end
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'AccessControlList'
|
||||
@in_access_control_list = false
|
||||
when 'Grant'
|
||||
@response['AccessControlList'] << @grant
|
||||
@grant = { 'Grantee' => {} }
|
||||
when 'DisplayName', 'ID'
|
||||
if @in_access_control_list
|
||||
@grant['Grantee'][name] = @value
|
||||
else
|
||||
@response['Owner'][name] = @value
|
||||
end
|
||||
when 'Permission'
|
||||
@grant[name] = @value
|
||||
when 'URI'
|
||||
@grant['Grantee'][name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
22
lib/fog/aws/parsers/storage/copy_object.rb
Normal file
22
lib/fog/aws/parsers/storage/copy_object.rb
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module Storage
|
||||
|
||||
class CopyObject < Fog::Parsers::Base
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'ETag'
|
||||
@response[name] = @value.gsub('"', '')
|
||||
when 'LastModified'
|
||||
@response[name] = Time.parse(@value)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
46
lib/fog/aws/parsers/storage/get_bucket.rb
Normal file
46
lib/fog/aws/parsers/storage/get_bucket.rb
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module Storage
|
||||
|
||||
class GetBucket < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@object = { 'Owner' => {} }
|
||||
@response = { 'Contents' => [] }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'Contents'
|
||||
@response['Contents'] << @object
|
||||
@object = { 'Owner' => {} }
|
||||
when 'DisplayName', 'ID'
|
||||
@object['Owner'][name] = @value
|
||||
when 'ETag'
|
||||
@object[name] = @value.gsub('"', '')
|
||||
when 'IsTruncated'
|
||||
if @value == 'true'
|
||||
@response['IsTruncated'] = true
|
||||
else
|
||||
@response['IsTruncated'] = false
|
||||
end
|
||||
when 'LastModified'
|
||||
@object['LastModified'] = Time.parse(@value)
|
||||
when 'Marker', 'Name', 'Prefix'
|
||||
@response[name] = @value
|
||||
when 'MaxKeys'
|
||||
@response['MaxKeys'] = @value.to_i
|
||||
when 'Size'
|
||||
@object['Size'] = @value.to_i
|
||||
when 'Delimeter', 'Key', 'Name', 'StorageClass'
|
||||
@object[name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
20
lib/fog/aws/parsers/storage/get_bucket_location.rb
Normal file
20
lib/fog/aws/parsers/storage/get_bucket_location.rb
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module Storage
|
||||
|
||||
class GetBucketLocation < Fog::Parsers::Base
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'LocationConstraint'
|
||||
@response[name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
40
lib/fog/aws/parsers/storage/get_bucket_logging.rb
Normal file
40
lib/fog/aws/parsers/storage/get_bucket_logging.rb
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module Storage
|
||||
|
||||
class AccessControlList < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@grant = { 'Grantee' => {} }
|
||||
@response = { 'BucketLoggingStatus' => {} }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'DisplayName', 'ID'
|
||||
if @in_access_control_list
|
||||
@grant['Grantee'][name] = @value
|
||||
else
|
||||
@response['Owner'][name] = @value
|
||||
end
|
||||
when 'Grant'
|
||||
@response['BucketLoggingStatus']['LoggingEnabled']['TargetGrants'] << @grant
|
||||
@grant = { 'Grantee' => {} }
|
||||
when 'LoggingEnabled'
|
||||
@response['BucketLoggingStatus']['LoggingEnabled'] = { 'TargetGrants' => [] }
|
||||
when 'Permission'
|
||||
@grant[name] = @value
|
||||
when 'TargetBucket', 'TargetPrefix'
|
||||
@response['BucketLoggingStatus'][name] = @value
|
||||
when 'URI'
|
||||
@grant['Grantee'][name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
88
lib/fog/aws/parsers/storage/get_bucket_object_versions.rb
Normal file
88
lib/fog/aws/parsers/storage/get_bucket_object_versions.rb
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module Storage
|
||||
|
||||
class GetBucketObjectVersions < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@delete_marker = { 'Owner' => {} }
|
||||
@version = { 'Owner' => {} }
|
||||
|
||||
@in_delete_marke = false
|
||||
@in_version = false
|
||||
|
||||
@response = { 'Versions' => [] }
|
||||
end
|
||||
|
||||
def start_element(name, attrs = [])
|
||||
super
|
||||
case name
|
||||
when 'DeleteMarker'
|
||||
@in_delete_marker = true
|
||||
when 'Version'
|
||||
@in_version = true
|
||||
end
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'DeleteMarker'
|
||||
@response['Versions'] << {'DeleteMarker' => @delete_marker }
|
||||
@delete_marker = { 'Owner' => {} }
|
||||
@in_delete_marker = false
|
||||
when 'Version'
|
||||
@response['Versions'] << {'Version' => @version }
|
||||
@version = { 'Owner' => {} }
|
||||
@in_version = false
|
||||
when 'DisplayName', 'ID'
|
||||
if @in_delete_marker
|
||||
@delete_marker
|
||||
elsif @in_version
|
||||
@version
|
||||
end['Owner'][name] = @value
|
||||
when 'ETag'
|
||||
@version[name] = @value.gsub('"', '')
|
||||
when 'IsLatest'
|
||||
if @in_delete_marker
|
||||
@delete_marker
|
||||
elsif @in_version
|
||||
@version
|
||||
end['IsLatest'] = if @value == 'true'
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when 'IsTruncated'
|
||||
if @value == 'true'
|
||||
@response['IsTruncated'] = true
|
||||
else
|
||||
@response['IsTruncated'] = false
|
||||
end
|
||||
when 'LastModified'
|
||||
if @in_delete_marker
|
||||
@delete_marker
|
||||
elsif @in_version
|
||||
@version
|
||||
end['LastModified'] = Time.parse(@value)
|
||||
when 'KeyMarker', 'Name', 'Prefix', 'VersionIdMarker'
|
||||
@response[name] = @value
|
||||
when 'MaxKeys'
|
||||
@response['MaxKeys'] = @value.to_i
|
||||
when 'Size'
|
||||
@version['Size'] = @value.to_i
|
||||
when 'Key', 'Name', 'StorageClass', 'VersionId'
|
||||
if @in_delete_marker
|
||||
@delete_marker
|
||||
elsif @in_version
|
||||
@version
|
||||
end[name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
24
lib/fog/aws/parsers/storage/get_bucket_versioning.rb
Normal file
24
lib/fog/aws/parsers/storage/get_bucket_versioning.rb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module Storage
|
||||
|
||||
class GetBucketVersioning < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@response = { 'VersioningConfiguration' => {} }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'Status'
|
||||
@response['VersioningConfiguration'][name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
20
lib/fog/aws/parsers/storage/get_request_payment.rb
Normal file
20
lib/fog/aws/parsers/storage/get_request_payment.rb
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module Storage
|
||||
|
||||
class GetRequestPayment < Fog::Parsers::Base
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'Payer'
|
||||
@response[name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
32
lib/fog/aws/parsers/storage/get_service.rb
Normal file
32
lib/fog/aws/parsers/storage/get_service.rb
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module Storage
|
||||
|
||||
class GetService < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@bucket = {}
|
||||
@response = { 'Owner' => {}, 'Buckets' => [] }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'Bucket'
|
||||
@response['Buckets'] << @bucket
|
||||
@bucket = {}
|
||||
when 'CreationDate'
|
||||
@bucket['CreationDate'] = Time.parse(@value)
|
||||
when 'DisplayName', 'ID'
|
||||
@response['Owner'][name] = @value
|
||||
when 'Name'
|
||||
@bucket[name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue