miasma-aws 0.1.4 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/miasma-aws/version.rb +1 -1
- data/lib/miasma/contrib/aws.rb +9 -6
- data/lib/miasma/contrib/aws/orchestration.rb +5 -5
- data/lib/miasma/contrib/aws/storage.rb +69 -52
- data/miasma-aws.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3da765abdba597864cae9b1fe0b1c81900c2a94
|
4
|
+
data.tar.gz: b98aab91fd9511e26ca5dbc42a8a6b8dc1730f41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1ae3d106af0bcc11a2893a8efab2eabe9980090203409ccfb8127e09afb63df62887ea71a0ae55f7656a06903e59ac3b736bd9d101075f4f6613442a3316228
|
7
|
+
data.tar.gz: 5f49561b607f000311ec3f530426f2898ca1e9278d0bcb5e472811539df9aeef34e32fc7ff378d2d49ed7fe25bd80fa5813410680fcf400d1b08f7c9802c547e
|
data/CHANGELOG.md
CHANGED
data/lib/miasma-aws/version.rb
CHANGED
data/lib/miasma/contrib/aws.rb
CHANGED
@@ -394,18 +394,21 @@ module Miasma
|
|
394
394
|
# @param http_method [Symbol]
|
395
395
|
# @param request_args [Array]
|
396
396
|
# @return [HTTP::Response]
|
397
|
-
# @note if http_method is :post, params will be automatically
|
398
|
-
# removed and placed into :form
|
399
397
|
def make_request(connection, http_method, request_args)
|
400
398
|
dest, options = request_args
|
401
399
|
path = URI.parse(dest).path
|
402
400
|
options = options ? options.to_smash : Smash.new
|
403
|
-
|
404
|
-
if(http_method.to_sym == :post)
|
401
|
+
if(self.class::API_VERSION)
|
405
402
|
if(options[:form])
|
406
|
-
options
|
403
|
+
options.set(:form, 'Version', self.class::API_VERSION)
|
407
404
|
else
|
408
|
-
options[:
|
405
|
+
options[:params] = options.fetch(
|
406
|
+
:params, Smash.new
|
407
|
+
).to_smash.deep_merge(
|
408
|
+
Smash.new(
|
409
|
+
'Version' => self.class::API_VERSION
|
410
|
+
)
|
411
|
+
)
|
409
412
|
end
|
410
413
|
end
|
411
414
|
update_request(connection, options)
|
@@ -75,8 +75,8 @@ module Miasma
|
|
75
75
|
state = stk['StackStatus'].downcase.to_sym
|
76
76
|
unless(Miasma::Models::Orchestration::VALID_RESOURCE_STATES.include?(state))
|
77
77
|
parts = state.to_s.split('_')
|
78
|
-
state = [
|
79
|
-
unless(Miasma::Models::Orchestration::VALID_RESOURCE_STATES.include?(
|
78
|
+
state = [parts.first, *parts.slice(-2, parts.size)].join('_').to_sym
|
79
|
+
unless(Miasma::Models::Orchestration::VALID_RESOURCE_STATES.include?(parts))
|
80
80
|
state = :unknown
|
81
81
|
end
|
82
82
|
end
|
@@ -136,7 +136,7 @@ module Miasma
|
|
136
136
|
result = request(
|
137
137
|
:path => '/',
|
138
138
|
:method => :post,
|
139
|
-
:
|
139
|
+
:form => Smash.new(
|
140
140
|
'Action' => 'UpdateStack'
|
141
141
|
).merge(params)
|
142
142
|
)
|
@@ -148,7 +148,7 @@ module Miasma
|
|
148
148
|
result = request(
|
149
149
|
:path => '/',
|
150
150
|
:method => :post,
|
151
|
-
:
|
151
|
+
:form => Smash.new(
|
152
152
|
'Action' => 'CreateStack',
|
153
153
|
'DisableRollback' => !!stack.disable_rollback
|
154
154
|
).merge(params)
|
@@ -227,7 +227,7 @@ module Miasma
|
|
227
227
|
result = request(
|
228
228
|
:method => :post,
|
229
229
|
:path => '/',
|
230
|
-
:
|
230
|
+
:form => Smash.new(
|
231
231
|
'Action' => 'ValidateTemplate',
|
232
232
|
'TemplateBody' => MultiJson.dump(stack.template)
|
233
233
|
)
|
@@ -9,7 +9,7 @@ module Miasma
|
|
9
9
|
|
10
10
|
# Service name of the API
|
11
11
|
API_SERVICE = 's3'
|
12
|
-
# Supported version of the
|
12
|
+
# Supported version of the Storage API
|
13
13
|
API_VERSION = '2006-03-01'
|
14
14
|
|
15
15
|
include Contrib::AwsApiCore::ApiCommon
|
@@ -191,7 +191,7 @@ module Miasma
|
|
191
191
|
if(file.dirty?)
|
192
192
|
file.load_data(file.attributes)
|
193
193
|
args = Smash.new
|
194
|
-
|
194
|
+
headers = Smash[
|
195
195
|
Smash.new(
|
196
196
|
:content_type => 'Content-Type',
|
197
197
|
:content_disposition => 'Content-Disposition',
|
@@ -202,73 +202,90 @@ module Miasma
|
|
202
202
|
end
|
203
203
|
end.compact
|
204
204
|
]
|
205
|
-
|
205
|
+
unless(headers.empty?)
|
206
|
+
args[:headers] = headers
|
207
|
+
end
|
208
|
+
if(file.attributes[:body].respond_to?(:read) && file.attributes[:body].size >= Storage::MAX_BODY_SIZE_FOR_STRINGIFY)
|
206
209
|
upload_id = request(
|
207
210
|
args.merge(
|
208
211
|
Smash.new(
|
212
|
+
:method => :post,
|
209
213
|
:path => file_path(file),
|
210
|
-
:endpoint => bucket_endpoint(bucket),
|
214
|
+
:endpoint => bucket_endpoint(file.bucket),
|
211
215
|
:params => {
|
212
216
|
:uploads => true
|
213
217
|
}
|
214
218
|
)
|
215
219
|
)
|
216
220
|
).get(:body, 'InitiateMultipartUploadResult', 'UploadId')
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
'
|
244
|
-
|
221
|
+
begin
|
222
|
+
count = 1
|
223
|
+
parts = []
|
224
|
+
file.body.rewind
|
225
|
+
while(content = file.body.read(Storage::READ_BODY_CHUNK_SIZE))
|
226
|
+
parts << [
|
227
|
+
count,
|
228
|
+
request(
|
229
|
+
:method => :put,
|
230
|
+
:path => file_path(file),
|
231
|
+
:endpoint => bucket_endpoint(file.bucket),
|
232
|
+
:headers => Smash.new(
|
233
|
+
'Content-Length' => content.size,
|
234
|
+
'Content-MD5' => Base64.urlsafe_encode64(Digest::MD5.digest(content))
|
235
|
+
),
|
236
|
+
:params => Smash.new(
|
237
|
+
'partNumber' => count,
|
238
|
+
'uploadId' => upload_id
|
239
|
+
),
|
240
|
+
:body => content
|
241
|
+
).get(:headers, :etag)
|
242
|
+
]
|
243
|
+
count += 1
|
244
|
+
end
|
245
|
+
complete = XmlSimple.xml_out(
|
246
|
+
Smash.new(
|
247
|
+
'CompleteMultipartUpload' => {
|
248
|
+
'Part' => parts.map{|part|
|
249
|
+
{'PartNumber' => part.first, 'ETag' => part.last}
|
250
|
+
}
|
245
251
|
}
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
252
|
+
),
|
253
|
+
'AttrPrefix' => true,
|
254
|
+
'KeepRoot' => true
|
255
|
+
)
|
256
|
+
result = request(
|
257
|
+
:method => :post,
|
258
|
+
:path => file_path(file),
|
259
|
+
:endpoint => bucket_endpoint(file.bucket),
|
260
|
+
:params => Smash.new(
|
261
|
+
'uploadId' => upload_id
|
262
|
+
),
|
263
|
+
:headers => Smash.new(
|
264
|
+
'Content-Length' => complete.size
|
265
|
+
),
|
266
|
+
:body => complete
|
267
|
+
)
|
268
|
+
file.etag = result.get(:body, 'CompleteMultipartUploadResult', 'ETag')
|
269
|
+
rescue
|
270
|
+
request(
|
271
|
+
:method => :delete,
|
272
|
+
:path => file_path(file),
|
273
|
+
:endpoint => bucket_endpoint(file.bucket),
|
274
|
+
:params => {
|
275
|
+
'uploadId' => upload_id
|
276
|
+
},
|
277
|
+
:expects => 204
|
278
|
+
)
|
279
|
+
raise
|
280
|
+
end
|
264
281
|
else
|
265
282
|
if(file.attributes[:body].respond_to?(:readpartial))
|
266
|
-
args
|
283
|
+
args.set(:headers, 'Content-Length', file.body.size.to_s)
|
267
284
|
file.body.rewind
|
268
285
|
args[:body] = file.body.readpartial(file.body.size)
|
269
286
|
file.body.rewind
|
270
287
|
else
|
271
|
-
args
|
288
|
+
args.set(:headers, 'Content-Length', 0)
|
272
289
|
end
|
273
290
|
result = request(
|
274
291
|
args.merge(
|
data/miasma-aws.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.description = 'Smoggy AWS API'
|
11
11
|
s.license = 'Apache 2.0'
|
12
12
|
s.require_path = 'lib'
|
13
|
-
s.add_development_dependency 'miasma', '>= 0.2.
|
13
|
+
s.add_development_dependency 'miasma', '>= 0.2.18'
|
14
14
|
s.add_development_dependency 'pry'
|
15
15
|
s.add_development_dependency 'minitest'
|
16
16
|
s.add_development_dependency 'vcr'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miasma-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: miasma
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.2.
|
19
|
+
version: 0.2.18
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.2.
|
26
|
+
version: 0.2.18
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|