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,45 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
require 'fog/internet_archive/parsers/storage/get_request_payment'
|
6
|
-
|
7
|
-
# Get configured payer for an S3 bucket
|
8
|
-
#
|
9
|
-
# @param bucket_name [String] name of bucket to get payer for
|
10
|
-
#
|
11
|
-
# @return [Excon::Response] response:
|
12
|
-
# * body [Hash]:
|
13
|
-
# * Payer [String] - Specifies who pays for download and requests
|
14
|
-
#
|
15
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTrequestPaymentGET.html
|
16
|
-
|
17
|
-
def get_request_payment(bucket_name)
|
18
|
-
request({
|
19
|
-
:expects => 200,
|
20
|
-
:headers => {},
|
21
|
-
:host => "#{bucket_name}.#{@host}",
|
22
|
-
:idempotent => true,
|
23
|
-
:method => 'GET',
|
24
|
-
:parser => Fog::Parsers::Storage::InternetArchive::GetRequestPayment.new,
|
25
|
-
:query => {'requestPayment' => nil}
|
26
|
-
})
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class Mock # :nodoc:all
|
31
|
-
def get_request_payment(bucket_name)
|
32
|
-
response = Excon::Response.new
|
33
|
-
if bucket = self.data[:buckets][bucket_name]
|
34
|
-
response.status = 200
|
35
|
-
response.body = { 'Payer' => bucket['Payer'] }
|
36
|
-
else
|
37
|
-
response.status = 404
|
38
|
-
raise(Excon::Errors.status_error({:expects => 200}, response))
|
39
|
-
end
|
40
|
-
response
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
require 'fog/internet_archive/parsers/storage/get_service'
|
6
|
-
|
7
|
-
# List information about S3 buckets for authorized user
|
8
|
-
#
|
9
|
-
# @return [Excon::Response] response:
|
10
|
-
# * body [Hash]:
|
11
|
-
# * Buckets [Hash]:
|
12
|
-
# * Name [String] - Name of bucket
|
13
|
-
# * CreationTime [Time] - Timestamp of bucket creation
|
14
|
-
# * Owner [Hash]:
|
15
|
-
# * DisplayName [String] - Display name of bucket owner
|
16
|
-
# * ID [String] - Id of bucket owner
|
17
|
-
#
|
18
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTServiceGET.html
|
19
|
-
#
|
20
|
-
def get_service
|
21
|
-
request({
|
22
|
-
:expects => 200,
|
23
|
-
:headers => {},
|
24
|
-
:host => @host,
|
25
|
-
:idempotent => true,
|
26
|
-
:method => 'GET',
|
27
|
-
:parser => Fog::Parsers::Storage::InternetArchive::GetService.new
|
28
|
-
})
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
class Mock # :nodoc:all
|
33
|
-
def get_service
|
34
|
-
response = Excon::Response.new
|
35
|
-
response.headers['Status'] = 200
|
36
|
-
buckets = self.data[:buckets].values.map do |bucket|
|
37
|
-
bucket.reject do |key, value|
|
38
|
-
!['CreationDate', 'Name'].include?(key)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
response.body = {
|
42
|
-
'Buckets' => buckets,
|
43
|
-
'Owner' => { 'DisplayName' => 'owner', 'ID' => 'some_id'}
|
44
|
-
}
|
45
|
-
response
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
# Get headers for an object from S3
|
6
|
-
#
|
7
|
-
# @param bucket_name [String] Name of bucket to read from
|
8
|
-
# @param object_name [String] Name of object to read
|
9
|
-
# @param options [Hash]:
|
10
|
-
# @option options [String] If-Match Returns object only if its etag matches this value, otherwise returns 412 (Precondition Failed).
|
11
|
-
# @option options [Time] If-Modified-Since Returns object only if it has been modified since this time, otherwise returns 304 (Not Modified).
|
12
|
-
# @option options [String] If-None-Match Returns object only if its etag differs from this value, otherwise returns 304 (Not Modified)
|
13
|
-
# @option options [Time] If-Unmodified-Since Returns object only if it has not been modified since this time, otherwise returns 412 (Precodition Failed).
|
14
|
-
# @option options [String] Range Range of object to download
|
15
|
-
#
|
16
|
-
# @return [Excon::Response] response:
|
17
|
-
# * body [String] Contents of object
|
18
|
-
# * headers [Hash]:
|
19
|
-
# * Content-Length [String] - Size of object contents
|
20
|
-
# * Content-Type [String] - MIME type of object
|
21
|
-
# * ETag [String] - Etag of object
|
22
|
-
# * Last-Modified - [String] Last modified timestamp for object
|
23
|
-
#
|
24
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectHEAD.html
|
25
|
-
#
|
26
|
-
def head_object(bucket_name, object_name, options={})
|
27
|
-
unless bucket_name
|
28
|
-
raise ArgumentError.new('bucket_name is required')
|
29
|
-
end
|
30
|
-
unless object_name
|
31
|
-
raise ArgumentError.new('object_name is required')
|
32
|
-
end
|
33
|
-
headers = {}
|
34
|
-
headers['If-Modified-Since'] = Fog::Time.at(options['If-Modified-Since'].to_i).to_date_header if options['If-Modified-Since']
|
35
|
-
headers['If-Unmodified-Since'] = Fog::Time.at(options['If-Unmodified-Since'].to_i).to_date_header if options['If-Modified-Since']
|
36
|
-
headers.merge!(options)
|
37
|
-
request({
|
38
|
-
:expects => 200,
|
39
|
-
:headers => headers,
|
40
|
-
:host => "#{bucket_name}.#{@host}",
|
41
|
-
:idempotent => true,
|
42
|
-
:method => 'HEAD',
|
43
|
-
:path => CGI.escape(object_name)
|
44
|
-
})
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
class Mock # :nodoc:all
|
49
|
-
def head_object(bucket_name, object_name, options = {})
|
50
|
-
response = get_object(bucket_name, object_name, options)
|
51
|
-
response.body = nil
|
52
|
-
response
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
require 'fog/internet_archive/parsers/storage/initiate_multipart_upload'
|
6
|
-
|
7
|
-
# Initiate a multipart upload to an S3 bucket
|
8
|
-
#
|
9
|
-
# @param bucket_name [String] Name of bucket to create object in
|
10
|
-
# @param object_name [String] Name of object to create
|
11
|
-
# @param options [Hash]:
|
12
|
-
# @option options [String] Cache-Control Caching behaviour
|
13
|
-
# @option options [String] Content-Disposition Presentational information for the object
|
14
|
-
# @option options [String] Content-Encoding Encoding of object data
|
15
|
-
# @option options [String] Content-MD5 Base64 encoded 128-bit MD5 digest of message (defaults to Base64 encoded MD5 of object.read)
|
16
|
-
# @option options [String] Content-Type Standard MIME type describing contents (defaults to MIME::Types.of.first)
|
17
|
-
# @option options [String] x-amz-acl Permissions, must be in ['private', 'public-read', 'public-read-write', 'authenticated-read']
|
18
|
-
# @option options [String] x-amz-meta-#{name} Headers to be returned with object, note total size of request without body must be less than 8 KB.
|
19
|
-
#
|
20
|
-
# @return [Excon::Response] response:
|
21
|
-
# * body [Hash]:
|
22
|
-
# * Bucket [String] - Bucket where upload was initiated
|
23
|
-
# * Key [String] - Object key where the upload was initiated
|
24
|
-
# * UploadId [String] - Id for initiated multipart upload
|
25
|
-
#
|
26
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadInitiate.html
|
27
|
-
#
|
28
|
-
def initiate_multipart_upload(bucket_name, object_name, options = {})
|
29
|
-
request({
|
30
|
-
:expects => 200,
|
31
|
-
:headers => options,
|
32
|
-
:host => "#{bucket_name}.#{@host}",
|
33
|
-
:method => 'POST',
|
34
|
-
:parser => Fog::Parsers::Storage::InternetArchive::InitiateMultipartUpload.new,
|
35
|
-
:path => CGI.escape(object_name),
|
36
|
-
:query => {'uploads' => nil}
|
37
|
-
})
|
38
|
-
end
|
39
|
-
end # Real
|
40
|
-
end # Storage
|
41
|
-
end # InternetArchive
|
42
|
-
end # Fog
|
@@ -1,52 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
require 'fog/internet_archive/parsers/storage/list_multipart_uploads'
|
6
|
-
|
7
|
-
# List multipart uploads for a bucket
|
8
|
-
#
|
9
|
-
# @param [String] bucket_name Name of bucket to list multipart uploads for
|
10
|
-
# @param [Hash] options config arguments for list. Defaults to {}.
|
11
|
-
# @option options [String] key-marker limits parts to only those that appear lexicographically after this key.
|
12
|
-
# @option options [Integer] max-uploads limits number of uploads returned
|
13
|
-
# @option options [String] upload-id-marker limits uploads to only those that appear lexicographically after this upload id.
|
14
|
-
#
|
15
|
-
# @return [Excon::Response] response:
|
16
|
-
# * body [Hash]:
|
17
|
-
# * Bucket [string] Bucket where the multipart upload was initiated
|
18
|
-
# * IsTruncated [Boolean] Whether or not the listing is truncated
|
19
|
-
# * KeyMarker [String] first key in list, only upload ids after this lexographically will appear
|
20
|
-
# * MaxUploads [Integer] Maximum results to return
|
21
|
-
# * NextKeyMarker [String] last key in list, for further pagination
|
22
|
-
# * NextUploadIdMarker [String] last key in list, for further pagination
|
23
|
-
# * Upload [Hash]:
|
24
|
-
# * Initiated [Time] Time when upload was initiated
|
25
|
-
# * Initiator [Hash]:
|
26
|
-
# * DisplayName [String] Display name of upload initiator
|
27
|
-
# * ID [String] Id of upload initiator
|
28
|
-
# * Key [String] Key where multipart upload was initiated
|
29
|
-
# * Owner [Hash]:
|
30
|
-
# * DisplayName [String] Display name of upload owner
|
31
|
-
# * ID [String] Id of upload owner
|
32
|
-
# * StorageClass [String] Storage class of object
|
33
|
-
# * UploadId [String] upload id of upload containing part
|
34
|
-
# * UploadIdMarker [String] first key in list, only upload ids after this lexographically will appear
|
35
|
-
#
|
36
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadListMPUpload.html
|
37
|
-
#
|
38
|
-
def list_multipart_uploads(bucket_name, options = {})
|
39
|
-
request({
|
40
|
-
:expects => 200,
|
41
|
-
:headers => {},
|
42
|
-
:host => "#{bucket_name}.#{@host}",
|
43
|
-
:idempotent => true,
|
44
|
-
:method => 'GET',
|
45
|
-
:parser => Fog::Parsers::Storage::InternetArchive::ListMultipartUploads.new,
|
46
|
-
:query => options.merge!({'uploads' => nil})
|
47
|
-
})
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
require 'fog/internet_archive/parsers/storage/list_parts'
|
6
|
-
|
7
|
-
# List parts for a multipart upload
|
8
|
-
#
|
9
|
-
# @param bucket_name [String] Name of bucket to list parts for
|
10
|
-
# @param object_name [String] Name of object to list parts for
|
11
|
-
# @param upload_id [String] upload id to list objects for
|
12
|
-
# @param options [Hash] config arguments for list. Defaults to {}.
|
13
|
-
# @option options max-parts [Integer] limits number of parts returned
|
14
|
-
# @option options part-number-marker [String] limits parts to only those that appear lexicographically after this part number.
|
15
|
-
#
|
16
|
-
# @return [Excon::Response] response:
|
17
|
-
# * body [Hash]:
|
18
|
-
# * Bucket [string] Bucket where the multipart upload was initiated
|
19
|
-
# * Initiator [Hash]:
|
20
|
-
# * DisplayName [String] Display name of upload initiator
|
21
|
-
# * ID [String] Id of upload initiator
|
22
|
-
# * IsTruncated [Boolean] Whether or not the listing is truncated
|
23
|
-
# * Key [String] Key where multipart upload was initiated
|
24
|
-
# * MaxParts [String] maximum number of replies alllowed in response
|
25
|
-
# * NextPartNumberMarker [String] last item in list, for further pagination
|
26
|
-
# * Part [Array]:
|
27
|
-
# * ETag [String] ETag of part
|
28
|
-
# * LastModified [Timestamp] Last modified for part
|
29
|
-
# * PartNumber [String] Part number for part
|
30
|
-
# * Size [Integer] Size of part
|
31
|
-
# * PartNumberMarker [String] Part number after which listing begins
|
32
|
-
# * StorageClass [String] Storage class of object
|
33
|
-
# * UploadId [String] upload id of upload containing part
|
34
|
-
#
|
35
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadListParts.html
|
36
|
-
#
|
37
|
-
def list_parts(bucket_name, object_name, upload_id, options = {})
|
38
|
-
options['uploadId'] = upload_id
|
39
|
-
request({
|
40
|
-
:expects => 200,
|
41
|
-
:headers => {},
|
42
|
-
:host => "#{bucket_name}.#{@host}",
|
43
|
-
:idempotent => true,
|
44
|
-
:method => 'GET',
|
45
|
-
:parser => Fog::Parsers::Storage::InternetArchive::ListParts.new,
|
46
|
-
:path => CGI.escape(object_name),
|
47
|
-
:query => options.merge!({'uploadId' => upload_id})
|
48
|
-
})
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
# Get a hash of hidden fields for form uploading to S3, in the form {:field_name => :field_value}
|
6
|
-
# Form should look like: <form action="http://#{bucket_name}.#{Fog::InternetArchive::API_DOMAIN_NAME}/" method="post" enctype="multipart/form-data">
|
7
|
-
# These hidden fields should then appear, followed by a field named 'file' which is either a textarea or file input.
|
8
|
-
#
|
9
|
-
# @param options Hash:
|
10
|
-
# @option options acl [String] access control list, in ['private', 'public-read', 'public-read-write', 'authenticated-read', 'bucket-owner-read', 'bucket-owner-full-control']
|
11
|
-
# @option options Cache-Control [String] same as REST header
|
12
|
-
# @option options Content-Type [String] same as REST header
|
13
|
-
# @option options Content-Disposition [String] same as REST header
|
14
|
-
# @option options Content-Encoding [String] same as REST header
|
15
|
-
# @option options Expires same as REST header
|
16
|
-
# @option options key key for object, set to '${filename}' to use filename provided by user
|
17
|
-
# @option options policy security policy for upload
|
18
|
-
# @option options success_action_redirect url to redirct to upon success
|
19
|
-
# @option options success_action_status status code to return on success, in [200, 201, 204]
|
20
|
-
# @option options x-amz-security token devpay security token
|
21
|
-
# @option options x-amz-meta... meta data tags
|
22
|
-
#
|
23
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/dev/HTTPPOSTForms.html
|
24
|
-
#
|
25
|
-
def post_object_hidden_fields(options = {})
|
26
|
-
if options['policy']
|
27
|
-
options['policy'] = Base64.encode64(Fog::JSON.encode(options['policy'])).gsub("\n", "")
|
28
|
-
options['AWSAccessKeyId'] = @ia_access_key_id
|
29
|
-
options['Signature'] = Base64.encode64(@hmac.sign(options['policy'])).gsub("\n", "")
|
30
|
-
end
|
31
|
-
options
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
# Create an S3 bucket
|
6
|
-
#
|
7
|
-
# @param bucket_name [String] name of bucket to create
|
8
|
-
# @option options [Hash] config arguments for bucket. Defaults to {}.
|
9
|
-
# @option options LocationConstraint [Symbol] sets the location for the bucket
|
10
|
-
# @option options x-amz-acl [String] Permissions, must be in ['private', 'public-read', 'public-read-write', 'authenticated-read']
|
11
|
-
#
|
12
|
-
# @return [Excon::Response] response:
|
13
|
-
# * status [Integer] 200
|
14
|
-
#
|
15
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUT.html
|
16
|
-
#
|
17
|
-
def put_bucket(bucket_name, options = {})
|
18
|
-
if location_constraint = options.delete('LocationConstraint')
|
19
|
-
data =
|
20
|
-
<<-DATA
|
21
|
-
<CreateBucketConfiguration>
|
22
|
-
<LocationConstraint>#{location_constraint}</LocationConstraint>
|
23
|
-
</CreateBucketConfiguration>
|
24
|
-
DATA
|
25
|
-
else
|
26
|
-
data = nil
|
27
|
-
end
|
28
|
-
request({
|
29
|
-
:expects => 200,
|
30
|
-
:body => data,
|
31
|
-
:headers => options,
|
32
|
-
:idempotent => true,
|
33
|
-
:host => "#{bucket_name}.#{@host}",
|
34
|
-
:method => 'PUT'
|
35
|
-
})
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
class Mock # :nodoc:all
|
40
|
-
def put_bucket(bucket_name, options = {})
|
41
|
-
acl = options['x-amz-acl'] || 'private'
|
42
|
-
if !['private', 'public-read', 'public-read-write', 'authenticated-read'].include?(acl)
|
43
|
-
raise Excon::Errors::BadRequest.new('invalid x-amz-acl')
|
44
|
-
else
|
45
|
-
self.data[:acls][:bucket][bucket_name] = self.class.acls(acl)
|
46
|
-
end
|
47
|
-
|
48
|
-
response = Excon::Response.new
|
49
|
-
response.status = 200
|
50
|
-
bucket = {
|
51
|
-
:objects => {},
|
52
|
-
'Name' => bucket_name,
|
53
|
-
'CreationDate' => Time.now,
|
54
|
-
'Owner' => { 'DisplayName' => 'owner', 'ID' => 'some_id'},
|
55
|
-
'Payer' => 'BucketOwner'
|
56
|
-
}
|
57
|
-
if options['LocationConstraint']
|
58
|
-
bucket['LocationConstraint'] = options['LocationConstraint']
|
59
|
-
else
|
60
|
-
bucket['LocationConstraint'] = nil
|
61
|
-
end
|
62
|
-
unless self.data[:buckets][bucket_name]
|
63
|
-
self.data[:buckets][bucket_name] = bucket
|
64
|
-
end
|
65
|
-
response
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class InternetArchive
|
4
|
-
class Real
|
5
|
-
require 'fog/internet_archive/requests/storage/acl_utils'
|
6
|
-
|
7
|
-
# Change access control list for an S3 bucket
|
8
|
-
#
|
9
|
-
# @param bucket_name [String] name of bucket to modify
|
10
|
-
# @param acl [Hash]
|
11
|
-
# * Owner [Hash]:
|
12
|
-
# * ID [String]: id of owner
|
13
|
-
# * DisplayName [String]: display name of owner
|
14
|
-
# * AccessControlList [Array]:
|
15
|
-
# * Grantee [Hash]:
|
16
|
-
# * DisplayName [String] Display name of grantee
|
17
|
-
# * ID [String] Id of grantee
|
18
|
-
# or
|
19
|
-
# * EmailAddress [String] Email address of grantee
|
20
|
-
# or
|
21
|
-
# * URI [String] URI of group to grant access for
|
22
|
-
# * Permission [String] Permission, in [FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP]
|
23
|
-
# * acl [String] Permissions, must be in ['private', 'public-read', 'public-read-write', 'authenticated-read']
|
24
|
-
#
|
25
|
-
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUTacl.html
|
26
|
-
|
27
|
-
def put_bucket_acl(bucket_name, acl)
|
28
|
-
data = ""
|
29
|
-
headers = {}
|
30
|
-
|
31
|
-
if acl.is_a?(Hash)
|
32
|
-
data = Fog::Storage::InternetArchive.hash_to_acl(acl)
|
33
|
-
else
|
34
|
-
if !['private', 'public-read', 'public-read-write', 'authenticated-read'].include?(acl)
|
35
|
-
raise Excon::Errors::BadRequest.new('invalid x-amz-acl')
|
36
|
-
end
|
37
|
-
headers['x-amz-acl'] = acl
|
38
|
-
end
|
39
|
-
|
40
|
-
headers['Content-MD5'] = Base64.encode64(Digest::MD5.digest(data)).strip
|
41
|
-
headers['Content-Type'] = 'application/json'
|
42
|
-
headers['Date'] = Fog::Time.now.to_date_header
|
43
|
-
|
44
|
-
request({
|
45
|
-
:body => data,
|
46
|
-
:expects => 200,
|
47
|
-
:headers => headers,
|
48
|
-
:host => "#{bucket_name}.#{@host}",
|
49
|
-
:method => 'PUT',
|
50
|
-
:query => {'acl' => nil}
|
51
|
-
})
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
class Mock
|
56
|
-
def put_bucket_acl(bucket_name, acl)
|
57
|
-
if acl.is_a?(Hash)
|
58
|
-
self.data[:acls][:bucket][bucket_name] = Fog::Storage::InternetArchive.hash_to_acl(acl)
|
59
|
-
else
|
60
|
-
if !['private', 'public-read', 'public-read-write', 'authenticated-read'].include?(acl)
|
61
|
-
raise Excon::Errors::BadRequest.new('invalid x-amz-acl')
|
62
|
-
end
|
63
|
-
self.data[:acls][:bucket][bucket_name] = acl
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|