Git Product home page Git Product logo

gridscale_api_client_python's People

Contributors

aldemuro avatar begotxe avatar bkircher avatar boxg11 avatar itakouna avatar twiebe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

sharkwouter

gridscale_api_client_python's Issues

Rename ssh methods

To make this client more in line with the official API I'd to propose a rename of the following methods:

  • get_ssh_keys
  • get_ssh_key
  • create_ssh_key
  • update_ssh_key
  • delete_ssh_key
  • get_ssh_key_events

ssh_key is canonically without the underscore in the API. The new function names would then be

  • get_sshkeys
  • get_sshkey
  • create_sshkey
  • update_sshkey
  • delete_sshkey
  • get_sshkey_events

For backwards-compat we could alias the methods to their old names.

It's a small annoyance, but I still wanted to mention it. I'm ready to work an a pull request if this change finds acceptance.

Allow reading and writing shared config file

We want to create a new config file that is shared across the different libraries and tools that use the gridscale API: gridscale/terraform-provider-gridscale#183

For this we need to have a function that reads that config file into an internal representation and probably also a function that writes such a config file if it does not yet exists.

See gridscale/terraform-provider-gridscale#183 for the format of the file and file paths on the different platforms.

client.get_buckets() doesn't seem to work

Steps to reproduce:

Get an account with no buckets in object storage. curl the public API and verify:

$ GS_USER_ID=xyz; GS_API_TOKEN=xyz; curl https://api.gridscale.cloud/objects/objectstorages/buckets -H "X-Auth-UserID: $GS_USER_ID" -H "X-Auth-Token: $GS_API_TOKEN"
{"buckets": []}

Run test script (see below):

$ GS_USER_ID=xyz GS_API_TOKEN=xyz python test.py{'buckets': None}

So far so good. Now create a bucket in the panel, let say 'fubar' and curl again.

$ GS_USER_ID=xyz; GS_API_TOKEN=xyz; curl https://api.gridscale.cloud/objects/objectstorages/buckets -H "X-Auth-UserID: $GS_USER_ID" -H "X-Auth-Token: $GS_API_TOKEN"
{"buckets": [{"name": "fubar", "usage": {"num_objects": 0, "size_kb": 0}}]}

Looks good.

Now the API client:

$ GS_USER_ID=xyz GS_API_TOKEN=xyz python test.py
{'buckets': None}

Looks not okay.

If you add more buckets, get_buckets keeps returning none.

Test script (test.py):

import os
from pprint import pprint

from gs_api_client import Configuration, SyncGridscaleApiClient


user_id = os.getenv("GS_USER_ID")
assert user_id

api_token = os.getenv("GS_API_TOKEN")
assert api_token


config = Configuration()
config.host = "https://api.gridscale.cloud"
config.api_key["X-Auth-Token"] = api_token
config.api_key["X-Auth-UserId"] = user_id
config.debug = False

client = SyncGridscaleApiClient(configuration=config)
pprint(client.get_buckets())

Adjust request poll intervall for API rate limiting

Currently the synchronous API client will poll asynchronous requests every 0.5s. This makes hitting the API rate limit quite likely once you introduce concurrency.

For the API client to not feel sluggish, the poll intervall likely shouldn't simply be increased to a few seconds. It could be dynamically increased to a max and/or be request type-dependent.

examples.py breaks when a template is removed

In the example file it currently tries to use Debian 9 as a template.

We could just change to the newest Debian version for the example. However, this will just break whenever we depreciate Debian 11.

Another option would be to implement a default option which would always use the newest Debian version.

Support API rate limiting retries

Since the introduction of API rate limiting, requests failed with an ApiException when hitting the limit (429).

I would propose that the client handles retries in that case.

Switch default branch to main

We want to switch the default branch name from master to main for all gridscale Open Source projects including this repository.

This involves:

  • Switching the default branch name here on GitHub
  • Updating all references of the master branch name in GH Actions and other CI/CD pipelines and scripts
  • Giving contributors a bit of info on how to update their remotes in their local copies of the repo

Would be nice to do this coordinated and in "one go" so that contributors are not surprised by inconsistent naming or repositories not having switched yet. If you want to help out here contact @bkircher

Rename repo

Hey there. I would like this repository to be renamed to include dashes instead of underlines, i.e. instead of "gridscale_api_client_python" we would name it "gridscale-api-client-python".

Reasons:

Any objections?

Add config for linter

Right now there is no config for any linter in this project.

Things to do:

  • Choose a linter
  • Create a config for that linter
  • Make lint run pass without warnings (either by fixing issues in code or by silencing individual warnings in the config)
  • Add GH Action task that runs this linter with that config on the project

We could use pylint or flake8. Personally, I would prefer pylint because I know it best but no hard feelings. I could gift an initial config file for pylint.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.