Skip to main content

Python SDK for the Ionos DBaaS Postgres API

Project description

CI Python DBaaS Postgres Gitter Quality Gate Status Bugs Maintainability Rating Reliability Rating Security Rating Vulnerabilities Release Release Date PyPI version

Alt text

Python API client for ionoscloud_dbaas_postgres

An enterprise-grade Database is provided as a Service (DBaaS) solution that can be managed through a browser-based "Data Center Designer" (DCD) tool or via an easy to use API.

The API allows you to create additional PostgreSQL database clusters or modify existing ones. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive.

Overview

The IONOS Cloud SDK for Python provides you with access to the IONOS Cloud Dbaas Postgres API. The client library supports both simple and complex requests. It is designed for developers who are building applications in Python. All API operations are performed over SSL and authenticated using your IONOS Cloud portal credentials. The API can be accessed within an instance running in IONOS Cloud or directly over the Internet from any application that can send an HTTPS request and receive an HTTPS response.

Installation & Usage

Requirements:

  • Python >= 3.5

pip install

Since this package is hosted on Pypi you can install it by using:

pip install ionoscloud-dbaas-postgres

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/ionos-cloud/sdk-python-dbaas-postgres.git

Note: you may need to run pip with root permission: sudo pip install git+https://github.com/ionos-cloud/sdk-python-dbaas-postgres.git

Then import the package:

import ionoscloud_dbaas_postgres

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 ionoscloud_dbaas_postgres

NOTE: The Python SDK does not support Python 2. It only supports Python >= 3.5.

Authentication

The username and password or the authentication token can be manually specified when initializing the SDK client:

configuration = ionoscloud_dbaas_postgres.Configuration(
                username='YOUR_USERNAME',
                password='YOUR_PASSWORD',
                token='YOUR_TOKEN'
                )
client = ionoscloud_dbaas_postgres.ApiClient(configuration)

Environment variables can also be used. This is an example of how one would do that:

import os

configuration = ionoscloud_dbaas_postgres.Configuration(
                username=os.environ.get('IONOS_USERNAME'),
                password=os.environ.get('IONOS_PASSWORD'),
                token=os.environ.get('IONOS_TOKEN')
                )
client = ionoscloud_dbaas_postgres.ApiClient(configuration)

Warning: Make sure to follow the Information Security Best Practices when using credentials within your code or storing them in a file.

HTTP proxies

You can use http proxies by setting the following environment variables:

  • IONOS_HTTP_PROXY - proxy URL
  • IONOS_HTTP_PROXY_HEADERS - proxy headers

Changing the base URL

Base URL for the HTTP operation can be changed in the following way:

import os

configuration = ionoscloud_dbaas_postgres.Configuration(
                username=os.environ.get('IONOS_USERNAME'),
                password=os.environ.get('IONOS_PASSWORD'),
                host=os.environ.get('IONOS_API_URL'),
                server_index=None,
                )
client = ionoscloud_dbaas_postgres.ApiClient(configuration)

Certificate pinning:

You can enable certificate pinning if you want to bypass the normal certificate checking procedure, by doing the following:

Set env variable IONOS_PINNED_CERT=<insert_sha256_public_fingerprint_here>

You can get the sha256 fingerprint most easily from the browser by inspecting the certificate.

Documentation for API Endpoints

All URIs are relative to https://api.ionos.com/databases/postgresql

API Endpoints table
Class Method HTTP request Description
BackupsApi cluster_backups_get GET /clusters/{clusterId}/backups List backups of cluster
BackupsApi clusters_backups_find_by_id GET /clusters/backups/{backupId} Fetch a cluster backup
BackupsApi clusters_backups_get GET /clusters/backups List cluster backups
ClustersApi cluster_postgres_versions_get GET /clusters/{clusterId}/postgresversions List PostgreSQL versions
ClustersApi clusters_delete DELETE /clusters/{clusterId} Delete a cluster
ClustersApi clusters_find_by_id GET /clusters/{clusterId} Fetch a cluster
ClustersApi clusters_get GET /clusters List clusters
ClustersApi clusters_patch PATCH /clusters/{clusterId} Patch a cluster
ClustersApi clusters_post POST /clusters Create a cluster
ClustersApi postgres_versions_get GET /clusters/postgresversions List PostgreSQL versions
DatabasesApi databases_delete DELETE /clusters/{clusterId}/databases/{databasename} Delete database
DatabasesApi databases_get GET /clusters/{clusterId}/databases/{databasename} Get database
DatabasesApi databases_list GET /clusters/{clusterId}/databases List databases
DatabasesApi databases_post POST /clusters/{clusterId}/databases Create a database
LogsApi cluster_logs_get GET /clusters/{clusterId}/logs Get logs of your cluster
MetadataApi infos_version_get GET /infos/version Get the current API version
MetadataApi infos_versions_get GET /infos/versions Fetch all API versions
RestoresApi cluster_restore_post POST /clusters/{clusterId}/restore In-place restore of a cluster
UsersApi users_delete DELETE /clusters/{clusterId}/users/{username} Delete user
UsersApi users_get GET /clusters/{clusterId}/users/{username} Get user
UsersApi users_list GET /clusters/{clusterId}/users List users
UsersApi users_patch PATCH /clusters/{clusterId}/users/{username} Patch user
UsersApi users_post POST /clusters/{clusterId}/users Create a user

Documentation For Models

All URIs are relative to https://api.ionos.com/databases/postgresql

API models list

[Back to API list] [Back to Model list]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ionoscloud-dbaas-postgres-1.2.0.tar.gz (61.0 kB view details)

Uploaded Source

Built Distribution

ionoscloud_dbaas_postgres-1.2.0-py3-none-any.whl (144.1 kB view details)

Uploaded Python 3

File details

Details for the file ionoscloud-dbaas-postgres-1.2.0.tar.gz.

File metadata

File hashes

Hashes for ionoscloud-dbaas-postgres-1.2.0.tar.gz
Algorithm Hash digest
SHA256 1feb93d8190f98bac35d33beabaae44a476b8ad25b6b66a8cbd6f202db31ce58
MD5 6aa7fc99c0100f3823ce6f0c812596d0
BLAKE2b-256 d326f17bd9c1b4172d25a9abb75cfa93d854234e6ead4127362cd074db19e0ab

See more details on using hashes here.

File details

Details for the file ionoscloud_dbaas_postgres-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ionoscloud_dbaas_postgres-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a2d948c8ee93ddc520e87c1d1e29146f2983f59b58de9a6153d102e86d35ada
MD5 c070d58586a10c14ec5e146395564154
BLAKE2b-256 7cd547da7980442338236766b7f23e89aa7b36273db89b30abbb3c20c8b2ea27

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page