Skip to content

dmarts05/clouding-server-manager

Repository files navigation

Clouding Server Manager

Version Python License

Clouding Server Manager is a Python project that allows you to manage your Clouding servers from the command line. It is designed to list, archive, and unarchive servers in your Clouding account. It uses the Clouding API to perform the actions.

Table of Contents

Features

  • Simple and easy to use command line interface.
  • List all the information about your Clouding servers and filter their fields so that you can see only the information you want.
  • Archive one or multiple servers at once.
  • Unarchive one or multiple servers at once.

Examples

These are just a few examples of how to use the script. For more information, check out the help message by running python -m clouding_server_manager --help.

  • List all servers:
    python -m clouding_server_manager list -t all
  • List all servers and filter their fields:
    python -m clouding_server_manager list -t all --f id -f name
  • Archive a server:
    python -m clouding_server_manager archive -t 123456
  • Archive multiple servers:
    python -m clouding_server_manager archive -t 123456 -t 789012
  • Unarchive a server:
    python -m clouding_server_manager unarchive -t 123456
  • Unarchive multiple servers:
    python -m clouding_server_manager unarchive -t 123456 -t 789012

Installation with Poetry (recommended)

To set up the project, follow these steps:

  1. Make sure you have Poetry installed in your system.
  2. It is highly recommended to set this Poetry configuration parameters to avoid multiple issues:
    poetry config virtualenvs.in-project true
    poetry config virtualenvs.prefer-active-python true
  3. Clone the repository:
    git clone https://github.com/dmarts05/clouding-server-manager
  4. Navigate to the project directory:
    cd clouding-server-manager
  5. Install the project dependencies using Poetry:
    poetry install
    You might need pyenv to install the Python version specified in the pyproject.toml file. If that's the case, run pyenv install 3.9 before running the previous command. Also, check out the Poetry documentation about pyenv for more information.
  6. Activate the virtual environment:
    poetry shell
    This will activate the virtual environment so that you can run the script.
  7. Enter your Clouding API key in the .env file. Check out .env.sample for an example. You can find your Clouding API key in the API section of your Clouding account (as of now you need access to the beta version of the Clouding API). As an alternative, you can use --api-key or -k to specify your API key when running the script.
  8. Run the script:
    python -m clouding_server_manager --help
    or
    poetry run clouding-sm --help
    This will display the help message and show you how to use the script.

Installation with pip

This is an alternative installation method that uses pip instead of Poetry. It might not work as expected, so it is recommended to use the Poetry installation method instead. To set up the project, follow these steps:

  1. Clone the repository:
    git clone https://github.com/dmarts05/clouding-server-manager
  2. Navigate to the project directory:
    cd clouding-server-manager
  3. Install the project dependencies using pip:
    pip install -r requirements.txt
    You might need pyenv to install the Python version specified in the requirements.txt file.
  4. Enter your Clouding API key in the .env file. Check out .env.sample for an example. You can find your Clouding API key in the API section of your Clouding account (as of now you need access to the beta version of the Clouding API). As an alternative, you can use --api-key or -k to specify your API key when running the script.
  5. Run the script:
    python -m clouding_server_manager --help
    or
    poetry run clouding-sm --help
    This will display the help message and show you how to use the script.

Installation as a PyPI package

This is an alternative installation method that uses pip to install the package from PyPI. It might not work as expected, so it is recommended to use the Poetry installation method instead. To set up the project, follow these steps:

  1. Install the package using pip:
    pip install clouding-server-manager
  2. Configure the environment variable with export or by adding them to your .bashrc or .zshrc file:
    export CLOUDING_API_KEY="YOUR API KEY"
    You can find your Clouding API key in the API section of your Clouding account (as of now you need access to the beta version of the Clouding API). As an alternative, you can use --api-key or -k to specify your API key when running the script.
  3. Run the script:
    clouding-sm --help
    This will display the help message and show you how to use the script.

Development Setup

If you want to contribute to the project or run the development environment, follow these additional steps:

  1. Install the development dependencies:
    poetry install --with dev
  2. Install pre-commit hooks:
    poetry run pre-commit install
  3. Format the code:
    poetry run black clouding_server_manager
  4. Lint the code:
    poetry run flake8 clouding_server_manager
  5. Run static type checking:
    poetry run mypy clouding_server_manager
  6. Generate the documentation:
    cd docs && poetry run make html
  7. Do everything at once (except for generating the documentation):
    poetry run pre-commit run --all-files

That's it! You now have the project set up and ready for development or execution.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A Python project to easily manage Clouding servers from the command line.

Resources

License

Stars

Watchers

Forks

Languages