pachadotdev / analogsea

Digital Ocean R client
https://pacha.dev/analogsea/
Apache License 2.0
155 stars 24 forks source link

#217 Add page and per_page parameters to snapshots function #218

Closed sasha-ruby closed 1 year ago

sasha-ruby commented 1 year ago

Description

Current implementation of snapshots function does not support page and per_page parameters, which facilitate the pagination of the results, as well as setting the number of items to be returned per page. Consequently, the DO response always uses the default values of page = 1 and per_page = 20. In cases when there are more than 20 snapshots in the account, it is not possible to retrieve snapshots other than the first 20.

This PR adds page and per_page parameters to the snapshots function. The default values are the same as specified by Digital Ocean API snapshots endpoint, page=1 and per_page=20.

Allowed range of per_page parameter is from 1 to 200, so the proposed change resets the passed value if it was greater than 200.

Related Issue

Fixes issue #217.

Example

Example usage:

snapshots(per_page = 5, page = 2)
pachadotdev commented 1 year ago

thanks @sasha-ruby this is amazing !! can you give me a few days to run all the tests and then merge ? please let me know what is the best way to add you to ctb

sasha-ruby commented 1 year ago

Thanks @pachadotdev! Let me know if anything else is needed. My email address is sasha@rubyind.com.

Cheers, Sasha

sasha-ruby commented 1 year ago

Hi @pachadotdev, just checking in if you had a chance to review the changes in the PR and if there's anything I can do to help with it.

Cheers, Sasha

pachadotdev commented 1 year ago

Hi @pachadotdev, just checking in if you had a chance to review the changes in the PR and if there's anything I can do to help with it.

Cheers, Sasha

hi @sasha-ruby I tried 2 weeks ago and now. I still have a configuration problem with the CI, not related to the PR. I shall test manually

This is the error

Run shimataro/ssh-key-action@v2.3.0
  with:
    name: id_rsa
    if_key_exists: fail
  env:
    GITHUB_PAT: ***
    DO_PAT: 
    SPACES_KEY: 
    SPACES_SECRET: 
Error: Input required and not supplied: key
sasha-ruby commented 1 year ago

Hi @pachadotdev, thanks for looking into it!

I did a bit of digging on the GitHub action error. Not sure how exactly it is set up, but if you look at job output and expand the "Set up job" section, line 27 is:

Secret source: None

There's an example of the action setup using shimataro/ssh-key-action, and Step 3 is "Step 3: Adding the private key to your repository’s secrets" which instructs to add the SSH key as a secret in repository Settings. I am not sure if Secret source: None in the job output indicates this has not be done, but it might be worth checking. Line 25 in the Workflow file (key: ${{ secrets.SSH_KEY }}) indicates that the workflow should expect the secret is set, but it might be that's not the case.

There are a couple of issues reported about this same error, https://github.com/shimataro/ssh-key-action/issues/164 and https://github.com/actions/checkout/issues/298, with the second one (issue #298) providing a couple of workarounds. I'm not sure if any would apply for this case though.

pachadotdev commented 1 year ago

@sasha-ruby Hi! I shall add to contributors.md I fixed the SSH auth and it works