Skip to content

Docs: Incorrect example for SSMProvider.get_multiple #2749

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

Closed
1 task done
bram-tv opened this issue Jul 11, 2023 · 6 comments
Closed
1 task done

Docs: Incorrect example for SSMProvider.get_multiple #2749

bram-tv opened this issue Jul 11, 2023 · 6 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement

Comments

@bram-tv
Copy link

bram-tv commented Jul 11, 2023

What were you searching in the docs?

Documentation for the get_multiple call of the SSMProvider.

Is this related to an existing documentation section?

https://docs.powertools.aws.dev/lambda/python/latest/api/utilities/parameters/ssm.html

How can we improve?

The examples listed under:

  • Retrieves multiple parameter values from Systems Manager Parameter Store using a path prefix
  • Retrieves multiple parameter values from Systems Manager Parameter Store passing options to the SDK call

do not appear to be correct.

Taking the first example:

>>> from aws_lambda_powertools.utilities.parameters import SSMProvider
>>> ssm_provider = SSMProvider()
>>>
>>> values = ssm_provider.get_multiple("/my/path/prefix")
>>>
>>> for key, value in values.items():
...     print(key, value)
/my/path/prefix/a   Parameter value a
/my/path/prefix/b   Parameter value b
/my/path/prefix/c   Parameter value c

This shows that /my/path/prefix/ is part of the key name but that is not (or no longer the case).
Looking at the code:

                # Standardize the parameter name
                # The parameter name returned by SSM will contain the full path.
                # However, for readability, we should return only the part after
                # the path.
                name = parameter["Name"]
                if name.startswith(path):
                    name = name[len(path) :]
                name = name.lstrip("/")

It always removes the path from the name.

Got a suggestion in mind?

Updates the example to:

>>> ...
>>> for key, value in values.items():
...     print(key, value)
a   Parameter value a
b   Parameter value b
c   Parameter value c

Acknowledgment

  • I understand the final update might be different from my proposed suggestion, or refused.
@bram-tv bram-tv added documentation Improvements or additions to documentation triage Pending triage from maintainers labels Jul 11, 2023
@leandrodamascena
Copy link
Contributor

leandrodamascena commented Jul 11, 2023

Hi @bram-tv! Thanks so much for raising this issue! We strive to keep our documentation and docstring as up-to-date as possible, but sometimes we miss something, like this case. This case is the docstring of the method and we can update it to make it clearer for our customers.

Do you think it's worth putting something like: "considering the path /my/path/prefix/ which has the parameters a, b and c...?" This way it makes the example more explicit for the user that we remove the path.

Do you have bandwidth to send a PR to fix this?

Thanks!

@leandrodamascena leandrodamascena added enhancement and removed triage Pending triage from maintainers labels Jul 11, 2023
@leandrodamascena leandrodamascena moved this from Triage to Pending customer in Powertools for AWS Lambda (Python) Jul 11, 2023
@heitorlessa heitorlessa moved this from Pending customer to Triage in Powertools for AWS Lambda (Python) Jul 24, 2023
@heitorlessa heitorlessa self-assigned this Jul 24, 2023
@heitorlessa heitorlessa moved this from Triage to Working on it in Powertools for AWS Lambda (Python) Jul 24, 2023
@heitorlessa
Copy link
Contributor

@leandrodamascena taking this one FYI

@heitorlessa
Copy link
Contributor

Apologies for the delay @bram-tv but we've got a PR now. Besides API docs, I've also improved the User Guide docs with more details and examples too (including comments in the code snippet provided).

Can't thank you enough for taking the time in helping us improve the docs.


image image

@github-actions github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label Jul 24, 2023
@github-project-automation github-project-automation bot moved this from Working on it to Coming soon in Powertools for AWS Lambda (Python) Jul 24, 2023
@github-actions
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions
Copy link
Contributor

This is now released under 2.22.0 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Jul 25, 2023
@heitorlessa heitorlessa moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python) Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement
Projects
Status: Shipped
Development

No branches or pull requests

3 participants