{"action":"created","comment":{"url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls/comments/78740523","id":78740523,"diff_hunk":"@@ -1347,38 +1351,85 @@ attribute_xpath(block_device_mapping, AttributeName) ->\n attribute_xpath(_, AttributeName) ->\n     \"/DescribeInstanceAttributeResponse/\" ++ AttributeName ++ \"/value\".\n \n+describe_instances() ->\n+    describe_instances([],[],default_config()).\n \n-%%\n-%%\n--spec(describe_instances/0 :: () -> proplist()).\n-describe_instances() -> describe_instances([]).\n-\n--spec(describe_instances/1 :: ([string()] | aws_config()) -> proplist()).\n describe_instances(Config)\n-  when is_record(Config, aws_config) ->\n-    describe_instances([], Config);\n-describe_instances(InstanceIDs) ->\n-    describe_instances(InstanceIDs, [], default_config()).\n-\n--spec(describe_instances/2 :: ([string()], filter_list() | aws_config()) -> proplist()).\n+    when is_record(Config, aws_config) ->\n+    describe_instances([], [], Config);\n+describe_instances(InstanceIDs)\n+    when is_list(InstanceIDs) ->\n+    describe_instances(InstanceIDs, [], default_config());\n+describe_instances(MaxResults)\n+    when (is_integer(MaxResults) andalso MaxResults >= 5 andalso MaxResults =< 1000) orelse (MaxResults == undefined) ->\n+    describe_instances(MaxResults, undefined, default_config()).\n+\n+describe_instances(InstanceIDs, Filter)\n+    when is_list(InstanceIDs), is_list(Filter) ->\n+    describe_instances(InstanceIDs, Filter, default_config());\n describe_instances(InstanceIDs, Config)\n-  when is_record(Config, aws_config) ->\n+    when is_list(InstanceIDs), is_record(Config, aws_config) ->\n     describe_instances(InstanceIDs, [], Config);\n-describe_instances(InstanceIDs, Filter) ->\n-    describe_instances(InstanceIDs, Filter, default_config()).\n+describe_instances(MaxResults, Config)\n+    when (is_integer(MaxResults) andalso MaxResults >= 5 andalso MaxResults =< 1000) orelse (MaxResults == undefined), is_record(Config, aws_config) ->\n+    describe_instances(MaxResults, undefined, Config);\n+describe_instances(MaxResults, NextToken)\n+    when (is_integer(MaxResults) andalso MaxResults >= 5 andalso MaxResults =< 1000) orelse (MaxResults == undefined), (is_list(NextToken)) orelse (NextToken == undefined) ->\n+    describe_instances(MaxResults, NextToken,default_config());\n+describe_instances(NextToken, Config)\n+    when (is_list(NextToken)) orelse (NextToken == undefined), is_record(Config, aws_config) ->\n+    describe_instances(undefined, NextToken, Config).\n \n--spec(describe_instances/3 :: ([string()], filter_list(), aws_config()) -> proplist()).\n describe_instances(InstanceIDs, Filter, Config)\n-  when is_list(InstanceIDs) ->\n+    when is_list(InstanceIDs), is_list(Filter), is_record(Config, aws_config) ->\n     Params = erlcloud_aws:param_list(InstanceIDs, \"InstanceId\") ++ list_to_ec2_filter(Filter),\n     case ec2_query(Config, \"DescribeInstances\", Params, ?NEW_API_VERSION) of\n         {ok, Doc} ->\n             Reservations = xmerl_xpath:string(\"/DescribeInstancesResponse/reservationSet/item\", Doc),\n             {ok, [extract_reservation(Item) || Item <- Reservations]};\n         {error, Reason} ->\n             {error, Reason}\n+    end;\n+describe_instances(MaxResults, NextToken, Config)","path":"src/erlcloud_ec2.erl","position":82,"original_position":82,"commit_id":"aa76753b1bbb3dd74fad5cc878fed9cd43ef6efa","original_commit_id":"aa76753b1bbb3dd74fad5cc878fed9cd43ef6efa","user":{"login":"ddosia","id":380622,"avatar_url":"https://avatars.githubusercontent.com/u/380622?v=3","gravatar_id":"","url":"https://api.github.com/users/ddosia","html_url":"https://github.com/ddosia","followers_url":"https://api.github.com/users/ddosia/followers","following_url":"https://api.github.com/users/ddosia/following{/other_user}","gists_url":"https://api.github.com/users/ddosia/gists{/gist_id}","starred_url":"https://api.github.com/users/ddosia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddosia/subscriptions","organizations_url":"https://api.github.com/users/ddosia/orgs","repos_url":"https://api.github.com/users/ddosia/repos","events_url":"https://api.github.com/users/ddosia/events{/privacy}","received_events_url":"https://api.github.com/users/ddosia/received_events","type":"User","site_admin":false},"body":"I would rather not mingle with different arguments on the same places. If I correctly understood the semantic of ec2 you need the *token* and the *number of items*, so in my opinion interface like:\r\n```erlang\r\n-spec describe_instances([InstanceID :: string()], filter_list(), {ec2_token() | undefiend, ItemCount}, aws_config()) when ItmeCount >= 5, ItemCount =< 1000 -> proplist().\r\n```\r\n\r\nwould be better.\r\n\r\nAlso where these constants (`5` and `1000`) comes from?\r\nAlso can we use pagination access together with `InstanceIDs`?","created_at":"2016-09-14T12:44:40Z","updated_at":"2016-09-14T12:44:40Z","html_url":"https://github.com/SergeyOvchinnik/erlcloud/pull/1#discussion_r78740523","pull_request_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls/comments/78740523"},"html":{"href":"https://github.com/SergeyOvchinnik/erlcloud/pull/1#discussion_r78740523"},"pull_request":{"href":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls/1","id":85193203,"html_url":"https://github.com/SergeyOvchinnik/erlcloud/pull/1","diff_url":"https://github.com/SergeyOvchinnik/erlcloud/pull/1.diff","patch_url":"https://github.com/SergeyOvchinnik/erlcloud/pull/1.patch","issue_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/issues/1","number":1,"state":"open","locked":false,"title":"Implemented pagination feature in erlcloud_ec2:describe_instances","user":{"login":"SergeyOvchinnik","id":8599706,"avatar_url":"https://avatars.githubusercontent.com/u/8599706?v=3","gravatar_id":"","url":"https://api.github.com/users/SergeyOvchinnik","html_url":"https://github.com/SergeyOvchinnik","followers_url":"https://api.github.com/users/SergeyOvchinnik/followers","following_url":"https://api.github.com/users/SergeyOvchinnik/following{/other_user}","gists_url":"https://api.github.com/users/SergeyOvchinnik/gists{/gist_id}","starred_url":"https://api.github.com/users/SergeyOvchinnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergeyOvchinnik/subscriptions","organizations_url":"https://api.github.com/users/SergeyOvchinnik/orgs","repos_url":"https://api.github.com/users/SergeyOvchinnik/repos","events_url":"https://api.github.com/users/SergeyOvchinnik/events{/privacy}","received_events_url":"https://api.github.com/users/SergeyOvchinnik/received_events","type":"User","site_admin":false},"body":"Problem: \r\nFunction describe_instances in erlcloud_ec2 did not support pagination feature on library level\r\n\r\nSolution:\r\nImplemented pagination feature for erlcloud_ec2:describe_instances function\r\n\r\nReviewers:\r\n@ddosia","created_at":"2016-09-14T09:21:11Z","updated_at":"2016-09-14T12:44:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ff16c7395eb68039547b027ecb6f30ee113dd30","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls/1/commits","review_comments_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls/1/comments","review_comment_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/issues/1/comments","statuses_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/statuses/aa76753b1bbb3dd74fad5cc878fed9cd43ef6efa","head":{"label":"SergeyOvchinnik:sovchinnik-erlcloud-ec2-pagination-feature","ref":"sovchinnik-erlcloud-ec2-pagination-feature","sha":"aa76753b1bbb3dd74fad5cc878fed9cd43ef6efa","user":{"login":"SergeyOvchinnik","id":8599706,"avatar_url":"https://avatars.githubusercontent.com/u/8599706?v=3","gravatar_id":"","url":"https://api.github.com/users/SergeyOvchinnik","html_url":"https://github.com/SergeyOvchinnik","followers_url":"https://api.github.com/users/SergeyOvchinnik/followers","following_url":"https://api.github.com/users/SergeyOvchinnik/following{/other_user}","gists_url":"https://api.github.com/users/SergeyOvchinnik/gists{/gist_id}","starred_url":"https://api.github.com/users/SergeyOvchinnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergeyOvchinnik/subscriptions","organizations_url":"https://api.github.com/users/SergeyOvchinnik/orgs","repos_url":"https://api.github.com/users/SergeyOvchinnik/repos","events_url":"https://api.github.com/users/SergeyOvchinnik/events{/privacy}","received_events_url":"https://api.github.com/users/SergeyOvchinnik/received_events","type":"User","site_admin":false},"repo":{"id":68124357,"name":"erlcloud","full_name":"SergeyOvchinnik/erlcloud","owner":{"login":"SergeyOvchinnik","id":8599706,"avatar_url":"https://avatars.githubusercontent.com/u/8599706?v=3","gravatar_id":"","url":"https://api.github.com/users/SergeyOvchinnik","html_url":"https://github.com/SergeyOvchinnik","followers_url":"https://api.github.com/users/SergeyOvchinnik/followers","following_url":"https://api.github.com/users/SergeyOvchinnik/following{/other_user}","gists_url":"https://api.github.com/users/SergeyOvchinnik/gists{/gist_id}","starred_url":"https://api.github.com/users/SergeyOvchinnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergeyOvchinnik/subscriptions","organizations_url":"https://api.github.com/users/SergeyOvchinnik/orgs","repos_url":"https://api.github.com/users/SergeyOvchinnik/repos","events_url":"https://api.github.com/users/SergeyOvchinnik/events{/privacy}","received_events_url":"https://api.github.com/users/SergeyOvchinnik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SergeyOvchinnik/erlcloud","description":"Cloud Computing library for erlang (Amazon EC2, S3, SQS, SimpleDB, Mechanical Turk, ELB)","fork":true,"url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud","forks_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/forks","keys_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/teams","hooks_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/hooks","issue_events_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/issues/events{/number}","events_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/events","assignees_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/assignees{/user}","branches_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/branches{/branch}","tags_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/tags","blobs_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/git/refs{/sha}","trees_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/statuses/{sha}","languages_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/languages","stargazers_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/stargazers","contributors_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/contributors","subscribers_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/subscribers","subscription_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/subscription","commits_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/commits{/sha}","git_commits_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/git/commits{/sha}","comments_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/comments{/number}","issue_comment_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/issues/comments{/number}","contents_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/contents/{+path}","compare_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/merges","archive_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/downloads","issues_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/issues{/number}","pulls_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls{/number}","milestones_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/milestones{/number}","notifications_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/labels{/name}","releases_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/releases{/id}","deployments_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/deployments","created_at":"2016-09-13T16:04:50Z","updated_at":"2016-09-13T16:04:52Z","pushed_at":"2016-09-14T09:21:11Z","git_url":"git://github.com/SergeyOvchinnik/erlcloud.git","ssh_url":"git@github.com:SergeyOvchinnik/erlcloud.git","clone_url":"https://github.com/SergeyOvchinnik/erlcloud.git","svn_url":"https://github.com/SergeyOvchinnik/erlcloud","homepage":"","size":3343,"stargazers_count":0,"watchers_count":0,"language":"Erlang","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"SergeyOvchinnik:master","ref":"master","sha":"20db9233a56fd80e7b8439ef1c34cd49f8a5c63d","user":{"login":"SergeyOvchinnik","id":8599706,"avatar_url":"https://avatars.githubusercontent.com/u/8599706?v=3","gravatar_id":"","url":"https://api.github.com/users/SergeyOvchinnik","html_url":"https://github.com/SergeyOvchinnik","followers_url":"https://api.github.com/users/SergeyOvchinnik/followers","following_url":"https://api.github.com/users/SergeyOvchinnik/following{/other_user}","gists_url":"https://api.github.com/users/SergeyOvchinnik/gists{/gist_id}","starred_url":"https://api.github.com/users/SergeyOvchinnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergeyOvchinnik/subscriptions","organizations_url":"https://api.github.com/users/SergeyOvchinnik/orgs","repos_url":"https://api.github.com/users/SergeyOvchinnik/repos","events_url":"https://api.github.com/users/SergeyOvchinnik/events{/privacy}","received_events_url":"https://api.github.com/users/SergeyOvchinnik/received_events","type":"User","site_admin":false},"repo":{"id":68124357,"name":"erlcloud","full_name":"SergeyOvchinnik/erlcloud","owner":{"login":"SergeyOvchinnik","id":8599706,"avatar_url":"https://avatars.githubusercontent.com/u/8599706?v=3","gravatar_id":"","url":"https://api.github.com/users/SergeyOvchinnik","html_url":"https://github.com/SergeyOvchinnik","followers_url":"https://api.github.com/users/SergeyOvchinnik/followers","following_url":"https://api.github.com/users/SergeyOvchinnik/following{/other_user}","gists_url":"https://api.github.com/users/SergeyOvchinnik/gists{/gist_id}","starred_url":"https://api.github.com/users/SergeyOvchinnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergeyOvchinnik/subscriptions","organizations_url":"https://api.github.com/users/SergeyOvchinnik/orgs","repos_url":"https://api.github.com/users/SergeyOvchinnik/repos","events_url":"https://api.github.com/users/SergeyOvchinnik/events{/privacy}","received_events_url":"https://api.github.com/users/SergeyOvchinnik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SergeyOvchinnik/erlcloud","description":"Cloud Computing library for erlang (Amazon EC2, S3, SQS, SimpleDB, Mechanical Turk, ELB)","fork":true,"url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud","forks_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/forks","keys_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/teams","hooks_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/hooks","issue_events_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/issues/events{/number}","events_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/events","assignees_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/assignees{/user}","branches_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/branches{/branch}","tags_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/tags","blobs_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/git/refs{/sha}","trees_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/statuses/{sha}","languages_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/languages","stargazers_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/stargazers","contributors_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/contributors","subscribers_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/subscribers","subscription_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/subscription","commits_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/commits{/sha}","git_commits_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/git/commits{/sha}","comments_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/comments{/number}","issue_comment_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/issues/comments{/number}","contents_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/contents/{+path}","compare_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/merges","archive_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/downloads","issues_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/issues{/number}","pulls_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls{/number}","milestones_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/milestones{/number}","notifications_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/labels{/name}","releases_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/releases{/id}","deployments_url":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/deployments","created_at":"2016-09-13T16:04:50Z","updated_at":"2016-09-13T16:04:52Z","pushed_at":"2016-09-14T09:21:11Z","git_url":"git://github.com/SergeyOvchinnik/erlcloud.git","ssh_url":"git@github.com:SergeyOvchinnik/erlcloud.git","clone_url":"https://github.com/SergeyOvchinnik/erlcloud.git","svn_url":"https://github.com/SergeyOvchinnik/erlcloud","homepage":"","size":3343,"stargazers_count":0,"watchers_count":0,"language":"Erlang","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls/1"},"html":{"href":"https://github.com/SergeyOvchinnik/erlcloud/pull/1"},"issue":{"href":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/issues/1"},"comments":{"href":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/SergeyOvchinnik/erlcloud/statuses/aa76753b1bbb3dd74fad5cc878fed9cd43ef6efa"}}}}
{"actor":{"display_login":"ddosia"}}