fog-aliyun 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +149 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Rakefile +3 -3
- data/fog-aliyun.gemspec +16 -13
- data/lib/fog/aliyun.rb +8 -8
- data/lib/fog/aliyun/compute.rb +99 -113
- data/lib/fog/aliyun/models/compute/eip_address.rb +23 -29
- data/lib/fog/aliyun/models/compute/eip_addresses.rb +3 -5
- data/lib/fog/aliyun/models/compute/image.rb +26 -28
- data/lib/fog/aliyun/models/compute/images.rb +2 -6
- data/lib/fog/aliyun/models/compute/route_entry.rb +9 -11
- data/lib/fog/aliyun/models/compute/route_entrys.rb +7 -7
- data/lib/fog/aliyun/models/compute/route_table.rb +10 -11
- data/lib/fog/aliyun/models/compute/route_tables.rb +2 -2
- data/lib/fog/aliyun/models/compute/security_group.rb +24 -24
- data/lib/fog/aliyun/models/compute/security_group_rule.rb +20 -20
- data/lib/fog/aliyun/models/compute/security_group_rules.rb +4 -4
- data/lib/fog/aliyun/models/compute/security_groups.rb +6 -7
- data/lib/fog/aliyun/models/compute/server.rb +42 -43
- data/lib/fog/aliyun/models/compute/servers.rb +9 -11
- data/lib/fog/aliyun/models/compute/snapshot.rb +15 -15
- data/lib/fog/aliyun/models/compute/snapshots.rb +6 -10
- data/lib/fog/aliyun/models/compute/volume.rb +36 -40
- data/lib/fog/aliyun/models/compute/volumes.rb +7 -11
- data/lib/fog/aliyun/models/compute/vpc.rb +18 -19
- data/lib/fog/aliyun/models/compute/vpcs.rb +5 -6
- data/lib/fog/aliyun/models/compute/vrouter.rb +13 -13
- data/lib/fog/aliyun/models/compute/vrouters.rb +4 -5
- data/lib/fog/aliyun/models/compute/vswitch.rb +18 -20
- data/lib/fog/aliyun/models/compute/vswitches.rb +6 -6
- data/lib/fog/aliyun/models/storage/directories.rb +10 -16
- data/lib/fog/aliyun/models/storage/directory.rb +8 -8
- data/lib/fog/aliyun/models/storage/file.rb +58 -64
- data/lib/fog/aliyun/models/storage/files.rb +95 -115
- data/lib/fog/aliyun/requests/compute/allocate_eip_address.rb +18 -44
- data/lib/fog/aliyun/requests/compute/allocate_public_ip_address.rb +12 -36
- data/lib/fog/aliyun/requests/compute/associate_eip_address.rb +16 -40
- data/lib/fog/aliyun/requests/compute/attach_disk.rb +19 -22
- data/lib/fog/aliyun/requests/compute/create_disk.rb +33 -63
- data/lib/fog/aliyun/requests/compute/create_image.rb +21 -21
- data/lib/fog/aliyun/requests/compute/create_security_group.rb +16 -16
- data/lib/fog/aliyun/requests/compute/create_security_group_egress_ip_rule.rb +22 -63
- data/lib/fog/aliyun/requests/compute/create_security_group_egress_sg_rule.rb +23 -61
- data/lib/fog/aliyun/requests/compute/create_security_group_ip_rule.rb +22 -63
- data/lib/fog/aliyun/requests/compute/create_security_group_sg_rule.rb +23 -61
- data/lib/fog/aliyun/requests/compute/create_server.rb +76 -78
- data/lib/fog/aliyun/requests/compute/create_snapshot.rb +12 -26
- data/lib/fog/aliyun/requests/compute/create_vpc.rb +11 -38
- data/lib/fog/aliyun/requests/compute/create_vswitch.rb +13 -40
- data/lib/fog/aliyun/requests/compute/delete_disk.rb +8 -35
- data/lib/fog/aliyun/requests/compute/delete_image.rb +6 -33
- data/lib/fog/aliyun/requests/compute/delete_security_group.rb +13 -13
- data/lib/fog/aliyun/requests/compute/delete_security_group_egress_ip_rule.rb +22 -63
- data/lib/fog/aliyun/requests/compute/delete_security_group_egress_sg_rule.rb +23 -61
- data/lib/fog/aliyun/requests/compute/delete_security_group_ip_rule.rb +22 -62
- data/lib/fog/aliyun/requests/compute/delete_security_group_sg_rule.rb +23 -61
- data/lib/fog/aliyun/requests/compute/delete_server.rb +15 -15
- data/lib/fog/aliyun/requests/compute/delete_snapshot.rb +6 -20
- data/lib/fog/aliyun/requests/compute/delete_vpc.rb +9 -26
- data/lib/fog/aliyun/requests/compute/delete_vswitch.rb +9 -25
- data/lib/fog/aliyun/requests/compute/detach_disk.rb +11 -27
- data/lib/fog/aliyun/requests/compute/join_security_group.rb +15 -16
- data/lib/fog/aliyun/requests/compute/leave_security_group.rb +15 -16
- data/lib/fog/aliyun/requests/compute/list_disks.rb +24 -43
- data/lib/fog/aliyun/requests/compute/list_eip_addresses.rb +26 -52
- data/lib/fog/aliyun/requests/compute/list_images.rb +21 -24
- data/lib/fog/aliyun/requests/compute/list_route_tables.rb +16 -19
- data/lib/fog/aliyun/requests/compute/list_security_group_rules.rb +22 -23
- data/lib/fog/aliyun/requests/compute/list_security_groups.rb +21 -24
- data/lib/fog/aliyun/requests/compute/list_server_types.rb +50 -50
- data/lib/fog/aliyun/requests/compute/list_servers.rb +25 -28
- data/lib/fog/aliyun/requests/compute/list_snapshots.rb +20 -37
- data/lib/fog/aliyun/requests/compute/list_vpcs.rb +12 -29
- data/lib/fog/aliyun/requests/compute/list_vrouters.rb +13 -16
- data/lib/fog/aliyun/requests/compute/list_vswitchs.rb +14 -31
- data/lib/fog/aliyun/requests/compute/list_zones.rb +16 -16
- data/lib/fog/aliyun/requests/compute/modify_vpc.rb +17 -17
- data/lib/fog/aliyun/requests/compute/modify_vswitch.rb +11 -39
- data/lib/fog/aliyun/requests/compute/reboot_server.rb +15 -16
- data/lib/fog/aliyun/requests/compute/release_eip_address.rb +12 -36
- data/lib/fog/aliyun/requests/compute/start_server.rb +14 -15
- data/lib/fog/aliyun/requests/compute/stop_server.rb +13 -14
- data/lib/fog/aliyun/requests/compute/unassociate_eip_address.rb +16 -41
- data/lib/fog/aliyun/requests/storage/copy_object.rb +11 -14
- data/lib/fog/aliyun/requests/storage/delete_bucket.rb +30 -30
- data/lib/fog/aliyun/requests/storage/delete_container.rb +11 -14
- data/lib/fog/aliyun/requests/storage/delete_object.rb +20 -22
- data/lib/fog/aliyun/requests/storage/get_bucket.rb +141 -148
- data/lib/fog/aliyun/requests/storage/get_container.rb +26 -38
- data/lib/fog/aliyun/requests/storage/get_containers.rb +20 -32
- data/lib/fog/aliyun/requests/storage/get_object.rb +12 -12
- data/lib/fog/aliyun/requests/storage/get_object_http_url.rb +11 -11
- data/lib/fog/aliyun/requests/storage/get_object_https_url.rb +11 -11
- data/lib/fog/aliyun/requests/storage/head_object.rb +11 -11
- data/lib/fog/aliyun/requests/storage/list_buckets.rb +40 -47
- data/lib/fog/aliyun/requests/storage/list_objects.rb +91 -104
- data/lib/fog/aliyun/requests/storage/put_bucket.rb +22 -23
- data/lib/fog/aliyun/requests/storage/put_container.rb +12 -12
- data/lib/fog/aliyun/requests/storage/put_object.rb +100 -110
- data/lib/fog/aliyun/storage.rb +209 -214
- data/lib/fog/aliyun/version.rb +1 -1
- data/lib/fog/bin/aliyun.rb +5 -5
- metadata +55 -4
@@ -11,30 +11,27 @@ module Fog
|
|
11
11
|
# * target_object<~String> - Name for new copy of object
|
12
12
|
# * options<~Hash> - Additional headers options={}
|
13
13
|
def copy_object(source_bucket, source_object, target_bucket, target_object, options = {})
|
14
|
-
options = options.reject {|
|
14
|
+
options = options.reject { |_key, value| value.nil? }
|
15
15
|
bucket = options[:bucket]
|
16
16
|
bucket ||= @aliyun_oss_bucket
|
17
17
|
source_bucket ||= bucket
|
18
18
|
target_bucket ||= bucket
|
19
19
|
headers = { 'x-oss-copy-source' => "/#{source_bucket}/#{source_object}" }
|
20
20
|
location = get_bucket_location(target_bucket)
|
21
|
-
endpoint =
|
22
|
-
resource = target_bucket+'/'+target_object
|
23
|
-
request(
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
:endpoint => endpoint
|
31
|
-
})
|
21
|
+
endpoint = 'http://' + location + '.aliyuncs.com'
|
22
|
+
resource = target_bucket + '/' + target_object
|
23
|
+
request(expects: [200, 203],
|
24
|
+
headers: headers,
|
25
|
+
method: 'PUT',
|
26
|
+
path: target_object,
|
27
|
+
bucket: target_bucket,
|
28
|
+
resource: resource,
|
29
|
+
endpoint: endpoint)
|
32
30
|
end
|
33
31
|
end
|
34
|
-
|
32
|
+
|
35
33
|
class Mock
|
36
34
|
def copy_object(source_bucket, source_object, target_bucket, target_object)
|
37
|
-
|
38
35
|
end
|
39
36
|
end
|
40
37
|
end
|
@@ -1,30 +1,30 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class Aliyun
|
4
|
-
class Real
|
5
|
-
# Delete an existing bucket
|
6
|
-
#
|
7
|
-
# ==== Parameters
|
8
|
-
# * bucket<~String> - Name of bucket to delete
|
9
|
-
#
|
10
|
-
def delete_bucket(bucket)
|
11
|
-
location = get_bucket_location(bucket)
|
12
|
-
endpoint =
|
13
|
-
resource = bucket+'/'
|
14
|
-
request(
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class Mock
|
25
|
-
def delete_bucket(bucket)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class Aliyun
|
4
|
+
class Real
|
5
|
+
# Delete an existing bucket
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * bucket<~String> - Name of bucket to delete
|
9
|
+
#
|
10
|
+
def delete_bucket(bucket)
|
11
|
+
location = get_bucket_location(bucket)
|
12
|
+
endpoint = 'http://' + location + '.aliyuncs.com'
|
13
|
+
resource = bucket + '/'
|
14
|
+
request(
|
15
|
+
expects: 204,
|
16
|
+
method: 'DELETE',
|
17
|
+
bucket: bucket,
|
18
|
+
resource: resource,
|
19
|
+
endpoint: endpoint
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Mock
|
25
|
+
def delete_bucket(bucket)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -8,29 +8,26 @@ module Fog
|
|
8
8
|
# * container<~String> - Name of container to delete
|
9
9
|
# * options
|
10
10
|
#
|
11
|
-
def delete_container(container, options={})
|
12
|
-
|
11
|
+
def delete_container(container, options = {})
|
13
12
|
bucket = options[:bucket]
|
14
13
|
bucket ||= @aliyun_oss_bucket
|
15
14
|
location = get_bucket_location(bucket)
|
16
|
-
endpoint =
|
17
|
-
object = container+'/'
|
18
|
-
resource = bucket+'/'+object
|
15
|
+
endpoint = 'http://' + location + '.aliyuncs.com'
|
16
|
+
object = container + '/'
|
17
|
+
resource = bucket + '/' + object
|
19
18
|
|
20
19
|
request(
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
expects: 204,
|
21
|
+
method: 'DELETE',
|
22
|
+
path: object,
|
23
|
+
bucket: bucket,
|
24
|
+
resource: resource,
|
25
|
+
endpoint: endpoint
|
27
26
|
)
|
28
27
|
end
|
29
28
|
end
|
30
29
|
class Mock
|
31
|
-
|
32
|
-
def delete_container(container, options={})
|
33
|
-
|
30
|
+
def delete_container(container, options = {})
|
34
31
|
end
|
35
32
|
end
|
36
33
|
end
|
@@ -7,45 +7,43 @@ module Fog
|
|
7
7
|
# ==== Parameters
|
8
8
|
# * object<~String> - Name of object to delete
|
9
9
|
#
|
10
|
-
def delete_object(object, options={})
|
10
|
+
def delete_object(object, options = {})
|
11
11
|
bucket = options[:bucket]
|
12
12
|
bucket ||= @aliyun_oss_bucket
|
13
13
|
location = get_bucket_location(bucket)
|
14
|
-
endpoint =
|
15
|
-
resource = bucket+'/'+object
|
14
|
+
endpoint = 'http://' + location + '.aliyuncs.com'
|
15
|
+
resource = bucket + '/' + object
|
16
16
|
request(
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
17
|
+
expects: 204,
|
18
|
+
method: 'DELETE',
|
19
|
+
path: object,
|
20
|
+
bucket: bucket,
|
21
|
+
resource: resource,
|
22
|
+
endpoint: endpoint
|
23
23
|
)
|
24
24
|
end
|
25
|
-
|
26
25
|
|
27
26
|
def abort_multipart_upload(bucket, object, endpoint, uploadid)
|
28
|
-
if
|
27
|
+
if nil == endpoint
|
29
28
|
location = get_bucket_location(bucket)
|
30
|
-
endpoint =
|
29
|
+
endpoint = 'http://' + location + '.aliyuncs.com'
|
31
30
|
end
|
32
|
-
path = object+
|
33
|
-
resource = bucket+'/'+path
|
31
|
+
path = object + '?uploadId=' + uploadid
|
32
|
+
resource = bucket + '/' + path
|
34
33
|
|
35
34
|
ret = request(
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
expects: 204,
|
36
|
+
method: 'DELETE',
|
37
|
+
path: path,
|
38
|
+
bucket: bucket,
|
39
|
+
resource: resource,
|
40
|
+
endpoint: endpoint
|
42
41
|
)
|
43
|
-
|
44
42
|
end
|
45
43
|
end
|
46
44
|
|
47
45
|
class Mock
|
48
|
-
def delete_object(object, options={})
|
46
|
+
def delete_object(object, options = {})
|
49
47
|
end
|
50
48
|
end
|
51
49
|
end
|
@@ -1,148 +1,141 @@
|
|
1
|
-
module Fog
|
2
|
-
module Storage
|
3
|
-
class Aliyun
|
4
|
-
class Real
|
5
|
-
def get_bucket(bucket)
|
6
|
-
location = get_bucket_location(bucket)
|
7
|
-
endpoint =
|
8
|
-
resource = bucket+'/'
|
9
|
-
ret = request(
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
)
|
16
|
-
xml = ret.data[:body]
|
17
|
-
result = XmlSimple.xml_in(xml)
|
18
|
-
end
|
19
|
-
|
20
|
-
def get_bucket_location(bucket)
|
21
|
-
attribute = '?location'
|
22
|
-
resource = bucket+'/'+attribute
|
23
|
-
ret = request(
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
)
|
30
|
-
location = XmlSimple.xml_in(ret.data[:body])
|
31
|
-
end
|
32
|
-
|
33
|
-
def get_bucket_acl(bucket)
|
34
|
-
location = get_bucket_location(bucket)
|
35
|
-
endpoint =
|
36
|
-
attribute = '?acl'
|
37
|
-
resource = bucket+'/'+attribute
|
38
|
-
ret = request(
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
)
|
46
|
-
acl = XmlSimple.xml_in(ret.data[:body])[
|
47
|
-
end
|
48
|
-
|
49
|
-
def get_bucket_CORSRules(bucket)
|
50
|
-
location = get_bucket_location(bucket)
|
51
|
-
endpoint =
|
52
|
-
attribute = '?cors'
|
53
|
-
resource = bucket+'/'+attribute
|
54
|
-
ret = request(
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
)
|
62
|
-
if 404 != ret.data[:status]
|
63
|
-
cors = XmlSimple.xml_in(ret.data[:body])[
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
class Mock
|
143
|
-
def get_bucket(bucket)
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class Aliyun
|
4
|
+
class Real
|
5
|
+
def get_bucket(bucket)
|
6
|
+
location = get_bucket_location(bucket)
|
7
|
+
endpoint = 'http://' + location + '.aliyuncs.com'
|
8
|
+
resource = bucket + '/'
|
9
|
+
ret = request(
|
10
|
+
expects: [200, 203],
|
11
|
+
method: 'GET',
|
12
|
+
bucket: bucket,
|
13
|
+
resource: resource,
|
14
|
+
endpoint: endpoint
|
15
|
+
)
|
16
|
+
xml = ret.data[:body]
|
17
|
+
result = XmlSimple.xml_in(xml)
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_bucket_location(bucket)
|
21
|
+
attribute = '?location'
|
22
|
+
resource = bucket + '/' + attribute
|
23
|
+
ret = request(
|
24
|
+
expects: [200, 203],
|
25
|
+
method: 'GET',
|
26
|
+
path: attribute,
|
27
|
+
bucket: bucket,
|
28
|
+
resource: resource
|
29
|
+
)
|
30
|
+
location = XmlSimple.xml_in(ret.data[:body])
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_bucket_acl(bucket)
|
34
|
+
location = get_bucket_location(bucket)
|
35
|
+
endpoint = 'http://' + location + '.aliyuncs.com'
|
36
|
+
attribute = '?acl'
|
37
|
+
resource = bucket + '/' + attribute
|
38
|
+
ret = request(
|
39
|
+
expects: [200, 203],
|
40
|
+
method: 'GET',
|
41
|
+
path: attribute,
|
42
|
+
bucket: bucket,
|
43
|
+
resource: resource,
|
44
|
+
endpoint: endpoint
|
45
|
+
)
|
46
|
+
acl = XmlSimple.xml_in(ret.data[:body])['AccessControlList'][0]['Grant'][0]
|
47
|
+
end
|
48
|
+
|
49
|
+
def get_bucket_CORSRules(bucket)
|
50
|
+
location = get_bucket_location(bucket)
|
51
|
+
endpoint = 'http://' + location + '.aliyuncs.com'
|
52
|
+
attribute = '?cors'
|
53
|
+
resource = bucket + '/' + attribute
|
54
|
+
ret = request(
|
55
|
+
expects: [200, 203, 404],
|
56
|
+
method: 'GET',
|
57
|
+
path: attribute,
|
58
|
+
bucket: bucket,
|
59
|
+
resource: resource,
|
60
|
+
endpoint: endpoint
|
61
|
+
)
|
62
|
+
if 404 != ret.data[:status]
|
63
|
+
cors = XmlSimple.xml_in(ret.data[:body])['CORSRule'][0]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def get_bucket_lifecycle(bucket)
|
68
|
+
location = get_bucket_location(bucket)
|
69
|
+
endpoint = 'http://' + location + '.aliyuncs.com'
|
70
|
+
attribute = '?lifecycle'
|
71
|
+
resource = bucket + '/' + attribute
|
72
|
+
ret = request(
|
73
|
+
expects: [200, 203, 404],
|
74
|
+
method: 'GET',
|
75
|
+
path: attribute,
|
76
|
+
bucket: bucket,
|
77
|
+
resource: resource,
|
78
|
+
endpoint: endpoint
|
79
|
+
)
|
80
|
+
if 404 != ret.data[:status]
|
81
|
+
lifecycle = XmlSimple.xml_in(ret.data[:body])['Rule'][0]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def get_bucket_logging(bucket)
|
86
|
+
location = get_bucket_location(bucket)
|
87
|
+
endpoint = 'http://' + location + '.aliyuncs.com'
|
88
|
+
attribute = '?logging'
|
89
|
+
resource = bucket + '/' + attribute
|
90
|
+
ret = request(
|
91
|
+
expects: [200, 203],
|
92
|
+
method: 'GET',
|
93
|
+
path: attribute,
|
94
|
+
bucket: bucket,
|
95
|
+
resource: resource,
|
96
|
+
endpoint: endpoint
|
97
|
+
)
|
98
|
+
logging = XmlSimple.xml_in(ret.data[:body])['LoggingEnabled'][0]['TargetPrefix']
|
99
|
+
end
|
100
|
+
|
101
|
+
def get_bucket_referer(bucket)
|
102
|
+
location = get_bucket_location(bucket)
|
103
|
+
endpoint = 'http://' + location + '.aliyuncs.com'
|
104
|
+
attribute = '?referer'
|
105
|
+
resource = bucket + '/' + attribute
|
106
|
+
ret = request(
|
107
|
+
expects: [200, 203],
|
108
|
+
method: 'GET',
|
109
|
+
path: attribute,
|
110
|
+
bucket: bucket,
|
111
|
+
resource: resource,
|
112
|
+
endpoint: endpoint
|
113
|
+
)
|
114
|
+
referer = XmlSimple.xml_in(ret.data[:body])
|
115
|
+
end
|
116
|
+
|
117
|
+
def get_bucket_website(bucket)
|
118
|
+
location = get_bucket_location(bucket)
|
119
|
+
endpoint = 'http://' + location + '.aliyuncs.com'
|
120
|
+
attribute = '?website'
|
121
|
+
resource = bucket + '/' + attribute
|
122
|
+
ret = request(
|
123
|
+
expects: [200, 203, 404],
|
124
|
+
method: 'GET',
|
125
|
+
path: attribute,
|
126
|
+
bucket: bucket,
|
127
|
+
resource: resource,
|
128
|
+
endpoint: endpoint
|
129
|
+
)
|
130
|
+
if 404 != ret.data[:status]
|
131
|
+
website = XmlSimple.xml_in(ret.data[:body])
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
class Mock
|
136
|
+
def get_bucket(bucket)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|