pyray
===============================
.. image:: https://badge.fury.io/py/pyray.png
:target: http://badge.fury.io/py/pyray
.. image:: https://travis-ci.org/intr1nsic/pyray.png?branch=master
:target: https://travis-ci.org/intr1nsic/pyray
A python client to interact with the Riverbed Stingray REST API.
* Initial Release
* Requires Stingray API version 2.0
Documentation
-------------
http://pyray.readthedocs.org/en/latest/
Features
--------
* Add Nodes Module
* Add test coverage
Usage
========
Quick sample of pyray::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password')
Connectivity
============
The HTTPClient method has a few optional and helpful parameters that will
help troubleshoot issues or connectivity.
Debug
-----
The client has an optional debug flag that will log the request as well as
a curl command you can run against. For security reasons, username and password
are not displayed in any logging.::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password', debug=True)
To allow insecure SSL connectivity for invalid certs::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password', insecure=True)
You can also change the port if that is configured::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password', port='1234')
Generic Pool Queries
====================
All pools
---------
To list all the pools configured::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password')
pools = cl.pools.get()
for pool in pools:
print pool
Get a specific pool
-------------------
To get a specific pool::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password')
pool = cl.pools.get(name='pool1')
Delete a specific pool
----------------------
To delete a specific pool::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password')
cl.pools.delete(name='pool1')
Get all nodes draining in the pool
----------------------------------
To get draining nodes::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password')
pool = cl.pools.get(name='pool1')
draining_nodes = pool.draining_nodes
for node in draining_nodes:
print node
Get all configured nodes in a pool
----------------------------------
To get all the configured nodes::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password')
pool = cl.pools.get(name='pool1')
for node in pool.nodes:
print node
Making changes to a pool
========================
Drain
-----
Lets say you want to drain a group of nodes in a pool::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password')
pool = cl.pools.get(name='pool1')
pool.drain_nodes(nodes=['1.2.3.4:80'])
or quickly drain all nodes::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password')
pool = cl.pools.get(name='pool1')
pool.drain_nodes(nodes=pool.nodes)
Undrain
-------
To undrain nodes in a pool::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password')
pool = cl.pools.get(name='pool1')
pool.undrain_nodes(nodes=['1.2.3.4:80'])
or quickly undrain all draining nodes::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password')
pool = cl.pools.get(name='pool1')
pool.undrain_nodes(nodes=pool.draining_nodes)
Query node details in a pool
============================
To get node details for all the nodes in a pool accross all traffic managers::
from pyray import client
cl = client.HTTPClient('https://1.1.1.1', 'admin', 'password')
pool = cl.pools.get(name='pool1')
nodes = pool.get_details()
for node, details in nodes.iteritems():
print node
print node['statistics']['current_conn']
For the full node details::
{u'statistics':
{u'bytes_from_node': 23776,
u'bytes_to_node': 3659117,
u'current_conn': 0,
u'current_requests': 0,
u'errors': 4,
u'failures': 1,
u'idle_conns': 0,
u'new_conn': 38,
u'node_port': 80,
u'pooled_conn': 0,
u'response_max': 0,
u'response_mean': 0,
u'response_min': 0,
u'state': u'draining',
u'total_conn': 38
}
}
History
-------
0.1.0 (2014-01-02)
++++++++++++++++++
* First release on PyPI.
Metadata
Release files for pyray 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyray-0.1.0.tar.gz | 8.8 kB | Without provenance | Details |
Release files / pyray-0.1.0.tar.gz
| Download URL | pyray-0.1.0.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6abd8ce68cf466f1594daa602c2ae4e9a19ce0b5acec907f78b0355234c73df5
|
|
BLAKE2b-256 checksum How to use checksums |
ce217a0167367ec62512ccc98795eef0c807f2ec2866f66e5fdba228e3bcfacb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pyray 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.