Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CloudControl Boto list_resources call for API Gateway API Keys returns max 25 resources #4166

Closed
lreeder-arpio opened this issue Jun 16, 2024 · 2 comments
Assignees
Labels
bug This issue is a confirmed bug. cloudcontrol service-api This issue is caused by the service API, not the SDK implementation.

Comments

@lreeder-arpio
Copy link

Describe the bug

When using the Boto CloudControl API to list API gateway keys (TypeName AWS::ApiGateway::ApiKey), only 25 resources are returned even though the account contains many more and the MaxResults argument is 100. In addition, the paginator only returns one page with 25 resources

Expected Behavior

When given TypeName=AWS::ApiGateway::ApiKey and MaxItems=100, list_resources API call should return 100 resources or all the resources in the account, whichever is less.

Current Behavior

When given TypeName=AWS::ApiGateway::ApiKey and MaxItems=100, list_resources API call only returns 25 resources, even though more are in the account.

Reproduction Steps

  • Use console, CLI, or API to create more than 25 API Gateway API Keys (I created 120).
  • Use the following boto code to list up to 100 API keys:
    cc_client = boto3.client('cloudcontrol', region_name=region)
    # max allowed for MaxResults is 100
    resp = cc_client.list_resources(TypeName='AWS::ApiGateway::ApiKey', MaxResults=100)
    resp_str = json.dumps(resp, indent=4, default=str)
    print(resp_str)
    total_count = len(resp['ResourceDescriptions'])
    print(f'Total item count: {total_count}')

Total item count is 25, and only 25 items are returned

Alternatively, use pagination to list the API keys:

    paginate_args = {'TypeName': 'AWS::ApiGateway::ApiKey'}

    paginate_args['PaginationConfig'] = {
        'MaxItems': 100
    }

    paginator = cc_client.get_paginator('list_resources')
    n = 1
    total_count = 0
    for page in paginator.paginate(**paginate_args):
        rd_count = len(page['ResourceDescriptions'])
        total_count = total_count + rd_count
        print(f'###############Page {n}: {rd_count} Resource Descriptions###############')

        n = n + 1
        resp_str = json.dumps(page, indent=4, default=str)
        print(resp_str)

    print(f'Total item count: {total_count}')

Only one page with 25 resources are returned.

Possible Solution

No response

Additional Information/Context

Tested in us-east-1

The API Gateway Boto API call get_api_keys does work correctly and returns all API keys.

SDK version used

Boto3 1.28.66

Environment details (OS name and version, etc.)

Linux 5.15.0-107-generic, Python 3.11.7

@lreeder-arpio lreeder-arpio added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Jun 16, 2024
@tim-finnigan tim-finnigan self-assigned this Jun 17, 2024
@tim-finnigan tim-finnigan added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Jun 17, 2024
@tim-finnigan tim-finnigan added service-api This issue is caused by the service API, not the SDK implementation. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. needs-triage This issue or PR still needs to be triaged. labels Jun 17, 2024
@tim-finnigan
Copy link
Contributor

tim-finnigan commented Jun 17, 2024

Thanks for reporting this issue. I could reproduce the behavior you described, also in the JS SDK as well. This issue therefore resides in the underlying ListResources API so we will need to escalate this to the Cloud Control team. I created a new issue for this in our cross-SDK repository to track going forward: aws/aws-sdk#764. Please refer to that issue for updates, and thanks again for bringing this to our attention.

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. cloudcontrol service-api This issue is caused by the service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

2 participants