Package: haproxy-py
API for editing and managing haproxy instances. Provides process
information, configuration management, haproxy stats and logs.This Python package is automatically generated by theSwagger
Codegenproject:Requirements.Python 2.7 and 3.4+Installation & Usagepip installYou can install the package via PyPipipinstallhaproxy-pypipinstallgit+https://github.com/Scraps23/haproxy-py.git(you may need to runpipwith root permission:sudo pip installgit+https://github.com/Scraps23/haproxy-py.git)Then import the package:importdataplaneapiSetuptoolsInstall viaSetuptools.pythonsetup.pyinstall--user(orsudo python setup.py installhaproxy-pyto install the package
for all users)Then import the package:importdataplaneapiGetting StartedPlease follow theinstallation procedureand
then run the following:from__future__importprint_functionimporttimeimportdataplaneapifromdataplaneapi.restimportApiExceptionfrompprintimportpprint# Configure HTTP basic authorization: basic_authconfiguration=dataplaneapi.Configuration()configuration.username='YOUR_USERNAME'configuration.password='YOUR_PASSWORD'# create an instance of the API classapi_instance=dataplaneapi.ACLApi(dataplaneapi.ApiClient(configuration))body=dataplaneapi.Acl()# Acl |parent_name='parent_name_example'# str | Parent nameparent_type='parent_type_example'# str | Parent typetransaction_id='transaction_id_example'# str | ID of the transaction where we want to add the operation. Cannot be used when version is specified. (optional)version=56# int | Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. (optional)force_reload=False# bool | If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. (optional) (default to False)try:# Add a new ACL lineapi_response=api_instance.create_acl(body,parent_name,parent_type,transaction_id=transaction_id,version=version,force_reload=force_reload)pprint(api_response)exceptApiExceptionase:print("Exception when calling ACLApi->create_acl:%s\n"%e)# Configure HTTP basic authorization: basic_authconfiguration=dataplaneapi.Configuration()configuration.username='YOUR_USERNAME'configuration.password='YOUR_PASSWORD'# create an instance of the API classapi_instance=dataplaneapi.ACLApi(dataplaneapi.ApiClient(configuration))index=56# int | ACL line Indexparent_name='parent_name_example'# str | Parent nameparent_type='parent_type_example'# str | Parent typetransaction_id='transaction_id_example'# str | ID of the transaction where we want to add the operation. Cannot be used when version is specified. (optional)version=56# int | Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. (optional)force_reload=False# bool | If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. (optional) (default to False)try:# Delete a ACL lineapi_instance.delete_acl(index,parent_name,parent_type,transaction_id=transaction_id,version=version,force_reload=force_reload)exceptApiExceptionase:print("Exception when calling ACLApi->delete_acl:%s\n"%e)# Configure HTTP basic authorization: basic_authconfiguration=dataplaneapi.Configuration()configuration.username='YOUR_USERNAME'configuration.password='YOUR_PASSWORD'# create an instance of the API classapi_instance=dataplaneapi.ACLApi(dataplaneapi.ApiClient(configuration))index=56# int | ACL line Indexparent_name='parent_name_example'# str | Parent nameparent_type='parent_type_example'# str | Parent typetransaction_id='transaction_id_example'# str | ID of the transaction where we want to add the operation. Cannot be used when version is specified. (optional)try:# Return one ACL lineapi_response=api_instance.get_acl(index,parent_name,parent_type,transaction_id=transaction_id)pprint(api_response)exceptApiExceptionase:print("Exception when calling ACLApi->get_acl:%s\n"%e)# Configure HTTP basic authorization: basic_authconfiguration=dataplaneapi.Configuration()configuration.username='YOUR_USERNAME'configuration.password='YOUR_PASSWORD'# create an instance of the API classapi_instance=dataplaneapi.ACLApi(dataplaneapi.ApiClient(configuration))parent_name='parent_name_example'# str | Parent nameparent_type='parent_type_example'# str | Parent typeacl_name='acl_name_example'# str | ACL name (optional)transaction_id='transaction_id_example'# str | ID of the transaction where we want to add the operation. Cannot be used when version is specified. (optional)try:# Return an array of all ACL linesapi_response=api_instance.get_acls(parent_name,parent_type,acl_name=acl_name,transaction_id=transaction_id)pprint(api_response)exceptApiExceptionase:print("Exception when calling ACLApi->get_acls:%s\n"%e)# Configure HTTP basic authorization: basic_authconfiguration=dataplaneapi.Configuration()configuration.username='YOUR_USERNAME'configuration.password='YOUR_PASSWORD'# create an instance of the API classapi_instance=dataplaneapi.ACLApi(dataplaneapi.ApiClient(configuration))body=dataplaneapi.Acl()# Acl |parent_name='parent_name_example'# str | Parent nameparent_type='parent_type_example'# str | Parent typeindex=56# int | ACL line Indextransaction_id='transaction_id_example'# str | ID of the transaction where we want to add the operation. Cannot be used when version is specified. (optional)version=56# int | Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. (optional)force_reload=False# bool | If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. (optional) (default to False)try:# Replace a ACL lineapi_response=api_instance.replace_acl(body,parent_name,parent_type,index,transaction_id=transaction_id,version=version,force_reload=force_reload)pprint(api_response)exceptApiExceptionase:print("Exception when calling ACLApi->replace_acl:%s\n"%e)Documentation for API EndpointsSee theAPI Endpoint documentationfor more
details on usage.