Comments (5)
Sorry, gave you the wrong link: https://github.com/aws/aws-sdk-ruby/blob/master/lib/aws/core/data.rb#L230
Fundamentally this lies, because methods defined on Object will never hit your method missing proxy, and therefore in this case I've duplicated AWS::Core::Data::List, which of course does not duplicate the array that it's delegating to.
from aws-sdk-ruby.
To clarify: it seems like the underlying issue here is that calling #dup
on Data::List
will not perform a deep copy-- that and the fact that our docs are misleading in reporting an "Array" return rather than the proper Data::List
class that is returned (which actually wraps the Array). I think we can fix both of those things, so that a) the docs don't refer to the returned instance data as a plain array, and, b) we can better handle dup to perform a deep copy so they work better when a user wants to mutate the original object.
from aws-sdk-ruby.
The AWS::Core::Data
classes were added quite a while ago. The client classes (like AWS::EC2::Client) used to construct responses where the values where dynamically created objects with methods punched onto them. This proved to be a performance bottle neck. To address the performance issues, the client response data objects were changed to plain old nested hashes and arrays.
AWS::Core::Data
and AWS::Core::Data::List
were added to provide a backwards compatible interface for accessing response data.
resp = ec2.client.describe_regions
# deprecated interface, currently handled via AWS::Core::Data
resp.region_info[0].region_name
# preferred access style
resp[:region_info].first[:region_name]
Accessing response data via #[]
returns plain old hashes and arrays. Accessing response attributes via named methods return these same structures wrapped. Method style access is deprecated and will not exist in version 2. Unfortunately some sections of the SDK still access response data via the old interfaces. The AWS::EC2::Instance#create
method is one such section. Unfortunately this abstraction leaked out because of the call to #map in this method.
I agree with Loren, the core data abstractions can be improved (to prevent this issue). That said, I consider this also a bug. The #create method previously did return an array and the documentation should probably not change. Ideally all such uses of response objects through method missing (that returns a core data object) should be removed.
from aws-sdk-ruby.
Commit 79cbc73 should resolve the immediate issue of AWS::EC2::InstanceCollection#create
not returning an actual array. Changes still need to be made to the core data classes.
from aws-sdk-ruby.
I pushed a branch with a proposed change to the core data classes (core-data-fix branch). You can view the changes here: bfc4dc6.
from aws-sdk-ruby.
Related Issues (20)
- [SES] Custom verification email template no redirect HOT 9
- SQS QueuePoller sometimes returns dupe messages, raises BatchEntryIdsNotDistinct HOT 1
- DynamoDB #query method returns response with items = nil HOT 18
- Aws::S3::PresignedPost does not support tagging field HOT 3
- Multipart copy for Glacier
- CognitoIdentityCredentials is not including the logins set when getting credentials, making all requests unauthenticated HOT 5
- `Aws::BedrockRuntime::Types::<X>` doesn't have `event_type=` HOT 3
- Listing shared RDS Clusters raises an ArgumentError HOT 6
- Errors downloading files from s3 are propagated to incorrect thread HOT 8
- aws-sdk-sqs raises NoMethodError when messages not found HOT 14
- Generate RBS HOT 15
- aws-partitions 1.856.0 no longer be found in that source HOT 8
- aws-sigv4/eventstream released a minor version bump after removing support for Ruby 2.3/2.4 HOT 5
- [aws-sdk-sqs] Aws::SQS::Types::SendMessageBatchResult#failed returns nil HOT 8
- aws-sdk-sesv2 API :next_token Symbol key literal doesn't work as expected (but String key does) HOT 4
- S3 Control Client - Unable to Parse URI HOT 6
- AWS Bedrock ReadTimeout NetworkingError TCPSocket closed HOT 3
- Tagging resources seems to be broken HOT 6
- Aws::Errors::MissingCredentialsError exception in ECS when using TaskRoleArn HOT 10
- Gem displays deprecation warning in ruby 3.3 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sdk-ruby.