Giter Club home page Giter Club logo

python-contabo's Introduction

pfruck_contabo

โš ๏ธ I am not affiliated in any way with Contabo

This is an UNOFFICIAL Python API client for contabo.com, which is a hosting provider for VPS and dedicated servers.

The goal of this client is to make management of your server instances more easy using a native Python API for the Contabo API. This Python package is automatically generated by the OpenAPI Generator project.

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

The simplest way to install the Contabo API client is by using the provided pip package:

pip install pfruck-contabo

You can also install the package directly from the GitHub Repo using pip:

pip install git+https://github.com/p-fruck/python-contabo.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/p-fruck/python-contabo.git)

Then import the package:

import pfruck_contabo

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import pfruck_contabo

Getting Started

Please follow the installation procedure and then run the following:

import time
import pfruck_contabo
from pprint import pprint
from pfruck_contabo.api import images_api
from pfruck_contabo.model.create_custom_image_fail_response import CreateCustomImageFailResponse
from pfruck_contabo.model.create_custom_image_request import CreateCustomImageRequest
from pfruck_contabo.model.create_custom_image_response import CreateCustomImageResponse
from pfruck_contabo.model.custom_images_stats_response import CustomImagesStatsResponse
from pfruck_contabo.model.find_image_response import FindImageResponse
from pfruck_contabo.model.list_image_response import ListImageResponse
from pfruck_contabo.model.update_custom_image_request import UpdateCustomImageRequest
from pfruck_contabo.model.update_custom_image_response import UpdateCustomImageResponse
# Defining the host is optional and defaults to https://api.contabo.com
# See configuration.py for a list of all supported configuration parameters.
configuration = pfruck_contabo.Configuration(
    host = "https://api.contabo.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (JWT): bearer
configuration = pfruck_contabo.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)


