aws-sdk-perl icon indicating copy to clipboard operation
aws-sdk-perl copied to clipboard

CodeDeploy - Can't locate object method "nextToken"

Open pprocacci opened this issue 6 years ago • 5 comments

+++ my $deploy = Paws->service('CodeDeploy', region => 'us-east-1'); print Dumper($deploy->ListAllApplications()); +++

The simple test script above yeilds:

Can't locate object method "nextToken" via package "Paws::CodeDeploy::ListApplicationsOutput" at /usr/local/lib/perl5/site_perl/Paws/CodeDeploy.pm line 239.

I would naturally expect it to return all applications.

pprocacci avatar Apr 20 '18 14:04 pprocacci

Hi,

This seems a problem with the code generators. As a workaround, you can call ListApplications manually, passing the appropiate parameters to get it working.

pplu avatar May 02 '18 17:05 pplu

Just for more info. What seems wrong is that everywhere it says nextToken, it should say NextToken. Can you confirm this works for you?

  sub ListAllDeployments {
    my $self = shift;

    my $callback = shift @_ if (ref($_[0]) eq 'CODE');
    my $result = $self->ListDeployments(@_);
    my $next_result = $result;

    if (not defined $callback) {
      while ($next_result->nextToken) {
        $next_result = $self->ListDeployments(@_, nextToken => $next_result->nextToken);
        push @{ $result->deployments }, @{ $next_result->deployments };
      }
      return $result;
    } else {
      while ($result->nextToken) {
        $callback->($_ => 'deployments') foreach (@{ $result->deployments });
        $result = $self->ListDeployments(@_, nextToken => $result->nextToken);
      }
      $callback->($_ => 'deployments') foreach (@{ $result->deployments });
    }

    return undef
  }

pplu avatar May 02 '18 20:05 pplu

The code you provided doesn't differ from the code in the Paws/CodeDeploy.pm.

pprocacci avatar May 18 '18 14:05 pprocacci

Same issue here with Health

use Paws;
use Data::Dumper;

my $obj = Paws->service('Health',region=>'us-east-1');
my $res = $obj->DescribeAllEvents();

print Dumper($res);

Can't locate object method "nextToken" via package "Paws::Health::DescribeEventsResponse" at /usr/local/share/perl/5.26.1/Paws/Health.pm line 103.

Any suggestions?

provector avatar Sep 25 '19 14:09 provector

@provector : It should work if you change nextToken for NextToken in the sub DescribeAllEvents.

pplu avatar Sep 30 '19 13:09 pplu