AWS SSM parameter store not fetching all key/values

后端 未结 3 494
萌比男神i
萌比男神i 2021-01-21 00:07

Could someone let me know why the below code only fetching few entries from the parameter store ?

   GetParametersByPathRequest getParametersByPathRequest = new          


        
3条回答
  •  有刺的猬
    2021-01-21 00:49

    GetParametersByPath is a paged operation. After each call you must retrieve NextToken from the result object, and if it's not null and not empty you must make another call with it added to the request.

    Here's an example using DescribeParameters, which has the same behavior:

    DescribeParametersRequest request = new DescribeParametersRequest();
    DescribeParametersResult response;
    do
    {
        response = client.describeParameters(request);
        for (ParameterMetadata param : response.getParameters())
        {
            // do something with metadata
        }
        request.setNextToken(response.getNextToken());
    }
    while ((response.getNextToken() != null) && ! respose.getNextToken.isEmpty());
    

提交回复
热议问题