# Enter a context with an instance of the API client
with pfruck_contabo.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = images_api.ImagesApi(api_client)
    x_request_id = "04e0f898-37b4-48bc-a794-1a57abe6aa31" # str | [Uuid4](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)) to identify individual requests for support cases. You can use [uuidgenerator](https://www.uuidgenerator.net/version4) to generate them manually.
    create_custom_image_request = CreateCustomImageRequest(
        name="Ubuntu Custom Image",
        description="Ubuntu Server 20.04.2 LTS",
        url="https://example.com/image.qcow2",
        os_type="Linux",
        version="20.04.2",
    ) # CreateCustomImageRequest | 
    x_trace_id = "x-trace-id_example" # str | Identifier to trace group of requests. (optional)

    try:
        # Provide a custom image
        api_response = api_instance.create_custom_image(x_request_id, create_custom_image_request, x_trace_id=x_trace_id)
        pprint(api_response)
    except pfruck_contabo.ApiException as e:
        print("Exception when calling ImagesApi->create_custom_image: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.contabo.com

Class Method HTTP request Description
ImagesApi create_custom_image POST /v1/compute/images Provide a custom image
ImagesApi delete_image DELETE /v1/compute/images/{imageId} Delete an uploaded custom image by its id
ImagesApi retrieve_custom_images_stats GET /v1/compute/images/stats List statistics regarding the customer's custom images
ImagesApi retrieve_image GET /v1/compute/images/{imageId} Get details about a specific image by its id
ImagesApi retrieve_image_list GET /v1/compute/images List available standard and custom images
ImagesApi update_image PATCH /v1/compute/images/{imageId} Update custom image name by its id
ImagesAuditsApi retrieve_image_audits_list GET /v1/compute/images/audits List history about your custom images (audit)
InstanceActionsApi rescue POST /v1/compute/instances/{instanceId}/actions/rescue Rescue a compute instance / resource identified by its id
InstanceActionsApi reset_password_action POST /v1/compute/instances/{instanceId}/actions/resetPassword Reset password for a compute instance / resource referenced by an id
InstanceActionsApi restart POST /v1/compute/instances/{instanceId}/actions/restart Retrieve a list of your custom images history.
InstanceActionsApi shutdown POST /v1/compute/instances/{instanceId}/actions/shutdown Shutdown compute instance / resource by its id
InstanceActionsApi start POST /v1/compute/instances/{instanceId}/actions/start Start a compute instance / resource identified by its id
InstanceActionsApi stop POST /v1/compute/instances/{instanceId}/actions/stop Stop compute instance / resource by its id
InstanceActionsAuditsApi retrieve_instances_actions_audits_list GET /v1/compute/instances/actions/audits List history about your actions (audit) triggered via the API
InstancesApi cancel_instance POST /v1/compute/instances/{instanceId}/cancel Cancel specific instance by id
InstancesApi create_instance POST /v1/compute/instances Create a new instance
InstancesApi patch_instance PATCH /v1/compute/instances/{instanceId} Update specific instance
InstancesApi reinstall_instance PUT /v1/compute/instances/{instanceId} Reinstall specific instance
InstancesApi retrieve_instance GET /v1/compute/instances/{instanceId} Get specific instance by id
InstancesApi retrieve_instances_list GET /v1/compute/instances List instances
InstancesApi upgrade_instance POST /v1/compute/instances/{instanceId}/upgrade Upgrading instance capabilities
InstancesAuditsApi retrieve_instances_audits_list GET /v1/compute/instances/audits List history about your custom images (audit)
InternalApi create_ticket POST /v1/create-ticket Create a new support ticket
InternalApi retrieve_user_is_password_set GET /v1/users/is-password-set Get user is password set status
ObjectStoragesApi cancel_object_storage PATCH /v1/object-storages/{objectStorageId}/cancel Cancels the specified object storage at the next possible date
ObjectStoragesApi create_object_storage POST /v1/object-storages Create a new object storage
ObjectStoragesApi retrieve_data_center_list GET /v1/data-centers List data centers
ObjectStoragesApi retrieve_object_storage GET /v1/object-storages/{objectStorageId} Get specific object storage by its id
ObjectStoragesApi retrieve_object_storage_list GET /v1/object-storages List all your object storages
ObjectStoragesApi retrieve_object_storages_stats GET /v1/object-storages/{objectStorageId}/stats List usage statistics about the specified object storage
ObjectStoragesApi update_object_storage PATCH /v1/object-storages/{objectStorageId} Modifies the display name of object storage
ObjectStoragesApi upgrade_object_storage POST /v1/object-storages/{objectStorageId}/resize Upgrade object storage size resp. update autoscaling settings.
ObjectStoragesAuditsApi retrieve_object_storage_audits_list GET /v1/object-storages/audits List history about your object storages (audit)
PrivateNetworksApi assign_instance_private_network POST /v1/private-networks/{privateNetworkId}/instances/{instanceId} Add instance to a Private Network
PrivateNetworksApi create_private_network POST /v1/private-networks Create a new Private Network
PrivateNetworksApi delete_private_network DELETE /v1/private-networks/{privateNetworkId} Delete existing Private Network by id
PrivateNetworksApi patch_private_network PATCH /v1/private-networks/{privateNetworkId} Update a Private Network by id
PrivateNetworksApi retrieve_private_network GET /v1/private-networks/{privateNetworkId} Get specific Private Network by id
PrivateNetworksApi retrieve_private_network_list GET /v1/private-networks List Private Networks
PrivateNetworksApi unassign_instance_private_network DELETE /v1/private-networks/{privateNetworkId}/instances/{instanceId} Remove instance from a Private Network
PrivateNetworksAuditsApi retrieve_private_network_audits_list GET /v1/private-networks/audits List history about your Private Networks (audit)
RolesApi create_role POST /v1/roles Create a new role
RolesApi delete_role DELETE /v1/roles/{roleId} Delete existing role by id
RolesApi retrieve_api_permissions_list GET /v1/roles/api-permissions List of API permissions
RolesApi retrieve_role GET /v1/roles/{roleId} Get specific role by id
RolesApi retrieve_role_list GET /v1/roles List roles
RolesApi update_role PUT /v1/roles/{roleId} Update specific role by id
RolesAuditsApi retrieve_role_audits_list GET /v1/roles/audits List history about your roles (audit)
SecretsApi create_secret POST /v1/secrets Create a new secret
SecretsApi delete_secret DELETE /v1/secrets/{secretId} Delete existing secret by id
SecretsApi retrieve_secret GET /v1/secrets/{secretId} Get specific secret by id
SecretsApi retrieve_secret_list GET /v1/secrets List secrets
SecretsApi update_secret PATCH /v1/secrets/{secretId} Update specific secret by id
SecretsAuditsApi retrieve_secret_audits_list GET /v1/secrets/audits List history about your secrets (audit)
SnapshotsApi create_snapshot POST /v1/compute/instances/{instanceId}/snapshots Create a new instance snapshot
SnapshotsApi delete_snapshot DELETE /v1/compute/instances/{instanceId}/snapshots/{snapshotId} Delete existing snapshot by id
SnapshotsApi retrieve_snapshot GET /v1/compute/instances/{instanceId}/snapshots/{snapshotId} Retrieve a specific snapshot by id
SnapshotsApi retrieve_snapshot_list GET /v1/compute/instances/{instanceId}/snapshots List snapshots
SnapshotsApi rollback_snapshot POST /v1/compute/instances/{instanceId}/snapshots/{snapshotId}/rollback Revert the instance to a particular snapshot based on its identifier
SnapshotsApi update_snapshot PATCH /v1/compute/instances/{instanceId}/snapshots/{snapshotId} Update specific snapshot by id
SnapshotsAuditsApi retrieve_snapshots_audits_list GET /v1/compute/snapshots/audits List history about your snapshots (audit) triggered via the API
TagAssignmentsApi create_assignment POST /v1/tags/{tagId}/assignments/{resourceType}/{resourceId} Create a new assignment for the tag
TagAssignmentsApi delete_assignment DELETE /v1/tags/{tagId}/assignments/{resourceType}/{resourceId} Delete existing tag assignment
TagAssignmentsApi retrieve_assignment GET /v1/tags/{tagId}/assignments/{resourceType}/{resourceId} Get specific assignment for the tag
TagAssignmentsApi retrieve_assignment_list GET /v1/tags/{tagId}/assignments List tag assignments
TagAssignmentsAuditsApi retrieve_assignments_audits_list GET /v1/tags/assignments/audits List history about your assignments (audit)
TagsApi create_tag POST /v1/tags Create a new tag
TagsApi delete_tag DELETE /v1/tags/{tagId} Delete existing tag by id
TagsApi retrieve_tag GET /v1/tags/{tagId} Get specific tag by id
TagsApi retrieve_tag_list GET /v1/tags List tags
TagsApi update_tag PATCH /v1/tags/{tagId} Update specific tag by id
TagsAuditsApi retrieve_tag_audits_list GET /v1/tags/audits List history about your assignments (audit)
TicketsApi create_support_ticket POST /v1/tickets Create a new support ticket
TicketsApi retrieve_ticket_metadata GET /v1/tickets/metadata Retrieve ticket metadata
UsersApi create_user POST /v1/users Create a new user
UsersApi delete_user DELETE /v1/users/{userId} Delete existing user by id
UsersApi generate_client_secret PUT /v1/users/client/secret Generate new client secret
UsersApi get_object_storage_credentials GET /v1/users/{userId}/object-storages/{objectStorageId}/credentials/{credentialId} Get S3 compatible object storage credentials.
UsersApi list_object_storage_credentials GET /v1/users/{userId}/object-storages/credentials Get list of S3 compatible object storage credentials for user.
UsersApi regenerate_object_storage_credentials PATCH /v1/users/{userId}/object-storages/{objectStorageId}/credentials/{credentialId} Regenerates secret key of specified user for the S3 compatible object storages.
UsersApi resend_email_verification POST /v1/users/{userId}/resend-email-verification Resend email verification
UsersApi reset_password POST /v1/users/{userId}/reset-password Send reset password email
UsersApi retrieve_user GET /v1/users/{userId} Get specific user by id
UsersApi retrieve_user_client GET /v1/users/client Get client
UsersApi retrieve_user_list GET /v1/users List users
UsersApi update_user PATCH /v1/users/{userId} Update specific user by id
UsersAuditsApi retrieve_user_audits_list GET /v1/users/audits List history about your users (audit)

Documentation For Models

Documentation For Authorization

bearer

  • Type: Bearer authentication (JWT)

Author

[email protected]

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in pfruck_contabo.apis and pfruck_contabo.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from pfruck_contabo.api.default_api import DefaultApi
  • from pfruck_contabo.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import pfruck_contabo
from pfruck_contabo.apis import *
from pfruck_contabo.models import *

python-contabo's People

Contributors

github-actions[bot] avatar p-fruck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

python-contabo's Issues

Authentication removed from API spec

The authentication spec required for generation of the API client has been removed (see here). The contabo team has been notified, but no changes have been made in the last 7 days. Without manual modification, the build process is therefore currently broken.

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.