Closed ptqa closed 5 years ago
Currently there is no pagination for ListAttributes and it's missing from https://github.com/aws/aws-sdk-ruby/blob/master/apis/ecs/2014-11-13/paginators-1.json
aws-sdk-ecs (1.36.0) aws-sdk-core (3.48.3)
ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
Basically it pagination works for stuff like list_container_instances:
require 'aws-sdk-ecs'; ecs = Aws::ECS::Client.new(http_wire_trace:true); cluster = "<CLUSTER_ARN>" ecs.list_container_instances(cluster: cluster, max_results:10).last_page? => false
But for list_attributes it doesn't:
require 'aws-sdk-ecs'; ecs = Aws::ECS::Client.new(http_wire_trace:true); cluster = "<CLUSTER_ARN>" r = ecs.list_attributes(cluster:cluster, target_type:'container-instance', max_results:1) opening connection to ecs.eu-west-1.amazonaws.com:443... opened starting SSL for ecs.eu-west-1.amazonaws.com:443... SSL established, protocol: TLSv1.2, cipher: ECDHE-RSA-AES128-SHA <- "POST / HTTP/1.1\r\nContent-Type: application/x-amz-json-1.1\r\nAccept-Encoding: \r\nUser-Agent: aws-sdk-ruby3/3.48.3 ruby/2.6.0 x86_64-linux aws-sdk-ecs/1.36.0\r\nX-Amz-Target: AmazonEC2ContainerServiceV20141113.ListAttributes\r\nHost: ecs.eu-west-1.amazonaws.com\r\nX-Amz-Date: 20190411T151609Z\r\nX-Amz-Content-Sha256: r\nAuthorization: AWS4-HMAC-SHA256 Credential=/eu-west-1/ecs/aws4_request, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target, Signature=\r\nContent-Length: 117\r\nAccept: */*\r\n\r\n" -> "HTTP/1.1 200 OK\r\n" -> "x-amzn-RequestId: bc78d77f-5c6c-11e9-a42c-5fb992cc1113\r\n" -> "Content-Type: application/x-amz-json-1.1\r\n" -> "Content-Length: 237\r\n" -> "Date: Thu, 11 Apr 2019 15:16:09 GMT\r\n" -> "\r\n" reading 237 bytes... -> "" -> "{\"attributes\":[{\"name\":\"ecs.capability.docker-plugin.local\",\"targetId\":\"<ARN>\"}],\"nextToken\":\"MDAwNjgyNTItYTk1YS00YjhiLWI3NDgtOWNlMThmZDc0ODYx\"}" read 237 bytes Conn keep-alive => #<struct Aws::ECS::Types::ListAttributesResponse attributes=[#<struct Aws::ECS::Types::Attribute name="ecs.capability.docker-plugin.local", value=nil, target_type=nil, target_id="<ARN>">], next_token="MDAwNjgyNTItYTk1YS00YjhiLWI3NDgtOWNlMThmZDc0ODYx"> [7] pry(main)> r.last_page? => true
As you can see this is not last page (there is next_token field). And there is more than one attribute in cluster:
[13] pry(main)> r = ecs.list_attributes(cluster:cluster, target_type:'container-instance', max_results:1).each {|x| puts x.attributes.size} 1 => nil [14] pry(main)> r = ecs.list_attributes(cluster:cluster, target_type:'container-instance', max_results:10).each {|x| puts x.attributes.size} 10 => nil
I've tried forking this repo and adding ListAttributes https://github.com/aws/aws-sdk-ruby/blob/master/apis/ecs/2014-11-13/paginators-1.json here but didn't work
Ah, didn't know I need to regenerate code. Will make PR
Missing pagination for ECS ListAttributes
Currently there is no pagination for ListAttributes and it's missing from https://github.com/aws/aws-sdk-ruby/blob/master/apis/ecs/2014-11-13/paginators-1.json
Gem versions
aws-sdk-ecs (1.36.0) aws-sdk-core (3.48.3)
Version of Ruby, OS environment
ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
Code snippets / steps to reproduce
Basically it pagination works for stuff like list_container_instances:
But for list_attributes it doesn't:
As you can see this is not last page (there is next_token field). And there is more than one attribute in cluster:
I've tried forking this repo and adding ListAttributes https://github.com/aws/aws-sdk-ruby/blob/master/apis/ecs/2014-11-13/paginators-1.json here but didn't work