fog 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +6 -0
- data/LICENSE +20 -0
- data/README.rdoc +7 -0
- data/Rakefile +98 -0
- data/VERSION +1 -0
- data/benchs/fog_vs.rb +135 -0
- data/benchs/headers_split_vs_match.rb +18 -0
- data/benchs/params.rb +43 -0
- data/benchs/parse_vs_push.rb +60 -0
- data/benchs/stripping.rb +26 -0
- data/lib/fog.rb +21 -0
- data/lib/fog/aws.rb +145 -0
- data/lib/fog/aws/ec2.rb +173 -0
- data/lib/fog/aws/models/ec2/address.rb +31 -0
- data/lib/fog/aws/models/ec2/addresses.rb +36 -0
- data/lib/fog/aws/models/ec2/key_pair.rb +35 -0
- data/lib/fog/aws/models/ec2/key_pairs.rb +36 -0
- data/lib/fog/aws/models/ec2/volume.rb +47 -0
- data/lib/fog/aws/models/ec2/volumes.rb +36 -0
- data/lib/fog/aws/models/s3/bucket.rb +77 -0
- data/lib/fog/aws/models/s3/buckets.rb +83 -0
- data/lib/fog/aws/models/s3/object.rb +76 -0
- data/lib/fog/aws/models/s3/objects.rb +97 -0
- data/lib/fog/aws/models/s3/owner.rb +18 -0
- data/lib/fog/aws/parsers/ec2/allocate_address.rb +19 -0
- data/lib/fog/aws/parsers/ec2/attach_volume.rb +22 -0
- data/lib/fog/aws/parsers/ec2/basic.rb +25 -0
- data/lib/fog/aws/parsers/ec2/create_key_pair.rb +20 -0
- data/lib/fog/aws/parsers/ec2/create_snapshot.rb +22 -0
- data/lib/fog/aws/parsers/ec2/create_volume.rb +24 -0
- data/lib/fog/aws/parsers/ec2/describe_addresses.rb +30 -0
- data/lib/fog/aws/parsers/ec2/describe_availability_zones.rb +30 -0
- data/lib/fog/aws/parsers/ec2/describe_images.rb +49 -0
- data/lib/fog/aws/parsers/ec2/describe_instances.rb +73 -0
- data/lib/fog/aws/parsers/ec2/describe_key_pairs.rb +30 -0
- data/lib/fog/aws/parsers/ec2/describe_regions.rb +30 -0
- data/lib/fog/aws/parsers/ec2/describe_security_groups.rb +75 -0
- data/lib/fog/aws/parsers/ec2/describe_snapshots.rb +30 -0
- data/lib/fog/aws/parsers/ec2/describe_volumes.rb +57 -0
- data/lib/fog/aws/parsers/ec2/detach_volume.rb +22 -0
- data/lib/fog/aws/parsers/ec2/get_console_output.rb +28 -0
- data/lib/fog/aws/parsers/ec2/run_instances.rb +65 -0
- data/lib/fog/aws/parsers/ec2/terminate_instances.rb +55 -0
- data/lib/fog/aws/parsers/s3/copy_object.rb +22 -0
- data/lib/fog/aws/parsers/s3/get_bucket.rb +46 -0
- data/lib/fog/aws/parsers/s3/get_bucket_location.rb +20 -0
- data/lib/fog/aws/parsers/s3/get_request_payment.rb +20 -0
- data/lib/fog/aws/parsers/s3/get_service.rb +32 -0
- data/lib/fog/aws/parsers/simpledb/basic.rb +31 -0
- data/lib/fog/aws/parsers/simpledb/domain_metadata.rb +30 -0
- data/lib/fog/aws/parsers/simpledb/get_attributes.rb +34 -0
- data/lib/fog/aws/parsers/simpledb/list_domains.rb +28 -0
- data/lib/fog/aws/parsers/simpledb/select.rb +39 -0
- data/lib/fog/aws/requests/ec2/allocate_address.rb +50 -0
- data/lib/fog/aws/requests/ec2/associate_address.rb +59 -0
- data/lib/fog/aws/requests/ec2/attach_volume.rb +71 -0
- data/lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb +32 -0
- data/lib/fog/aws/requests/ec2/create_key_pair.rb +60 -0
- data/lib/fog/aws/requests/ec2/create_security_group.rb +61 -0
- data/lib/fog/aws/requests/ec2/create_snapshot.rb +65 -0
- data/lib/fog/aws/requests/ec2/create_volume.rb +66 -0
- data/lib/fog/aws/requests/ec2/delete_key_pair.rb +49 -0
- data/lib/fog/aws/requests/ec2/delete_security_group.rb +52 -0
- data/lib/fog/aws/requests/ec2/delete_snapshot.rb +53 -0
- data/lib/fog/aws/requests/ec2/delete_volume.rb +55 -0
- data/lib/fog/aws/requests/ec2/describe_addresses.rb +61 -0
- data/lib/fog/aws/requests/ec2/describe_availability_zones.rb +64 -0
- data/lib/fog/aws/requests/ec2/describe_images.rb +41 -0
- data/lib/fog/aws/requests/ec2/describe_instances.rb +114 -0
- data/lib/fog/aws/requests/ec2/describe_key_pairs.rb +63 -0
- data/lib/fog/aws/requests/ec2/describe_regions.rb +61 -0
- data/lib/fog/aws/requests/ec2/describe_security_groups.rb +71 -0
- data/lib/fog/aws/requests/ec2/describe_snapshots.rb +78 -0
- data/lib/fog/aws/requests/ec2/describe_volumes.rb +85 -0
- data/lib/fog/aws/requests/ec2/detach_volume.rb +62 -0
- data/lib/fog/aws/requests/ec2/disassociate_address.rb +55 -0
- data/lib/fog/aws/requests/ec2/get_console_output.rb +26 -0
- data/lib/fog/aws/requests/ec2/reboot_instances.rb +24 -0
- data/lib/fog/aws/requests/ec2/release_address.rb +50 -0
- data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +32 -0
- data/lib/fog/aws/requests/ec2/run_instances.rb +134 -0
- data/lib/fog/aws/requests/ec2/terminate_instances.rb +80 -0
- data/lib/fog/aws/requests/s3/copy_object.rb +79 -0
- data/lib/fog/aws/requests/s3/delete_bucket.rb +53 -0
- data/lib/fog/aws/requests/s3/delete_object.rb +52 -0
- data/lib/fog/aws/requests/s3/get_bucket.rb +100 -0
- data/lib/fog/aws/requests/s3/get_bucket_location.rb +53 -0
- data/lib/fog/aws/requests/s3/get_object.rb +82 -0
- data/lib/fog/aws/requests/s3/get_request_payment.rb +53 -0
- data/lib/fog/aws/requests/s3/get_service.rb +58 -0
- data/lib/fog/aws/requests/s3/head_object.rb +61 -0
- data/lib/fog/aws/requests/s3/put_bucket.rb +69 -0
- data/lib/fog/aws/requests/s3/put_object.rb +76 -0
- data/lib/fog/aws/requests/s3/put_request_payment.rb +56 -0
- data/lib/fog/aws/requests/simpledb/batch_put_attributes.rb +31 -0
- data/lib/fog/aws/requests/simpledb/create_domain.rb +25 -0
- data/lib/fog/aws/requests/simpledb/delete_attributes.rb +34 -0
- data/lib/fog/aws/requests/simpledb/delete_domain.rb +25 -0
- data/lib/fog/aws/requests/simpledb/domain_metadata.rb +30 -0
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +35 -0
- data/lib/fog/aws/requests/simpledb/list_domains.rb +30 -0
- data/lib/fog/aws/requests/simpledb/put_attributes.rb +29 -0
- data/lib/fog/aws/requests/simpledb/select.rb +29 -0
- data/lib/fog/aws/s3.rb +157 -0
- data/lib/fog/aws/simpledb.rb +157 -0
- data/lib/fog/collection.rb +77 -0
- data/lib/fog/connection.rb +130 -0
- data/lib/fog/errors.rb +145 -0
- data/lib/fog/model.rb +72 -0
- data/lib/fog/parser.rb +30 -0
- data/lib/fog/response.rb +12 -0
- data/spec/aws/models/s3/bucket_spec.rb +130 -0
- data/spec/aws/models/s3/buckets_spec.rb +79 -0
- data/spec/aws/models/s3/object_spec.rb +121 -0
- data/spec/aws/models/s3/objects_spec.rb +112 -0
- data/spec/aws/models/s3/owner_spec.rb +18 -0
- data/spec/aws/requests/ec2/allocate_address_spec.rb +18 -0
- data/spec/aws/requests/ec2/associate_address_spec.rb +42 -0
- data/spec/aws/requests/ec2/attach_volume_spec.rb +53 -0
- data/spec/aws/requests/ec2/authorize_security_group_ingress_spec.rb +26 -0
- data/spec/aws/requests/ec2/create_key_pair_spec.rb +36 -0
- data/spec/aws/requests/ec2/create_security_group_spec.rb +34 -0
- data/spec/aws/requests/ec2/create_snapshot_spec.rb +37 -0
- data/spec/aws/requests/ec2/create_volume_spec.rb +23 -0
- data/spec/aws/requests/ec2/delete_key_pair_spec.rb +21 -0
- data/spec/aws/requests/ec2/delete_security_group_spec.rb +26 -0
- data/spec/aws/requests/ec2/delete_snapshot_spec.rb +35 -0
- data/spec/aws/requests/ec2/delete_volume_spec.rb +26 -0
- data/spec/aws/requests/ec2/describe_addresses_spec.rb +38 -0
- data/spec/aws/requests/ec2/describe_availability_zones_spec.rb +23 -0
- data/spec/aws/requests/ec2/describe_images_spec.rb +39 -0
- data/spec/aws/requests/ec2/describe_instances_spec.rb +86 -0
- data/spec/aws/requests/ec2/describe_key_pairs_spec.rb +42 -0
- data/spec/aws/requests/ec2/describe_regions_spec.rb +21 -0
- data/spec/aws/requests/ec2/describe_security_groups_spec.rb +51 -0
- data/spec/aws/requests/ec2/describe_snapshots_spec.rb +54 -0
- data/spec/aws/requests/ec2/describe_volumes_spec.rb +50 -0
- data/spec/aws/requests/ec2/detach_volume_spec.rb +43 -0
- data/spec/aws/requests/ec2/disassociate_address_spec.rb +35 -0
- data/spec/aws/requests/ec2/get_console_output_spec.rb +23 -0
- data/spec/aws/requests/ec2/reboot_instances_spec.rb +21 -0
- data/spec/aws/requests/ec2/release_address_spec.rb +26 -0
- data/spec/aws/requests/ec2/revoke_security_group_ingress_spec.rb +32 -0
- data/spec/aws/requests/ec2/run_instances_spec.rb +41 -0
- data/spec/aws/requests/ec2/terminate_instances_spec.rb +35 -0
- data/spec/aws/requests/s3/copy_object_spec.rb +62 -0
- data/spec/aws/requests/s3/delete_bucket_spec.rb +36 -0
- data/spec/aws/requests/s3/delete_object_spec.rb +37 -0
- data/spec/aws/requests/s3/get_bucket_location_spec.rb +30 -0
- data/spec/aws/requests/s3/get_bucket_spec.rb +110 -0
- data/spec/aws/requests/s3/get_object_spec.rb +45 -0
- data/spec/aws/requests/s3/get_request_payment_spec.rb +30 -0
- data/spec/aws/requests/s3/get_service_spec.rb +33 -0
- data/spec/aws/requests/s3/head_object_spec.rb +28 -0
- data/spec/aws/requests/s3/put_bucket_spec.rb +19 -0
- data/spec/aws/requests/s3/put_object_spec.rb +38 -0
- data/spec/aws/requests/s3/put_request_payment_spec.rb +29 -0
- data/spec/aws/requests/simpledb/batch_put_attributes_spec.rb +22 -0
- data/spec/aws/requests/simpledb/create_domain_spec.rb +21 -0
- data/spec/aws/requests/simpledb/delete_attributes_spec.rb +22 -0
- data/spec/aws/requests/simpledb/delete_domain_spec.rb +21 -0
- data/spec/aws/requests/simpledb/domain_metadata_spec.rb +43 -0
- data/spec/aws/requests/simpledb/get_attributes_spec.rb +31 -0
- data/spec/aws/requests/simpledb/list_domains_spec.rb +30 -0
- data/spec/aws/requests/simpledb/put_attributes_spec.rb +22 -0
- data/spec/aws/requests/simpledb/select_spec.rb +9 -0
- data/spec/lorem.txt +1 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +66 -0
- metadata +309 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module EC2
|
5
|
+
|
6
|
+
class DescribeSnapshots < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = { 'snapshotSet' => [] }
|
10
|
+
@snapshot = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def end_element(name)
|
14
|
+
case name
|
15
|
+
when 'item'
|
16
|
+
@response['snapshotSet'] << @snapshot
|
17
|
+
@snapshot = {}
|
18
|
+
when 'progress', 'snapshotId', 'status', 'volumeId'
|
19
|
+
@snapshot[name] = @value
|
20
|
+
when 'startTime'
|
21
|
+
@snapshot[name] = Time.parse(@value)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module EC2
|
5
|
+
|
6
|
+
class DescribeVolumes < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@attachment = {}
|
10
|
+
@in_attachment_set = false
|
11
|
+
@response = { 'volumeSet' => [] }
|
12
|
+
@volume = { 'attachmentSet' => [] }
|
13
|
+
end
|
14
|
+
|
15
|
+
def start_element(name, attrs = [])
|
16
|
+
if name == 'attachmentSet'
|
17
|
+
@in_attachment_set = true
|
18
|
+
end
|
19
|
+
@value = ''
|
20
|
+
end
|
21
|
+
|
22
|
+
def end_element(name)
|
23
|
+
if @in_attachment_set
|
24
|
+
case name
|
25
|
+
when 'attachmentSet'
|
26
|
+
@in_attachment_set = false
|
27
|
+
when 'attachTime'
|
28
|
+
@attachment[name] = Time.parse(@value)
|
29
|
+
when 'device', 'instanceId', 'status', 'volumeId'
|
30
|
+
@attachment[name] = @value
|
31
|
+
when 'item'
|
32
|
+
@volume['attachmentSet'] << @attachment
|
33
|
+
@attachment = {}
|
34
|
+
end
|
35
|
+
else
|
36
|
+
case name
|
37
|
+
when 'availabilityZone', 'snapshotId', 'status', 'volumeId'
|
38
|
+
@volume[name] = @value
|
39
|
+
when 'createTime'
|
40
|
+
@volume[name] = Time.parse(@value)
|
41
|
+
when 'item'
|
42
|
+
@response['volumeSet'] << @volume
|
43
|
+
@volume = { 'attachmentSet' => [] }
|
44
|
+
when 'requestId'
|
45
|
+
@response[name] = @value
|
46
|
+
when 'size'
|
47
|
+
@volume[name] = @value.to_i
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module EC2
|
5
|
+
|
6
|
+
class DetachVolume < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def end_element(name)
|
9
|
+
case name
|
10
|
+
when 'attachTime'
|
11
|
+
@response[name] = Time.parse(@value)
|
12
|
+
when 'device', 'instanceId', 'requestId', 'status', 'volumeId'
|
13
|
+
@response[name] = @value
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module EC2
|
5
|
+
|
6
|
+
class GetConsoleOutput < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def end_element(name)
|
13
|
+
case name
|
14
|
+
when 'instanceId', 'requestId'
|
15
|
+
@response[name] = @value
|
16
|
+
when 'output'
|
17
|
+
@response[name] = Base64.decode64(@value)
|
18
|
+
when 'timestamp'
|
19
|
+
@response[name] = Time.parse(@value)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module EC2
|
5
|
+
|
6
|
+
class RunInstances < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@instance = { 'instanceState' => {}, 'monitoring' => {}, 'placement' => {}, 'productCodes' => [] }
|
10
|
+
@response = { 'groupSet' => [], 'instancesSet' => [] }
|
11
|
+
end
|
12
|
+
|
13
|
+
def start_element(name, attrs = [])
|
14
|
+
if name == 'groupSet'
|
15
|
+
@in_group_set = true
|
16
|
+
elsif name == 'productCodes'
|
17
|
+
@in_product_codes = true
|
18
|
+
end
|
19
|
+
@value = ''
|
20
|
+
end
|
21
|
+
|
22
|
+
def end_element(name)
|
23
|
+
case name
|
24
|
+
when 'amiLaunchIndex'
|
25
|
+
@instance[name] = @value.to_i
|
26
|
+
when 'availabilityZone'
|
27
|
+
@instance['placement'][name] = @value
|
28
|
+
when 'code'
|
29
|
+
@instance['instanceState'][name] = @value.to_i
|
30
|
+
when 'dnsName', 'kernelId', 'keyName', 'imageId', 'instanceId', 'instanceType', 'platform', 'privateDnsName', 'ramdiskId', 'reason', 'requestorId'
|
31
|
+
@instance[name] = @value
|
32
|
+
when 'groupId'
|
33
|
+
@response['groupSet'] << @value
|
34
|
+
when 'groupSet'
|
35
|
+
@in_group_set = false
|
36
|
+
when 'item'
|
37
|
+
unless @in_group_set || @in_product_codes
|
38
|
+
@response['instancesSet'] << @instance
|
39
|
+
@instance = { 'instanceState' => {}, 'monitoring' => {}, 'placement' => {}, 'productCodes' => [] }
|
40
|
+
end
|
41
|
+
when 'launchTime'
|
42
|
+
@instance[name] = Time.parse(@value)
|
43
|
+
when 'name'
|
44
|
+
@instance['instanceState'][name] = @value
|
45
|
+
when 'ownerId', 'requestId', 'reservationId'
|
46
|
+
@response[name] = @value
|
47
|
+
when 'product_code'
|
48
|
+
@instance['productCodes'] << @value
|
49
|
+
when 'productCodes'
|
50
|
+
@in_product_codes = false
|
51
|
+
when 'state'
|
52
|
+
if @value == 'true'
|
53
|
+
@instance['monitoring'][name] = true
|
54
|
+
else
|
55
|
+
@instance['monitoring'][name] = false
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module EC2
|
5
|
+
|
6
|
+
class TerminateInstances < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@instance = { 'previousState' => {}, 'shutdownState' => {} }
|
10
|
+
@response = { 'instancesSet' => [] }
|
11
|
+
end
|
12
|
+
|
13
|
+
def start_element(name, attrs = [])
|
14
|
+
if name == 'previousState'
|
15
|
+
@in_previous_state = true
|
16
|
+
elsif name == 'shutdownState'
|
17
|
+
@in_shutdown_state = true
|
18
|
+
end
|
19
|
+
@value = ''
|
20
|
+
end
|
21
|
+
|
22
|
+
def end_element(name)
|
23
|
+
case name
|
24
|
+
when 'instanceId'
|
25
|
+
@instance[name] = @value
|
26
|
+
when 'item'
|
27
|
+
@response['instancesSet'] << @instance
|
28
|
+
@instance = { 'previousState' => {}, 'shutdownState' => {} }
|
29
|
+
when 'code'
|
30
|
+
if @in_previous_state
|
31
|
+
@instance['previousState'][name] = @value.to_i
|
32
|
+
elsif @in_shutdown_state
|
33
|
+
@instance['shutdownState'][name] = @value.to_i
|
34
|
+
end
|
35
|
+
when 'name'
|
36
|
+
if @in_previous_state
|
37
|
+
@instance['previousState'][name] = @value
|
38
|
+
elsif @in_shutdown_state
|
39
|
+
@instance['shutdownState'][name] = @value
|
40
|
+
end
|
41
|
+
when 'previousState'
|
42
|
+
@in_previous_state = false
|
43
|
+
when 'requestId'
|
44
|
+
@response[name] = @value
|
45
|
+
when 'shutdownState'
|
46
|
+
@in_shutdown_state = false
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module S3
|
5
|
+
|
6
|
+
class CopyObject < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def end_element(name)
|
9
|
+
case name
|
10
|
+
when 'ETag'
|
11
|
+
@response[name] = @value.gsub('"', '')
|
12
|
+
when 'LastModified'
|
13
|
+
@response[name] = Time.parse(@value)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module S3
|
5
|
+
|
6
|
+
class GetBucket < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@object = { 'Owner' => {} }
|
10
|
+
@response = { 'Contents' => [] }
|
11
|
+
end
|
12
|
+
|
13
|
+
def end_element(name)
|
14
|
+
case name
|
15
|
+
when 'Contents'
|
16
|
+
@response['Contents'] << @object
|
17
|
+
@object = { 'Owner' => {} }
|
18
|
+
when 'DisplayName', 'ID'
|
19
|
+
@object['Owner'][name] = @value
|
20
|
+
when 'ETag'
|
21
|
+
@object[name] = @value.gsub('"', '')
|
22
|
+
when 'IsTruncated'
|
23
|
+
if @value == 'true'
|
24
|
+
@response['IsTruncated'] = true
|
25
|
+
else
|
26
|
+
@response['IsTruncated'] = false
|
27
|
+
end
|
28
|
+
when 'LastModified'
|
29
|
+
@object['LastModified'] = Time.parse(@value)
|
30
|
+
when 'Marker', 'Name', 'Prefix'
|
31
|
+
@response[name] = @value
|
32
|
+
when 'MaxKeys'
|
33
|
+
@response['MaxKeys'] = @value.to_i
|
34
|
+
when 'Size'
|
35
|
+
@object['Size'] = @value.to_i
|
36
|
+
when 'Delimeter', 'Key', 'Name', 'StorageClass'
|
37
|
+
@object[name] = @value
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module S3
|
5
|
+
|
6
|
+
class GetBucketLocation < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def end_element(name)
|
9
|
+
case name
|
10
|
+
when 'LocationConstraint'
|
11
|
+
@response[name] = @value
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module S3
|
5
|
+
|
6
|
+
class GetService < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@bucket = {}
|
10
|
+
@response = { 'Owner' => {}, 'Buckets' => [] }
|
11
|
+
end
|
12
|
+
|
13
|
+
def end_element(name)
|
14
|
+
case name
|
15
|
+
when 'Bucket'
|
16
|
+
@response['Buckets'] << @bucket
|
17
|
+
@bucket = {}
|
18
|
+
when 'CreationDate'
|
19
|
+
@bucket['CreationDate'] = Time.parse(@value)
|
20
|
+
when 'DisplayName', 'ID'
|
21
|
+
@response['Owner'][name] = @value
|
22
|
+
when 'Name'
|
23
|
+
@bucket[name] = @value
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module SimpleDB
|
5
|
+
|
6
|
+
class Basic < Fog::Parsers::Base
|
7
|
+
|
8
|
+
def initialize(nil_string)
|
9
|
+
@nil_string = nil_string
|
10
|
+
reset
|
11
|
+
end
|
12
|
+
|
13
|
+
def end_element(name)
|
14
|
+
case(name)
|
15
|
+
when 'BoxUsage'
|
16
|
+
response[name] = @value.to_f
|
17
|
+
when 'RequestId'
|
18
|
+
response[name] = @value
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def sdb_decode(value)
|
23
|
+
value.eql?(@nil_string) ? nil : value
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module SimpleDB
|
5
|
+
|
6
|
+
class DomainMetadata < Fog::Parsers::AWS::SimpleDB::Basic
|
7
|
+
|
8
|
+
def reset
|
9
|
+
@response = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def end_element(name)
|
13
|
+
case name
|
14
|
+
when 'AttributeNameCount', 'AttributeNamesSizeBytes', 'AttributeValueCount', 'AttributeValuesSizeBytes', 'ItemCount', 'ItemNamesSizeBytes'
|
15
|
+
response[name] = @value.to_i
|
16
|
+
when 'BoxUsage'
|
17
|
+
response[name] = @value.to_f
|
18
|
+
when 'RequestId'
|
19
|
+
response[name] = @value
|
20
|
+
when 'Timestamp'
|
21
|
+
response[name] = Time.at(@value.to_i)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|