Skip to main content

Redis Enterprise Python language client for the control plane REST API, generated from Swagger

Project description

swagger-client

REST API Specifications

Key Concepts


Clusters

Redis Labs clusters are a set of nodes, typically two or more, providing database services. Clusters are inherently multi-tenant, and a single cluster can manage multiple databases accessed through individual endpoints.

Protocol and Headers


JSON Requests and Responses

The Redis Labs REST API uses the JavaScript Object Notation (JSON) for requests and responses. Some responses may have an empty body, but indicate the response with standard HTTP codes. For more information, see RFC 4627 (http://www.ietf.org/rfc/rfc4627.txt) and www.json.org. Both requests and responses may include zero or more objects. In case the request is for a single entity, the response shall return a single JSON object, or none. In case the request if for a list of entities, the response shall return a single JSON array with 0 or more elements. Requests may be delivered with some JSON object fields missing. In this case, these fields will be assigned default values (often indicating they are not in use).

Request Headers

The Redis Labs REST API supports the following HTTP headers:

Header Supported/Required Values
Accept application/json
Content-Length Length (in bytes) of request message.
Content-Type application/json

Response Headers

The Redis Labs REST API supports the following HTTP headers:

Header Supported/Required Values
Content-Type application/json
Content-Length Length (in bytes) of request message.

API Versions


All RLEC API operations are versioned, in order to minimize the impact of backwards-incompatible API changes and to coordinate between different versions operating in parallel.

Authentication


Authentication to RLEC API occurs via Basic Auth. Provide your RLEC username and password as the basic auth credentials. All calls must be made over SSL, to port 9443. Example Request:

curl -u "demo@redislabs.com:password" https://localhost:9443/v1/bdbs

Common Responses


The following are common responses which may be returned in some cases regardless of any specific request.

Response Condition / Required handling
503 (Service Unavailable) Contacted node is currently not a member of any active cluster.
505 (HTTP Version Not Supported) An unsupported X-API-Version was used, see API Versions above.

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 6.2.4-55
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import swagger_client 

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 swagger_client

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: YWRtaW5AcmVkaXNsYWJzLmNvbTppbXRoZWFkbWlu
configuration = swagger_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = swagger_client.ActionsApi(swagger_client.ApiClient(configuration))
uid = 'uid_example' # str | 

try:
    # Get optimized shards placement for the given database.
    api_response = api_instance.get_v1_bdbs_uid_actions_optimize_shards_placement(uid)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ActionsApi->get_v1_bdbs_uid_actions_optimize_shards_placement: %s\n" % e)
# Configure HTTP basic authorization: YWRtaW5AcmVkaXNsYWJzLmNvbTppbXRoZWFkbWlu
configuration = swagger_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = swagger_client.ActionsApi(swagger_client.ApiClient(configuration))
uid = 'uid_example' # str | The unique ID of the database to recover.

try:
    # Fetch the recovery plan for a database in recovery mode
    api_instance.get_v1_bdbs_uid_actions_recover(uid)
except ApiException as e:
    print("Exception when calling ActionsApi->get_v1_bdbs_uid_actions_recover: %s\n" % e)
# Configure HTTP basic authorization: YWRtaW5AcmVkaXNsYWJzLmNvbTppbXRoZWFkbWlu
configuration = swagger_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = swagger_client.ActionsApi(swagger_client.ApiClient(configuration))
uid = 'uid_example' # str | The unique ID of the database
body = swagger_client.ActionsExportBody() # ActionsExportBody | The request body should contain a JSON object (optional)

try:
    # Initiate a database export.
    api_instance.post_v1_bdbs_uid_actions_export(uid, body=body)
except ApiException as e:
    print("Exception when calling ActionsApi->post_v1_bdbs_uid_actions_export: %s\n" % e)
# Configure HTTP basic authorization: YWRtaW5AcmVkaXNsYWJzLmNvbTppbXRoZWFkbWlu
configuration = swagger_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = swagger_client.ActionsApi(swagger_client.ApiClient(configuration))
uid = 'uid_example' # str | The unique ID of the database
body = swagger_client.ActionsImportBody() # ActionsImportBody |  (optional)

try:
    # Initiate a manual import process.
    api_instance.post_v1_bdbs_uid_actions_import(uid, body=body)
except ApiException as e:
    print("Exception when calling ActionsApi->post_v1_bdbs_uid_actions_import: %s\n" % e)
# Configure HTTP basic authorization: YWRtaW5AcmVkaXNsYWJzLmNvbTppbXRoZWFkbWlu
configuration = swagger_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = swagger_client.ActionsApi(swagger_client.ApiClient(configuration))
uid = 'uid_example' # str | The unique ID of the database to recover.
body = swagger_client.ActionsRecoverBody() # ActionsRecoverBody | Optional body -- The request body may be empty, in which case the database will be recovered automatically.

The request may include a request body with an explicit recovery plan. (optional)

try:
    # Initiate recovery for a database in recovery state.
    api_instance.post_v1_bdbs_uid_actions_recover(uid, body=body)
except ApiException as e:
    print("Exception when calling ActionsApi->post_v1_bdbs_uid_actions_recover: %s\n" % e)
# Configure HTTP basic authorization: YWRtaW5AcmVkaXNsYWJzLmNvbTppbXRoZWFkbWlu
configuration = swagger_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = swagger_client.ActionsApi(swagger_client.ApiClient(configuration))
uid = 56 # int | The uid of the db on which the command will be performed.
body = swagger_client.DbCommand() # DbCommand | The request must contain a redis command JSON representation consists of a ‘command’ field. It may also consist of an ‘args’ array. (optional)

try:
    # Execute a redis/memcached command
    api_response = api_instance.post_v1_bdbs_uid_command(uid, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ActionsApi->post_v1_bdbs_uid_command: %s\n" % e)
# Configure HTTP basic authorization: YWRtaW5AcmVkaXNsYWJzLmNvbTppbXRoZWFkbWlu
configuration = swagger_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = swagger_client.ActionsApi(swagger_client.ApiClient(configuration))
uid = 'uid_example' # str | The unique ID of the database for which update is requested.
action = 'action_example' # str | Additional action to perform. Currently the supported actions are: flush, reset_admin_pass.
body = swagger_client.Bdb() # Bdb |  (optional)
dry_run = 'dry_run_example' # str | Validate the bdb object against the existing bdb, but do not invoke the state machine to update it. (optional)

try:
    # Update the configuration of an active database.
    api_instance.put_v1_bdbs_uid_action(uid, action, body=body, dry_run=dry_run)
except ApiException as e:
    print("Exception when calling ActionsApi->put_v1_bdbs_uid_action: %s\n" % e)
# Configure HTTP basic authorization: YWRtaW5AcmVkaXNsYWJzLmNvbTppbXRoZWFkbWlu
configuration = swagger_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = swagger_client.ActionsApi(swagger_client.ApiClient(configuration))
uid = 'uid_example' # str | The unique ID of the database

try:
    # Reset database current backup status
    api_instance.put_v1_bdbs_uid_actions_backup_reset_status(uid)
except ApiException as e:
    print("Exception when calling ActionsApi->put_v1_bdbs_uid_actions_backup_reset_status: %s\n" % e)
# Configure HTTP basic authorization: YWRtaW5AcmVkaXNsYWJzLmNvbTppbXRoZWFkbWlu
configuration = swagger_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = swagger_client.ActionsApi(swagger_client.ApiClient(configuration))
uid = 'uid_example' # str | The unique ID of the database

try:
    # Reset database current export status
    api_instance.put_v1_bdbs_uid_actions_export_reset_status(uid)
except ApiException as e:
    print("Exception when calling ActionsApi->put_v1_bdbs_uid_actions_export_reset_status: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost:9443

Class Method HTTP request Description
ActionsApi get_v1_bdbs_uid_actions_optimize_shards_placement GET /v1/bdbs/{uid}/actions/optimize_shards_placement Get optimized shards placement for the given database.
ActionsApi get_v1_bdbs_uid_actions_recover GET /v1/bdbs/{uid}/actions/recover Fetch the recovery plan for a database in recovery mode
ActionsApi post_v1_bdbs_uid_actions_export POST /v1/bdbs/{uid}/actions/export Initiate a database export.
ActionsApi post_v1_bdbs_uid_actions_import POST /v1/bdbs/{uid}/actions/import Initiate a manual import process.
ActionsApi post_v1_bdbs_uid_actions_recover POST /v1/bdbs/{uid}/actions/recover Initiate recovery for a database in recovery state.
ActionsApi post_v1_bdbs_uid_command POST /v1/bdbs/{uid}/command Execute a redis/memcached command
ActionsApi put_v1_bdbs_uid_action PUT /v1/bdbs/{uid}/{action} Update the configuration of an active database.
ActionsApi put_v1_bdbs_uid_actions_backup_reset_status PUT /v1/bdbs/{uid}/actions/backup_reset_status Reset database current backup status
ActionsApi put_v1_bdbs_uid_actions_export_reset_status PUT /v1/bdbs/{uid}/actions/export_reset_status Reset database current export status
BackupApi post_v1_bdbs_uid_actions_import POST /v1/bdbs/{uid}/actions/import Initiate a manual import process.
BackupsApi put_v1_bdbs_uid_actions_backup_reset_status PUT /v1/bdbs/{uid}/actions/backup_reset_status Reset database current backup status
BdbsApi delete_v1_bdbs_uid_passwords DELETE /v1/bdbs/{uid}/passwords Delete a password from the bdb’s default user
BdbsApi get_v1_bdbs GET /v1/bdbs Get all databases in the cluster.
BdbsApi get_v1_bdbs_uid GET /v1/bdbs/{uid} Get single database (bdb object) as json.
BdbsApi get_v1_bdbs_uid_actions_optimize_shards_placement GET /v1/bdbs/{uid}/actions/optimize_shards_placement Get optimized shards placement for the given database.
BdbsApi get_v1_bdbs_uid_actions_recover GET /v1/bdbs/{uid}/actions/recover Fetch the recovery plan for a database in recovery mode
BdbsApi post_v1_bdbs POST /v1/bdbs Create a new database in the cluster.
BdbsApi post_v1_bdbs_uid_actions_export POST /v1/bdbs/{uid}/actions/export Initiate a database export.
BdbsApi post_v1_bdbs_uid_actions_import POST /v1/bdbs/{uid}/actions/import Initiate a manual import process.
BdbsApi post_v1_bdbs_uid_actions_recover POST /v1/bdbs/{uid}/actions/recover Initiate recovery for a database in recovery state.
BdbsApi post_v1_bdbs_uid_command POST /v1/bdbs/{uid}/command Execute a redis/memcached command
BdbsApi post_v1_bdbs_uid_passwords POST /v1/bdbs/{uid}/passwords Add a password to the bdb’s default user
BdbsApi post_v1_bdbs_uid_upgrade POST /v1/bdbs/{uid}/upgrade Upgrade a BDB
BdbsApi put_v1_bdbs_uid PUT /v1/bdbs/{uid} Update the configuration of an active database.
BdbsApi put_v1_bdbs_uid_action PUT /v1/bdbs/{uid}/{action} Update the configuration of an active database.
BdbsApi put_v1_bdbs_uid_actions_backup_reset_status PUT /v1/bdbs/{uid}/actions/backup_reset_status Reset database current backup status
BdbsApi put_v1_bdbs_uid_actions_export_reset_status PUT /v1/bdbs/{uid}/actions/export_reset_status Reset database current export status
ClusterApi delete_v1_cluster_certificates_certificate_name DELETE /v1/cluster/certificates/{certificate_name} Removes specified cluster certificate
ClusterApi get_v1_cluster_certificates GET /v1/cluster/certificates Get the clusters certificates.
ClusterApi post_v1_cluster_certificates_rotate POST /v1/cluster/certificates/rotate Regenerate all internal cluster certificates
ClusterApi put_v1_cluster_update_cert PUT /v1/cluster/update_cert Replaces specified cluster certificate
CrdbsApi get_v1_crdb GET /v1/crdbs Get a list of all Active-Active database on the cluster.
CrdbsApi post_v1_crdbs POST /v1/crdbs Create a new Active-Active database.
DefaultApi delete_v1_bdbs_uid DELETE /v1/bdbs/{uid} Delete an active database.
DefaultApi put_v1_bdbs_uid_passwords PUT /v1/bdbs/{uid}/passwords Set a (single) password
ShardsApi get_v1_bdbs_uid_actions_optimize_shards_placement GET /v1/bdbs/{uid}/actions/optimize_shards_placement Get optimized shards placement for the given database.
UsersApi delete_v1_users DELETE /v1/users/{uid} Delete a RLEC user.
UsersApi delete_v1_users_password DELETE /v1/users/password Delete a password from a user
UsersApi get_v1_users GET /v1/users/{uid} Get a single RLEC user.
UsersApi post_v1_users POST /v1/users Create a new RLEC user.
UsersApi post_v1_users_password POST /v1/users/password Add a new password to an internal user
UsersApi put_v1_users_password PUT /v1/users/password Reset the password list of an internal user

Documentation For Models

Documentation For Authorization

YWRtaW5AcmVkaXNsYWJzLmNvbTppbXRoZWFkbWlu

  • Type: HTTP basic authentication

Author

matthew.royal@redis.com

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

redis-enterprise-python-1.0.0.tar.gz (28.5 kB view hashes)

Uploaded Source

Built Distribution

redis_enterprise_python-1.0.0-py3-none-any.whl (7.7 kB view hashes)

Uploaded Python 3

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