{"action":"closed","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-net/issues/724","repository_url":"https://api.github.com/repos/aws/aws-sdk-net","labels_url":"https://api.github.com/repos/aws/aws-sdk-net/issues/724/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-net/issues/724/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-net/issues/724/events","html_url":"https://github.com/aws/aws-sdk-net/issues/724","id":249612711,"number":724,"title":"EC2.DescribeHostReservations() always returns an empty list","user":{"login":"arieltrevisan","id":6049260,"avatar_url":"https://avatars3.githubusercontent.com/u/6049260?v=4","gravatar_id":"","url":"https://api.github.com/users/arieltrevisan","html_url":"https://github.com/arieltrevisan","followers_url":"https://api.github.com/users/arieltrevisan/followers","following_url":"https://api.github.com/users/arieltrevisan/following{/other_user}","gists_url":"https://api.github.com/users/arieltrevisan/gists{/gist_id}","starred_url":"https://api.github.com/users/arieltrevisan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arieltrevisan/subscriptions","organizations_url":"https://api.github.com/users/arieltrevisan/orgs","repos_url":"https://api.github.com/users/arieltrevisan/repos","events_url":"https://api.github.com/users/arieltrevisan/events{/privacy}","received_events_url":"https://api.github.com/users/arieltrevisan/received_events","type":"User","site_admin":false},"labels":[{"id":130090460,"url":"https://api.github.com/repos/aws/aws-sdk-net/labels/Bug","name":"Bug","color":"e11d21","default":false},{"id":528835398,"url":"https://api.github.com/repos/aws/aws-sdk-net/labels/Service%20Issue","name":"Service Issue","color":"d93f0b","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-08-11T11:50:56Z","updated_at":"2017-08-15T23:13:08Z","closed_at":"2017-08-15T23:13:08Z","body":"## Expected Behavior\r\nDescribeHostReservations should return the list of Host Reservations the account has.\r\n\r\n## Current Behavior\r\nRegardless of the parameters used on the request for `DescribeHostReservations()`, it always returns an empty list of reservations because the unmarshaller is parsing the resulting XML incorrectly.\r\n\r\nIncoming XML structure:\r\n```\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<DescribeHostReservationsResponse xmlns=\"http://ec2.amazonaws.com/doc/2016-11-15/\">\r\n    <requestId></requestId>\r\n    <hostReservationSet>\r\n        <item>\r\n            <upfrontPrice></upfrontPrice>\r\n            <count></count>\r\n            <start></start>\r\n            <instanceFamily></instanceFamily>\r\n            <offeringId></offeringId>\r\n            <duration></duration>\r\n            <paymentOption></paymentOption>\r\n            <end></end>\r\n            <hostReservationId></hostReservationId>\r\n            <state></state>\r\n            <hourlyPrice></hourlyPrice>\r\n            <hostIdSet>\r\n                <item></item>\r\n            </hostIdSet>\r\n        </item>\r\n    </hostReservationSet>\r\n</DescribeHostReservationsResponse>\r\n```\r\n\r\nEach host reservation is listed as an `item` element inside `hostReservationSet`.\r\n\r\nThe resulting generated unmarshaller is trying to read items as `member`:\r\n```\r\nif (context.TestExpression(\"hostReservationSet/member\", targetDepth))\r\n```\r\n\r\n## Possible Solution\r\nDefine, in the EC2 service models file, the `locationName` as `item` to the `HostReservation` member of `HostReservationSet`.\r\n\r\n( Submitted Pull Request: #723  )\r\n\r\n## Steps to Reproduce\r\nCall `DescribeHostReservations()` for any account with Host Reservations, in a given region.\r\nThe list `HostReservationSet` will always be empty.\r\n\r\nSnippet:\r\n```\r\n// Fill in your credentials\r\nvar accessKey = \"AKIAXXXXXXXXXXXXXXXX\";\r\nvar secretKey = \"asdfasdfasdfasdfasdfasdfasdfasdfadfafasf\";\r\n\r\nvar request = new AssumeRoleRequest();\r\nrequest.ExternalId = \"MY-EXTERNAL-ID\";\r\nrequest.RoleArn = \"arn:aws:iam::000000000000:role/myrole\";\r\nrequest.RoleSessionName = \"myrole\";\r\n\r\nvar basicCredentials = new BasicAWSCredentials(accessKey, secretKey);\r\nusing (var securityTokenServiceClient = new AmazonSecurityTokenServiceClient(basicCredentials))\r\n{\r\n    var assumeRole = securityTokenServiceClient.AssumeRole(request);\r\n    var sessionCredential = new SessionAWSCredentials(assumeRole.Credentials.AccessKeyId, assumeRole.Credentials.SecretAccessKey, assumeRole.Credentials.SessionToken);\r\n    using (var client = new Amazon.EC2.AmazonEC2Client(sessionCredential, RegionEndpoint.USEast1))\r\n    {\r\n        var hrs = client.DescribeHostReservations(new Amazon.EC2.Model.DescribeHostReservationsRequest());\r\n\r\n        // This always returns an empty list\r\n        foreach (var item in hrs.HostReservationSet)\r\n        {\r\n            Console.WriteLine(\"{0}-{1}-{2}\", item.HostReservationId, item.UpfrontPrice, item.InstanceFamily);\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n## Environment\r\n* AWSSDK.Core version used: 3.3.17\r\n* Service assembly and version used: 3.3.13.6\r\n* Operating System and version: Windows 10 (Dev machine), Windows Server 2012 R2 (EC2 instance)\r\n* Visual Studio version: Visual Studio 2017, Version 15.2 (26430.16) Release\r\n* Targeted .NET platform: 4.5\r\n"}}
{"actor":{"display_login":"sstevenkang"}}