Skip to content

Commit

Permalink
Regression fix for serializing structures for EC2.
Browse files Browse the repository at this point in the history
Fixes #881.
  • Loading branch information
trevorrowe committed Jul 28, 2015
1 parent db967a5 commit 3d5b9cc
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Unreleased Changes
------------------

* Issue - Aws::EC2 - Resolved a regression with serializing `Aws::Structure` types in
`Aws::EC2::Client` requests. The `Aws::Query::EC2ParamBuilder` class is responsible
for testing protocol specific implementations but it tests with input that is loaded
from a JSON document into a vanilla Ruby hash which does not trigger this behavior.

The other protocol builder classes have full unit test suites, while the EC2 param
builder did not. A test case has been added to cover this regression.

See [related GitHub issue #881](https://github.com/aws/aws-sdk-ruby/issues/881).

* Feature - KMS Client-Side-Encryption - Added support to `Aws::S3::Encryption::Client` for using AWS Key Management Service (KMS) to manage master encryption keys.

```ruby
Expand Down
2 changes: 1 addition & 1 deletion aws-sdk-core/lib/aws-sdk-core/query/ec2_param_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def apply(ref, params)

def structure(ref, values, prefix)
shape = ref.shape
values.each do |name, value|
values.each_pair do |name, value|
unless value.nil?
member_ref = shape.member(name)
format(member_ref, value, prefix + query_name(member_ref))
Expand Down
34 changes: 34 additions & 0 deletions aws-sdk-core/spec/aws/query/ec2_param_builder_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require 'spec_helper'

module Aws
module Query
describe EC2ParamBuilder do

let(:shapes) { ApiHelper.sample_shapes }

let(:rules) {
shape_map = Api::ShapeMap.new(shapes)
shape_map.shape_ref('shape' => 'StructureShape')
}

def query(params = {})
param_list = ParamList.new
EC2ParamBuilder.new(param_list).apply(rules, params)
param_list.map { |param| [param.name, param.value ] }.sort
end

it 'can serialize structures' do
params = Structure.new(*rules.shape.member_names).new
params.boolean = true
params.integer = 123
params.string = 'abc'
expect(query(params)).to eq([
['Boolean', 'true'],
['Integer', '123'],
['String', 'abc'],
])
end

end
end
end

0 comments on commit 3d5b9cc

Please sign in to comment.