fog 1.40.0 → 1.41.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/CHANGELOG.md +30 -0
- data/fog.gemspec +6 -4
- data/lib/fog/ovirt/compute.rb +2 -0
- data/lib/fog/ovirt/models/compute/server.rb +7 -2
- data/lib/fog/ovirt/requests/compute/activate_volume.rb +22 -0
- data/lib/fog/ovirt/requests/compute/deactivate_volume.rb +22 -0
- data/lib/fog/version.rb +1 -1
- data/lib/tasks/changelog_task.rb +2 -1
- data/tests/compute/helper.rb +0 -3
- data/tests/helpers/mock_helper.rb +0 -2
- data/tests/storage/helper.rb +0 -3
- metadata +49 -224
- data/lib/fog/bin/internet_archive.rb +0 -32
- data/lib/fog/bin/joyent.rb +0 -33
- data/lib/fog/internet_archive.rb +0 -1
- data/lib/fog/internet_archive/core.rb +0 -291
- data/lib/fog/internet_archive/models/storage/directories.rb +0 -39
- data/lib/fog/internet_archive/models/storage/directory.rb +0 -105
- data/lib/fog/internet_archive/models/storage/file.rb +0 -254
- data/lib/fog/internet_archive/models/storage/files.rb +0 -119
- data/lib/fog/internet_archive/models/storage/ia_attributes.rb +0 -36
- data/lib/fog/internet_archive/parsers/storage/access_control_list.rb +0 -42
- data/lib/fog/internet_archive/parsers/storage/complete_multipart_upload.rb +0 -20
- data/lib/fog/internet_archive/parsers/storage/copy_object.rb +0 -18
- data/lib/fog/internet_archive/parsers/storage/cors_configuration.rb +0 -38
- data/lib/fog/internet_archive/parsers/storage/delete_multiple_objects.rb +0 -45
- data/lib/fog/internet_archive/parsers/storage/get_bucket.rb +0 -58
- data/lib/fog/internet_archive/parsers/storage/get_bucket_lifecycle.rb +0 -64
- data/lib/fog/internet_archive/parsers/storage/get_bucket_location.rb +0 -16
- data/lib/fog/internet_archive/parsers/storage/get_bucket_logging.rb +0 -36
- data/lib/fog/internet_archive/parsers/storage/get_bucket_website.rb +0 -22
- data/lib/fog/internet_archive/parsers/storage/get_request_payment.rb +0 -16
- data/lib/fog/internet_archive/parsers/storage/get_service.rb +0 -28
- data/lib/fog/internet_archive/parsers/storage/initiate_multipart_upload.rb +0 -20
- data/lib/fog/internet_archive/parsers/storage/list_multipart_uploads.rb +0 -52
- data/lib/fog/internet_archive/parsers/storage/list_parts.rb +0 -36
- data/lib/fog/internet_archive/requests/storage/abort_multipart_upload.rb +0 -27
- data/lib/fog/internet_archive/requests/storage/acl_utils.rb +0 -60
- data/lib/fog/internet_archive/requests/storage/complete_multipart_upload.rb +0 -46
- data/lib/fog/internet_archive/requests/storage/copy_object.rb +0 -77
- data/lib/fog/internet_archive/requests/storage/cors_utils.rb +0 -39
- data/lib/fog/internet_archive/requests/storage/delete_bucket.rb +0 -42
- data/lib/fog/internet_archive/requests/storage/delete_bucket_cors.rb +0 -26
- data/lib/fog/internet_archive/requests/storage/delete_bucket_lifecycle.rb +0 -26
- data/lib/fog/internet_archive/requests/storage/delete_bucket_policy.rb +0 -26
- data/lib/fog/internet_archive/requests/storage/delete_bucket_website.rb +0 -26
- data/lib/fog/internet_archive/requests/storage/delete_multiple_objects.rb +0 -88
- data/lib/fog/internet_archive/requests/storage/delete_object.rb +0 -46
- data/lib/fog/internet_archive/requests/storage/get_bucket.rb +0 -108
- data/lib/fog/internet_archive/requests/storage/get_bucket_acl.rb +0 -65
- data/lib/fog/internet_archive/requests/storage/get_bucket_cors.rb +0 -61
- data/lib/fog/internet_archive/requests/storage/get_bucket_lifecycle.rb +0 -35
- data/lib/fog/internet_archive/requests/storage/get_bucket_location.rb +0 -54
- data/lib/fog/internet_archive/requests/storage/get_bucket_logging.rb +0 -45
- data/lib/fog/internet_archive/requests/storage/get_bucket_policy.rb +0 -31
- data/lib/fog/internet_archive/requests/storage/get_bucket_website.rb +0 -38
- data/lib/fog/internet_archive/requests/storage/get_object.rb +0 -163
- data/lib/fog/internet_archive/requests/storage/get_object_acl.rb +0 -72
- data/lib/fog/internet_archive/requests/storage/get_object_http_url.rb +0 -48
- data/lib/fog/internet_archive/requests/storage/get_object_https_url.rb +0 -30
- data/lib/fog/internet_archive/requests/storage/get_object_torrent.rb +0 -45
- data/lib/fog/internet_archive/requests/storage/get_object_url.rb +0 -49
- data/lib/fog/internet_archive/requests/storage/get_request_payment.rb +0 -45
- data/lib/fog/internet_archive/requests/storage/get_service.rb +0 -50
- data/lib/fog/internet_archive/requests/storage/head_object.rb +0 -57
- data/lib/fog/internet_archive/requests/storage/initiate_multipart_upload.rb +0 -42
- data/lib/fog/internet_archive/requests/storage/list_multipart_uploads.rb +0 -52
- data/lib/fog/internet_archive/requests/storage/list_parts.rb +0 -53
- data/lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb +0 -36
- data/lib/fog/internet_archive/requests/storage/put_bucket.rb +0 -70
- data/lib/fog/internet_archive/requests/storage/put_bucket_acl.rb +0 -69
- data/lib/fog/internet_archive/requests/storage/put_bucket_cors.rb +0 -47
- data/lib/fog/internet_archive/requests/storage/put_bucket_lifecycle.rb +0 -76
- data/lib/fog/internet_archive/requests/storage/put_bucket_logging.rb +0 -79
- data/lib/fog/internet_archive/requests/storage/put_bucket_policy.rb +0 -25
- data/lib/fog/internet_archive/requests/storage/put_bucket_website.rb +0 -59
- data/lib/fog/internet_archive/requests/storage/put_object.rb +0 -94
- data/lib/fog/internet_archive/requests/storage/put_object_acl.rb +0 -73
- data/lib/fog/internet_archive/requests/storage/put_object_url.rb +0 -43
- data/lib/fog/internet_archive/requests/storage/put_request_payment.rb +0 -45
- data/lib/fog/internet_archive/requests/storage/sync_clock.rb +0 -24
- data/lib/fog/internet_archive/requests/storage/upload_part.rb +0 -39
- data/lib/fog/internet_archive/signaturev4.rb +0 -71
- data/lib/fog/internet_archive/storage.rb +0 -381
- data/lib/fog/joyent.rb +0 -12
- data/lib/fog/joyent/analytics.rb +0 -310
- data/lib/fog/joyent/compute.rb +0 -272
- data/lib/fog/joyent/core.rb +0 -10
- data/lib/fog/joyent/errors.rb +0 -91
- data/lib/fog/joyent/models/analytics/field.rb +0 -13
- data/lib/fog/joyent/models/analytics/fields.rb +0 -24
- data/lib/fog/joyent/models/analytics/instrumentation.rb +0 -82
- data/lib/fog/joyent/models/analytics/instrumentations.rb +0 -23
- data/lib/fog/joyent/models/analytics/joyent_module.rb +0 -13
- data/lib/fog/joyent/models/analytics/joyent_modules.rb +0 -24
- data/lib/fog/joyent/models/analytics/metric.rb +0 -17
- data/lib/fog/joyent/models/analytics/metrics.rb +0 -16
- data/lib/fog/joyent/models/analytics/transformation.rb +0 -13
- data/lib/fog/joyent/models/analytics/transformations.rb +0 -24
- data/lib/fog/joyent/models/analytics/type.rb +0 -16
- data/lib/fog/joyent/models/analytics/types.rb +0 -24
- data/lib/fog/joyent/models/analytics/value.rb +0 -20
- data/lib/fog/joyent/models/compute/datacenter.rb +0 -11
- data/lib/fog/joyent/models/compute/datacenters.rb +0 -21
- data/lib/fog/joyent/models/compute/flavor.rb +0 -19
- data/lib/fog/joyent/models/compute/flavors.rb +0 -21
- data/lib/fog/joyent/models/compute/image.rb +0 -26
- data/lib/fog/joyent/models/compute/images.rb +0 -30
- data/lib/fog/joyent/models/compute/key.rb +0 -19
- data/lib/fog/joyent/models/compute/keys.rb +0 -32
- data/lib/fog/joyent/models/compute/network.rb +0 -12
- data/lib/fog/joyent/models/compute/networks.rb +0 -14
- data/lib/fog/joyent/models/compute/server.rb +0 -124
- data/lib/fog/joyent/models/compute/servers.rb +0 -35
- data/lib/fog/joyent/models/compute/snapshot.rb +0 -44
- data/lib/fog/joyent/models/compute/snapshots.rb +0 -35
- data/lib/fog/joyent/requests/analytics/create_instrumentation.rb +0 -25
- data/lib/fog/joyent/requests/analytics/delete_instrumentation.rb +0 -23
- data/lib/fog/joyent/requests/analytics/describe_analytics.rb +0 -26
- data/lib/fog/joyent/requests/analytics/get_instrumentation.rb +0 -26
- data/lib/fog/joyent/requests/analytics/get_instrumentation_value.rb +0 -30
- data/lib/fog/joyent/requests/analytics/list_instrumentations.rb +0 -25
- data/lib/fog/joyent/requests/compute/add_machine_tags.rb +0 -19
- data/lib/fog/joyent/requests/compute/create_key.rb +0 -54
- data/lib/fog/joyent/requests/compute/create_machine.rb +0 -16
- data/lib/fog/joyent/requests/compute/create_machine_snapshot.rb +0 -16
- data/lib/fog/joyent/requests/compute/delete_all_machine_metadata.rb +0 -16
- data/lib/fog/joyent/requests/compute/delete_all_machine_tags.rb +0 -15
- data/lib/fog/joyent/requests/compute/delete_key.rb +0 -27
- data/lib/fog/joyent/requests/compute/delete_machine.rb +0 -15
- data/lib/fog/joyent/requests/compute/delete_machine_metadata.rb +0 -16
- data/lib/fog/joyent/requests/compute/delete_machine_snapshot.rb +0 -18
- data/lib/fog/joyent/requests/compute/delete_machine_tag.rb +0 -15
- data/lib/fog/joyent/requests/compute/get_dataset.rb +0 -27
- data/lib/fog/joyent/requests/compute/get_image.rb +0 -28
- data/lib/fog/joyent/requests/compute/get_key.rb +0 -29
- data/lib/fog/joyent/requests/compute/get_machine.rb +0 -29
- data/lib/fog/joyent/requests/compute/get_machine_metadata.rb +0 -24
- data/lib/fog/joyent/requests/compute/get_machine_snapshot.rb +0 -15
- data/lib/fog/joyent/requests/compute/get_machine_tag.rb +0 -18
- data/lib/fog/joyent/requests/compute/get_package.rb +0 -32
- data/lib/fog/joyent/requests/compute/list_datacenters.rb +0 -16
- data/lib/fog/joyent/requests/compute/list_datasets.rb +0 -24
- data/lib/fog/joyent/requests/compute/list_images.rb +0 -25
- data/lib/fog/joyent/requests/compute/list_keys.rb +0 -25
- data/lib/fog/joyent/requests/compute/list_machine_snapshots.rb +0 -15
- data/lib/fog/joyent/requests/compute/list_machine_tags.rb +0 -20
- data/lib/fog/joyent/requests/compute/list_machines.rb +0 -26
- data/lib/fog/joyent/requests/compute/list_networks.rb +0 -26
- data/lib/fog/joyent/requests/compute/list_packages.rb +0 -34
- data/lib/fog/joyent/requests/compute/reboot_machine.rb +0 -15
- data/lib/fog/joyent/requests/compute/resize_machine.rb +0 -16
- data/lib/fog/joyent/requests/compute/start_machine.rb +0 -16
- data/lib/fog/joyent/requests/compute/start_machine_from_snapshot.rb +0 -15
- data/lib/fog/joyent/requests/compute/stop_machine.rb +0 -16
- data/lib/fog/joyent/requests/compute/update_machine_metadata.rb +0 -15
- data/spec/fog/bin/internetarchive_spec.rb +0 -10
- data/tests/internet_archive/models/storage/directory_tests.rb +0 -42
- data/tests/internet_archive/models/storage/file_tests.rb +0 -61
- data/tests/internet_archive/models/storage/files_tests.rb +0 -58
- data/tests/internet_archive/models/storage/url_tests.rb +0 -28
- data/tests/internet_archive/requests/storage/acl_utils_tests.rb +0 -209
- data/tests/internet_archive/requests/storage/bucket_tests.rb +0 -324
- data/tests/internet_archive/requests/storage/cors_utils_tests.rb +0 -108
- data/tests/internet_archive/requests/storage/multipart_upload_tests.rb +0 -132
- data/tests/internet_archive/requests/storage/object_tests.rb +0 -166
- data/tests/internet_archive/signaturev4_tests.rb +0 -41
- data/tests/internet_archive/signed_params_tests.rb +0 -5
- data/tests/joyent/models/analytics/field_tests.rb +0 -10
- data/tests/joyent/models/analytics/fields_tests.rb +0 -13
- data/tests/joyent/models/analytics/instrumentation_tests.rb +0 -13
- data/tests/joyent/models/analytics/instrumentations_tests.rb +0 -3
- data/tests/joyent/models/analytics/joyent_module_tests.rb +0 -10
- data/tests/joyent/models/analytics/joyent_modules_tests.rb +0 -13
- data/tests/joyent/models/analytics/metric_tests.rb +0 -10
- data/tests/joyent/models/analytics/metrics_tests.rb +0 -20
- data/tests/joyent/models/analytics/transformation_tests.rb +0 -10
- data/tests/joyent/models/analytics/transformations_tests.rb +0 -13
- data/tests/joyent/models/analytics/type_tests.rb +0 -10
- data/tests/joyent/models/analytics/types_tests.rb +0 -13
- data/tests/joyent/requests/analytics/instrumentation_tests.rb +0 -44
- data/tests/joyent/requests/compute/datasets_tests.rb +0 -58
- data/tests/joyent/requests/compute/keys_tests.rb +0 -47
- data/tests/joyent/requests/compute/machines_tests.rb +0 -66
- data/tests/joyent/requests/compute/networks_tests.rb +0 -39
- data/tests/joyent/requests/compute/packages_tests.rb +0 -68
@@ -1,36 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Parsers
|
3
|
-
module Storage
|
4
|
-
module InternetArchive
|
5
|
-
class ListParts < Fog::Parsers::Base
|
6
|
-
def reset
|
7
|
-
@part = {}
|
8
|
-
@response = { 'Initiator' => {}, 'Part' => [] }
|
9
|
-
end
|
10
|
-
|
11
|
-
def end_element(name)
|
12
|
-
case name
|
13
|
-
when 'Bucket', 'Key', 'NextPartNumberMarker', 'PartNumberMarker', 'StorageClass', 'UploadId'
|
14
|
-
@response[name] = value
|
15
|
-
when 'DisplayName', 'ID'
|
16
|
-
@response['Initiator'][name] = value
|
17
|
-
when 'ETag'
|
18
|
-
@part[name] = value
|
19
|
-
when 'IsTruncated'
|
20
|
-
@response[name] = value == 'true'
|
21
|
-
when 'LastModified'
|
22
|
-
@part[name] = Time.parse(value)
|
23
|
-
when 'MaxParts'
|
24
|
-
@response[name] = value.to_i
|
25
|
-
when 'Part'
|
26
|
-
@response['Part'] << @part
|
27
|
-
@part = {}
|
28
|
-
when 'PartNumber', 'Size'
|
29
|
-
@part[name] = value.to_i
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
#
|
6
|
-
# Abort a multipart upload
|
7
|
-
#
|
8
|
-
# @param [String] bucket_name Name of bucket to abort multipart upload on
|
9
|
-
# @param [String] object_name Name of object to abort multipart upload on
|
10
|
-
# @param [String] upload_id Id of upload to add part to
|
11
|
-
#
|
12
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadAbort.html
|
13
|
-
#
|
14
|
-
def abort_multipart_upload(bucket_name, object_name, upload_id)
|
15
|
-
request({
|
16
|
-
:expects => 204,
|
17
|
-
:headers => {},
|
18
|
-
:host => "#{bucket_name}.#{@host}",
|
19
|
-
:method => 'DELETE',
|
20
|
-
:path => CGI.escape(object_name),
|
21
|
-
:query => {'uploadId' => upload_id}
|
22
|
-
})
|
23
|
-
end
|
24
|
-
end # Real
|
25
|
-
end # Storage
|
26
|
-
end # InternetArchive
|
27
|
-
end # Fog
|
@@ -1,60 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
require 'fog/internet_archive/parsers/storage/access_control_list'
|
5
|
-
|
6
|
-
private
|
7
|
-
def self.hash_to_acl(acl)
|
8
|
-
data = "<AccessControlPolicy>\n"
|
9
|
-
|
10
|
-
if acl['Owner'] && (acl['Owner']['ID'] || acl['Owner']['DisplayName'])
|
11
|
-
data << " <Owner>\n"
|
12
|
-
data << " <ID>#{acl['Owner']['ID']}</ID>\n" if acl['Owner']['ID']
|
13
|
-
data << " <DisplayName>#{acl['Owner']['DisplayName']}</DisplayName>\n" if acl['Owner']['DisplayName']
|
14
|
-
data << " </Owner>\n"
|
15
|
-
end
|
16
|
-
|
17
|
-
grants = [acl['AccessControlList']].flatten.compact
|
18
|
-
|
19
|
-
data << " <AccessControlList>\n" if grants.any?
|
20
|
-
grants.each do |grant|
|
21
|
-
data << " <Grant>\n"
|
22
|
-
grantee = grant['Grantee']
|
23
|
-
type = case
|
24
|
-
when grantee.key?('ID')
|
25
|
-
'CanonicalUser'
|
26
|
-
when grantee.key?('EmailAddress')
|
27
|
-
'AmazonCustomerByEmail'
|
28
|
-
when grantee.key?('URI')
|
29
|
-
'Group'
|
30
|
-
end
|
31
|
-
|
32
|
-
data << " <Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"#{type}\">\n"
|
33
|
-
case type
|
34
|
-
when 'CanonicalUser'
|
35
|
-
data << " <ID>#{grantee['ID']}</ID>\n" if grantee['ID']
|
36
|
-
data << " <DisplayName>#{grantee['DisplayName']}</DisplayName>\n" if grantee['DisplayName']
|
37
|
-
when 'AmazonCustomerByEmail'
|
38
|
-
data << " <EmailAddress>#{grantee['EmailAddress']}</EmailAddress>\n" if grantee['EmailAddress']
|
39
|
-
when 'Group'
|
40
|
-
data << " <URI>#{grantee['URI']}</URI>\n" if grantee['URI']
|
41
|
-
end
|
42
|
-
data << " </Grantee>\n"
|
43
|
-
data << " <Permission>#{grant['Permission']}</Permission>\n"
|
44
|
-
data << " </Grant>\n"
|
45
|
-
end
|
46
|
-
data << " </AccessControlList>\n" if grants.any?
|
47
|
-
|
48
|
-
data << "</AccessControlPolicy>"
|
49
|
-
|
50
|
-
data
|
51
|
-
end
|
52
|
-
|
53
|
-
def self.acl_to_hash(acl_xml)
|
54
|
-
parser = Fog::Parsers::Storage::InternetArchive::AccessControlList.new
|
55
|
-
Nokogiri::XML::SAX::Parser.new(parser).parse(acl_xml)
|
56
|
-
parser.response
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
require 'fog/internet_archive/parsers/storage/complete_multipart_upload'
|
6
|
-
|
7
|
-
# Complete a multipart upload
|
8
|
-
#
|
9
|
-
# @param [String] bucket_name Name of bucket to complete multipart upload for
|
10
|
-
# @param [String] object_name Name of object to complete multipart upload for
|
11
|
-
# @param [String] upload_id Id of upload to add part to
|
12
|
-
# @param [Array<String>] parts Array of etags as Strings for parts
|
13
|
-
#
|
14
|
-
# @return [Excon::Response]
|
15
|
-
# * headers [Hash]:
|
16
|
-
# * Bucket [String] - bucket of new object
|
17
|
-
# * ETag [String] - etag of new object (will be needed to complete upload)
|
18
|
-
# * Key [String] - key of new object
|
19
|
-
# * Location [String] - location of new object
|
20
|
-
#
|
21
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadComplete.html
|
22
|
-
#
|
23
|
-
def complete_multipart_upload(bucket_name, object_name, upload_id, parts)
|
24
|
-
data = "<CompleteMultipartUpload>"
|
25
|
-
parts.each_with_index do |part, index|
|
26
|
-
data << "<Part>"
|
27
|
-
data << "<PartNumber>#{index + 1}</PartNumber>"
|
28
|
-
data << "<ETag>#{part}</ETag>"
|
29
|
-
data << "</Part>"
|
30
|
-
end
|
31
|
-
data << "</CompleteMultipartUpload>"
|
32
|
-
request({
|
33
|
-
:body => data,
|
34
|
-
:expects => 200,
|
35
|
-
:headers => { 'Content-Length' => data.length },
|
36
|
-
:host => "#{bucket_name}.#{@host}",
|
37
|
-
:method => 'POST',
|
38
|
-
:parser => Fog::Parsers::Storage::InternetArchive::CompleteMultipartUpload.new,
|
39
|
-
:path => CGI.escape(object_name),
|
40
|
-
:query => {'uploadId' => upload_id}
|
41
|
-
})
|
42
|
-
end
|
43
|
-
end # Real
|
44
|
-
end # Storage
|
45
|
-
end # InternetArchive
|
46
|
-
end # Fog
|
@@ -1,77 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
require 'fog/internet_archive/parsers/storage/copy_object'
|
6
|
-
|
7
|
-
# Copy an object from one S3 bucket to another
|
8
|
-
#
|
9
|
-
# @param source_bucket_name [String] Name of source bucket
|
10
|
-
# @param source_object_name [String] Name of source object
|
11
|
-
# @param target_bucket_name [String] Name of bucket to create copy in
|
12
|
-
# @param target_object_name [String] Name for new copy of object
|
13
|
-
#
|
14
|
-
# @param options [Hash]:
|
15
|
-
# @option options [String] x-amz-metadata-directive Specifies whether to copy metadata from source or replace with data in request. Must be in ['COPY', 'REPLACE']
|
16
|
-
# @option options [String] x-amz-copy_source-if-match Copies object if its etag matches this value
|
17
|
-
# @option options [Time] x-amz-copy_source-if-modified_since Copies object it it has been modified since this time
|
18
|
-
# @option options [String] x-amz-copy_source-if-none-match Copies object if its etag does not match this value
|
19
|
-
# @option options [Time] x-amz-copy_source-if-unmodified-since Copies object it it has not been modified since this time
|
20
|
-
# @option options [String] x-amz-storage-class Default is 'STANDARD', set to 'REDUCED_REDUNDANCY' for non-critical, reproducable data
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# @return [Excon::Response]
|
24
|
-
# * body [Hash]:
|
25
|
-
# * ETag [String] - etag of new object
|
26
|
-
# * LastModified [Time] - date object was last modified
|
27
|
-
#
|
28
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectCOPY.html
|
29
|
-
#
|
30
|
-
def copy_object(source_bucket_name, source_object_name, target_bucket_name, target_object_name, options = {})
|
31
|
-
headers = { 'x-amz-copy-source' => "/#{source_bucket_name}/#{CGI.escape(source_object_name)}" }.merge!(options)
|
32
|
-
request({
|
33
|
-
:expects => 200,
|
34
|
-
:headers => headers,
|
35
|
-
:host => "#{target_bucket_name}.#{@host}",
|
36
|
-
:method => 'PUT',
|
37
|
-
:parser => Fog::Parsers::Storage::InternetArchive::CopyObject.new,
|
38
|
-
:path => CGI.escape(target_object_name)
|
39
|
-
})
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
class Mock # :nodoc:all
|
44
|
-
def copy_object(source_bucket_name, source_object_name, target_bucket_name, target_object_name, options = {})
|
45
|
-
response = Excon::Response.new
|
46
|
-
source_bucket = self.data[:buckets][source_bucket_name]
|
47
|
-
source_object = source_bucket && source_bucket[:objects][source_object_name] && source_bucket[:objects][source_object_name].first
|
48
|
-
target_bucket = self.data[:buckets][target_bucket_name]
|
49
|
-
|
50
|
-
acl = options['x-amz-acl'] || 'private'
|
51
|
-
if !['private', 'public-read', 'public-read-write', 'authenticated-read'].include?(acl)
|
52
|
-
raise Excon::Errors::BadRequest.new('invalid x-amz-acl')
|
53
|
-
else
|
54
|
-
self.data[:acls][:object][target_bucket_name] ||= {}
|
55
|
-
self.data[:acls][:object][target_bucket_name][target_object_name] = self.class.acls(acl)
|
56
|
-
end
|
57
|
-
|
58
|
-
if source_object && target_bucket
|
59
|
-
response.status = 200
|
60
|
-
target_object = source_object.dup
|
61
|
-
target_object.merge!({'Key' => target_object_name})
|
62
|
-
target_bucket[:objects][target_object_name] = [target_object]
|
63
|
-
response.body = {
|
64
|
-
'ETag' => target_object['ETag'],
|
65
|
-
'LastModified' => Time.parse(target_object['Last-Modified'])
|
66
|
-
}
|
67
|
-
else
|
68
|
-
response.status = 404
|
69
|
-
raise(Excon::Errors.status_error({:expects => 200}, response))
|
70
|
-
end
|
71
|
-
|
72
|
-
response
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
require 'fog/internet_archive/parsers/storage/cors_configuration'
|
5
|
-
|
6
|
-
private
|
7
|
-
|
8
|
-
def self.hash_to_cors(cors)
|
9
|
-
data = "<CORSConfiguration>\n"
|
10
|
-
|
11
|
-
[cors['CORSConfiguration']].flatten.compact.each do |rule|
|
12
|
-
data << " <CORSRule>\n"
|
13
|
-
|
14
|
-
['ID', 'MaxAgeSeconds'].each do |key|
|
15
|
-
data << " <#{key}>#{rule[key]}</#{key}>\n" if rule[key]
|
16
|
-
end
|
17
|
-
|
18
|
-
['AllowedOrigin', 'AllowedMethod', 'AllowedHeader', 'ExposeHeader'].each do |key|
|
19
|
-
[rule[key]].flatten.compact.each do |value|
|
20
|
-
data << " <#{key}>#{value}</#{key}>\n"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
data << " </CORSRule>\n"
|
25
|
-
end
|
26
|
-
|
27
|
-
data << "</CORSConfiguration>"
|
28
|
-
|
29
|
-
data
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.cors_to_hash(cors_xml)
|
33
|
-
parser = Fog::Parsers::Storage::InternetArchive::CorsConfiguration.new
|
34
|
-
Nokogiri::XML::SAX::Parser.new(parser).parse(cors_xml)
|
35
|
-
parser.response
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
# Delete an S3 bucket
|
6
|
-
#
|
7
|
-
# @param bucket_name [String] name of bucket to delete
|
8
|
-
#
|
9
|
-
# @return [Excon::Response] response:
|
10
|
-
# * status [Integer] - 204
|
11
|
-
#
|
12
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketDELETE.html
|
13
|
-
|
14
|
-
def delete_bucket(bucket_name)
|
15
|
-
request({
|
16
|
-
:expects => 204,
|
17
|
-
:headers => {},
|
18
|
-
:host => "#{bucket_name}.#{@host}",
|
19
|
-
:method => 'DELETE'
|
20
|
-
})
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class Mock # :nodoc:all
|
25
|
-
def delete_bucket(bucket_name)
|
26
|
-
response = Excon::Response.new
|
27
|
-
if self.data[:buckets][bucket_name].nil?
|
28
|
-
response.status = 404
|
29
|
-
raise(Excon::Errors.status_error({:expects => 204}, response))
|
30
|
-
elsif self.data[:buckets][bucket_name] && !self.data[:buckets][bucket_name][:objects].empty?
|
31
|
-
response.status = 409
|
32
|
-
raise(Excon::Errors.status_error({:expects => 204}, response))
|
33
|
-
else
|
34
|
-
self.data[:buckets].delete(bucket_name)
|
35
|
-
response.status = 204
|
36
|
-
end
|
37
|
-
response
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
# Deletes the cors configuration information set for the bucket.
|
6
|
-
#
|
7
|
-
# @param bucket_name [String] name of bucket to delete cors rules from
|
8
|
-
#
|
9
|
-
# @return [Excon::Response] response:
|
10
|
-
# * status [Integer] - 204
|
11
|
-
#
|
12
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketDELETEcors.html
|
13
|
-
|
14
|
-
def delete_bucket_cors(bucket_name)
|
15
|
-
request({
|
16
|
-
:expects => 204,
|
17
|
-
:headers => {},
|
18
|
-
:host => "#{bucket_name}.#{@host}",
|
19
|
-
:method => 'DELETE',
|
20
|
-
:query => {'cors' => nil}
|
21
|
-
})
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
# Delete lifecycle configuration for a bucket
|
6
|
-
#
|
7
|
-
# @param bucket_name [String] name of bucket to delete lifecycle configuration from
|
8
|
-
#
|
9
|
-
# @return [Excon::Response] response:
|
10
|
-
# * status [Integer] - 204
|
11
|
-
#
|
12
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketDELETElifecycle.html
|
13
|
-
|
14
|
-
def delete_bucket_lifecycle(bucket_name)
|
15
|
-
request({
|
16
|
-
:expects => 204,
|
17
|
-
:headers => {},
|
18
|
-
:host => "#{bucket_name}.#{@host}",
|
19
|
-
:method => 'DELETE',
|
20
|
-
:query => {'lifecycle' => nil}
|
21
|
-
})
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
# Delete policy for a bucket
|
6
|
-
#
|
7
|
-
# @param bucket_name [String] name of bucket to delete policy from
|
8
|
-
#
|
9
|
-
# @return [Excon::Response] response:
|
10
|
-
# * status [Integer] - 204
|
11
|
-
#
|
12
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketDELETEpolicy.html
|
13
|
-
|
14
|
-
def delete_bucket_policy(bucket_name)
|
15
|
-
request({
|
16
|
-
:expects => 204,
|
17
|
-
:headers => {},
|
18
|
-
:host => "#{bucket_name}.#{@host}",
|
19
|
-
:method => 'DELETE',
|
20
|
-
:query => {'policy' => nil}
|
21
|
-
})
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
# Delete website configuration for a bucket
|
6
|
-
#
|
7
|
-
# @param bucket_name [String] name of bucket to delete website configuration from
|
8
|
-
#
|
9
|
-
# @return [Excon::Response] response:
|
10
|
-
# * status [Integer] - 204
|
11
|
-
#
|
12
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketDELETEwebsite.html
|
13
|
-
|
14
|
-
def delete_bucket_website(bucket_name)
|
15
|
-
request({
|
16
|
-
:expects => 204,
|
17
|
-
:headers => {},
|
18
|
-
:host => "#{bucket_name}.#{@host}",
|
19
|
-
:method => 'DELETE',
|
20
|
-
:query => {'website' => nil}
|
21
|
-
})
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,88 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
require 'fog/internet_archive/parsers/storage/delete_multiple_objects'
|
6
|
-
|
7
|
-
# Delete multiple objects from S3
|
8
|
-
# @note For versioned deletes, options should include a version_ids hash, which
|
9
|
-
# maps from filename to an array of versions.
|
10
|
-
# The semantics are that for each (object_name, version) tuple, the
|
11
|
-
# caller must insert the object_name and an associated version (if
|
12
|
-
# desired), so for n versions, the object must be inserted n times.
|
13
|
-
#
|
14
|
-
# @param bucket_name [String] Name of bucket containing object to delete
|
15
|
-
# @param object_names [Array] Array of object names to delete
|
16
|
-
#
|
17
|
-
# @return [Excon::Response] response:
|
18
|
-
# * body [Hash]:
|
19
|
-
# * DeleteResult [Array]:
|
20
|
-
# * Deleted [Hash]:
|
21
|
-
# * Key [String] - Name of the object that was deleted
|
22
|
-
# * VersionId [String] - ID for the versioned onject in case of a versioned delete
|
23
|
-
# * DeleteMarker [Boolean] - Indicates if the request accessed a delete marker
|
24
|
-
# * DeleteMarkerVersionId [String] - Version ID of the delete marker accessed
|
25
|
-
# * Error [Hash]:
|
26
|
-
# * Key [String] - Name of the object that failed to be deleted
|
27
|
-
# * VersionId [String] - ID of the versioned object that was attempted to be deleted
|
28
|
-
# * Code [String] - Status code for the result of the failed delete
|
29
|
-
# * Message [String] - Error description
|
30
|
-
#
|
31
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/multiobjectdeleteapi.html
|
32
|
-
|
33
|
-
def delete_multiple_objects(bucket_name, object_names, options = {})
|
34
|
-
data = "<Delete>"
|
35
|
-
data << "<Quiet>true</Quiet>" if options.delete(:quiet)
|
36
|
-
object_names.each do |object_name|
|
37
|
-
data << "<Object>"
|
38
|
-
data << "<Key>#{CGI.escapeHTML(object_name)}</Key>"
|
39
|
-
data << "</Object>"
|
40
|
-
end
|
41
|
-
data << "</Delete>"
|
42
|
-
|
43
|
-
headers = options
|
44
|
-
headers['Content-Length'] = data.length
|
45
|
-
headers['Content-MD5'] = Base64.encode64(Digest::MD5.digest(data)).
|
46
|
-
gsub("\n", '')
|
47
|
-
|
48
|
-
request({
|
49
|
-
:body => data,
|
50
|
-
:expects => 200,
|
51
|
-
:headers => headers,
|
52
|
-
:host => "#{bucket_name}.#{@host}",
|
53
|
-
:method => 'POST',
|
54
|
-
:parser => Fog::Parsers::Storage::InternetArchive::DeleteMultipleObjects.new,
|
55
|
-
:query => {'delete' => nil}
|
56
|
-
})
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
class Mock # :nodoc:all
|
61
|
-
def delete_multiple_objects(bucket_name, object_names, options = {})
|
62
|
-
response = Excon::Response.new
|
63
|
-
if bucket = self.data[:buckets][bucket_name]
|
64
|
-
response.status = 200
|
65
|
-
response.body = { 'DeleteResult' => [] }
|
66
|
-
object_names.each do |object_name|
|
67
|
-
response.body['DeleteResult'] << delete_object_helper(bucket,
|
68
|
-
object_name)
|
69
|
-
end
|
70
|
-
else
|
71
|
-
response.status = 404
|
72
|
-
raise(Excon::Errors.status_error({:expects => 200}, response))
|
73
|
-
end
|
74
|
-
response
|
75
|
-
end
|
76
|
-
|
77
|
-
private
|
78
|
-
|
79
|
-
def delete_object_helper(bucket, object_name)
|
80
|
-
response = { 'Deleted' => {} }
|
81
|
-
bucket[:objects].delete(object_name)
|
82
|
-
response['Deleted'] = { 'Key' => object_name }
|
83
|
-
response
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|