27
wildlife Documentation Release 0.1.0 Di Xu December 22, 2015

Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife DocumentationRelease 010

Di Xu

December 22 2015

Contents

1 About This Project 3

2 Important Links 5

3 How to Use amp Configure 7

4 Important Notice 9

5 Public REST APIs 1151 REST APIs 11

6 API Documentation 1361 wildlifeapp 1362 wildlifemanager 1363 wildliferest 1364 wildlifewild 1765 wildlifewildutils 17

7 Indices and tables 19

Python Module Index 21

i

ii

wildlife Documentation Release 010

A Flask-based Server Interface to Provide REST APIs for Apache Zookeeper

Contents 1

wildlife Documentation Release 010

2 Contents

CHAPTER 1

About This Project

This project wildlife (I got this name inspired from the meaning of Apache ZooKeeper) is a server interface providingREST APIs for Apache ZooKeeper

This project now can help you

bull Provide REST APIs (including GETPUTPOSTDELETE) for other micro-services that utilize ZooKeepercluster for configuration

bull Access all your ZooKeeper Clusters in one portal

3

wildlife Documentation Release 010

4 Chapter 1 About This Project

CHAPTER 2

Important Links

Support and bug-reports httpsgithubcomdixudxwildlifeissuesq=is3Aopen+sort3Acomments-desc

Project source code httpsgithubcomdixudxwildlife

Project documentation httpsreadthedocsorgprojectswildlife

5

wildlife Documentation Release 010

6 Chapter 2 Important Links

CHAPTER 3

How to Use amp Configure

To install wildlife simply run

$ git clone httpsgithubcomdixudxwildlife$ cd wildlife$ python setuppy install

To configure wildlife simply run

$ cd your-site-packageswildlifeconfig$ cp wildlifeymlexample wildlifeyml$ vim wildlifeyml

And then modify your configurations accordingly

After the configuration you can start wildlife journey by running

$ python restpy

7

wildlife Documentation Release 010

8 Chapter 3 How to Use amp Configure

CHAPTER 4

Important Notice

Please do NOT use ldquolistrdquo ldquodatardquo ldquochildrenrdquo and ldquoaclsrdquo as znodes names which have been preserved for theREST APIs usage and may result in conflicts if using

9

wildlife Documentation Release 010

10 Chapter 4 Important Notice

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 2: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

Contents

1 About This Project 3

2 Important Links 5

3 How to Use amp Configure 7

4 Important Notice 9

5 Public REST APIs 1151 REST APIs 11

6 API Documentation 1361 wildlifeapp 1362 wildlifemanager 1363 wildliferest 1364 wildlifewild 1765 wildlifewildutils 17

7 Indices and tables 19

Python Module Index 21

i

ii

wildlife Documentation Release 010

A Flask-based Server Interface to Provide REST APIs for Apache Zookeeper

Contents 1

wildlife Documentation Release 010

2 Contents

CHAPTER 1

About This Project

This project wildlife (I got this name inspired from the meaning of Apache ZooKeeper) is a server interface providingREST APIs for Apache ZooKeeper

This project now can help you

bull Provide REST APIs (including GETPUTPOSTDELETE) for other micro-services that utilize ZooKeepercluster for configuration

bull Access all your ZooKeeper Clusters in one portal

3

wildlife Documentation Release 010

4 Chapter 1 About This Project

CHAPTER 2

Important Links

Support and bug-reports httpsgithubcomdixudxwildlifeissuesq=is3Aopen+sort3Acomments-desc

Project source code httpsgithubcomdixudxwildlife

Project documentation httpsreadthedocsorgprojectswildlife

5

wildlife Documentation Release 010

6 Chapter 2 Important Links

CHAPTER 3

How to Use amp Configure

To install wildlife simply run

$ git clone httpsgithubcomdixudxwildlife$ cd wildlife$ python setuppy install

To configure wildlife simply run

$ cd your-site-packageswildlifeconfig$ cp wildlifeymlexample wildlifeyml$ vim wildlifeyml

And then modify your configurations accordingly

After the configuration you can start wildlife journey by running

$ python restpy

7

wildlife Documentation Release 010

8 Chapter 3 How to Use amp Configure

CHAPTER 4

Important Notice

Please do NOT use ldquolistrdquo ldquodatardquo ldquochildrenrdquo and ldquoaclsrdquo as znodes names which have been preserved for theREST APIs usage and may result in conflicts if using

9

wildlife Documentation Release 010

10 Chapter 4 Important Notice

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 3: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

ii

wildlife Documentation Release 010

A Flask-based Server Interface to Provide REST APIs for Apache Zookeeper

Contents 1

wildlife Documentation Release 010

2 Contents

CHAPTER 1

About This Project

This project wildlife (I got this name inspired from the meaning of Apache ZooKeeper) is a server interface providingREST APIs for Apache ZooKeeper

This project now can help you

bull Provide REST APIs (including GETPUTPOSTDELETE) for other micro-services that utilize ZooKeepercluster for configuration

bull Access all your ZooKeeper Clusters in one portal

3

wildlife Documentation Release 010

4 Chapter 1 About This Project

CHAPTER 2

Important Links

Support and bug-reports httpsgithubcomdixudxwildlifeissuesq=is3Aopen+sort3Acomments-desc

Project source code httpsgithubcomdixudxwildlife

Project documentation httpsreadthedocsorgprojectswildlife

5

wildlife Documentation Release 010

6 Chapter 2 Important Links

CHAPTER 3

How to Use amp Configure

To install wildlife simply run

$ git clone httpsgithubcomdixudxwildlife$ cd wildlife$ python setuppy install

To configure wildlife simply run

$ cd your-site-packageswildlifeconfig$ cp wildlifeymlexample wildlifeyml$ vim wildlifeyml

And then modify your configurations accordingly

After the configuration you can start wildlife journey by running

$ python restpy

7

wildlife Documentation Release 010

8 Chapter 3 How to Use amp Configure

CHAPTER 4

Important Notice

Please do NOT use ldquolistrdquo ldquodatardquo ldquochildrenrdquo and ldquoaclsrdquo as znodes names which have been preserved for theREST APIs usage and may result in conflicts if using

9

wildlife Documentation Release 010

10 Chapter 4 Important Notice

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 4: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

A Flask-based Server Interface to Provide REST APIs for Apache Zookeeper

Contents 1

wildlife Documentation Release 010

2 Contents

CHAPTER 1

About This Project

This project wildlife (I got this name inspired from the meaning of Apache ZooKeeper) is a server interface providingREST APIs for Apache ZooKeeper

This project now can help you

bull Provide REST APIs (including GETPUTPOSTDELETE) for other micro-services that utilize ZooKeepercluster for configuration

bull Access all your ZooKeeper Clusters in one portal

3

wildlife Documentation Release 010

4 Chapter 1 About This Project

CHAPTER 2

Important Links

Support and bug-reports httpsgithubcomdixudxwildlifeissuesq=is3Aopen+sort3Acomments-desc

Project source code httpsgithubcomdixudxwildlife

Project documentation httpsreadthedocsorgprojectswildlife

5

wildlife Documentation Release 010

6 Chapter 2 Important Links

CHAPTER 3

How to Use amp Configure

To install wildlife simply run

$ git clone httpsgithubcomdixudxwildlife$ cd wildlife$ python setuppy install

To configure wildlife simply run

$ cd your-site-packageswildlifeconfig$ cp wildlifeymlexample wildlifeyml$ vim wildlifeyml

And then modify your configurations accordingly

After the configuration you can start wildlife journey by running

$ python restpy

7

wildlife Documentation Release 010

8 Chapter 3 How to Use amp Configure

CHAPTER 4

Important Notice

Please do NOT use ldquolistrdquo ldquodatardquo ldquochildrenrdquo and ldquoaclsrdquo as znodes names which have been preserved for theREST APIs usage and may result in conflicts if using

9

wildlife Documentation Release 010

10 Chapter 4 Important Notice

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 5: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

2 Contents

CHAPTER 1

About This Project

This project wildlife (I got this name inspired from the meaning of Apache ZooKeeper) is a server interface providingREST APIs for Apache ZooKeeper

This project now can help you

bull Provide REST APIs (including GETPUTPOSTDELETE) for other micro-services that utilize ZooKeepercluster for configuration

bull Access all your ZooKeeper Clusters in one portal

3

wildlife Documentation Release 010

4 Chapter 1 About This Project

CHAPTER 2

Important Links

Support and bug-reports httpsgithubcomdixudxwildlifeissuesq=is3Aopen+sort3Acomments-desc

Project source code httpsgithubcomdixudxwildlife

Project documentation httpsreadthedocsorgprojectswildlife

5

wildlife Documentation Release 010

6 Chapter 2 Important Links

CHAPTER 3

How to Use amp Configure

To install wildlife simply run

$ git clone httpsgithubcomdixudxwildlife$ cd wildlife$ python setuppy install

To configure wildlife simply run

$ cd your-site-packageswildlifeconfig$ cp wildlifeymlexample wildlifeyml$ vim wildlifeyml

And then modify your configurations accordingly

After the configuration you can start wildlife journey by running

$ python restpy

7

wildlife Documentation Release 010

8 Chapter 3 How to Use amp Configure

CHAPTER 4

Important Notice

Please do NOT use ldquolistrdquo ldquodatardquo ldquochildrenrdquo and ldquoaclsrdquo as znodes names which have been preserved for theREST APIs usage and may result in conflicts if using

9

wildlife Documentation Release 010

10 Chapter 4 Important Notice

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 6: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

CHAPTER 1

About This Project

This project wildlife (I got this name inspired from the meaning of Apache ZooKeeper) is a server interface providingREST APIs for Apache ZooKeeper

This project now can help you

bull Provide REST APIs (including GETPUTPOSTDELETE) for other micro-services that utilize ZooKeepercluster for configuration

bull Access all your ZooKeeper Clusters in one portal

3

wildlife Documentation Release 010

4 Chapter 1 About This Project

CHAPTER 2

Important Links

Support and bug-reports httpsgithubcomdixudxwildlifeissuesq=is3Aopen+sort3Acomments-desc

Project source code httpsgithubcomdixudxwildlife

Project documentation httpsreadthedocsorgprojectswildlife

5

wildlife Documentation Release 010

6 Chapter 2 Important Links

CHAPTER 3

How to Use amp Configure

To install wildlife simply run

$ git clone httpsgithubcomdixudxwildlife$ cd wildlife$ python setuppy install

To configure wildlife simply run

$ cd your-site-packageswildlifeconfig$ cp wildlifeymlexample wildlifeyml$ vim wildlifeyml

And then modify your configurations accordingly

After the configuration you can start wildlife journey by running

$ python restpy

7

wildlife Documentation Release 010

8 Chapter 3 How to Use amp Configure

CHAPTER 4

Important Notice

Please do NOT use ldquolistrdquo ldquodatardquo ldquochildrenrdquo and ldquoaclsrdquo as znodes names which have been preserved for theREST APIs usage and may result in conflicts if using

9

wildlife Documentation Release 010

10 Chapter 4 Important Notice

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 7: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

4 Chapter 1 About This Project

CHAPTER 2

Important Links

Support and bug-reports httpsgithubcomdixudxwildlifeissuesq=is3Aopen+sort3Acomments-desc

Project source code httpsgithubcomdixudxwildlife

Project documentation httpsreadthedocsorgprojectswildlife

5

wildlife Documentation Release 010

6 Chapter 2 Important Links

CHAPTER 3

How to Use amp Configure

To install wildlife simply run

$ git clone httpsgithubcomdixudxwildlife$ cd wildlife$ python setuppy install

To configure wildlife simply run

$ cd your-site-packageswildlifeconfig$ cp wildlifeymlexample wildlifeyml$ vim wildlifeyml

And then modify your configurations accordingly

After the configuration you can start wildlife journey by running

$ python restpy

7

wildlife Documentation Release 010

8 Chapter 3 How to Use amp Configure

CHAPTER 4

Important Notice

Please do NOT use ldquolistrdquo ldquodatardquo ldquochildrenrdquo and ldquoaclsrdquo as znodes names which have been preserved for theREST APIs usage and may result in conflicts if using

9

wildlife Documentation Release 010

10 Chapter 4 Important Notice

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 8: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

CHAPTER 2

Important Links

Support and bug-reports httpsgithubcomdixudxwildlifeissuesq=is3Aopen+sort3Acomments-desc

Project source code httpsgithubcomdixudxwildlife

Project documentation httpsreadthedocsorgprojectswildlife

5

wildlife Documentation Release 010

6 Chapter 2 Important Links

CHAPTER 3

How to Use amp Configure

To install wildlife simply run

$ git clone httpsgithubcomdixudxwildlife$ cd wildlife$ python setuppy install

To configure wildlife simply run

$ cd your-site-packageswildlifeconfig$ cp wildlifeymlexample wildlifeyml$ vim wildlifeyml

And then modify your configurations accordingly

After the configuration you can start wildlife journey by running

$ python restpy

7

wildlife Documentation Release 010

8 Chapter 3 How to Use amp Configure

CHAPTER 4

Important Notice

Please do NOT use ldquolistrdquo ldquodatardquo ldquochildrenrdquo and ldquoaclsrdquo as znodes names which have been preserved for theREST APIs usage and may result in conflicts if using

9

wildlife Documentation Release 010

10 Chapter 4 Important Notice

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 9: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

6 Chapter 2 Important Links

CHAPTER 3

How to Use amp Configure

To install wildlife simply run

$ git clone httpsgithubcomdixudxwildlife$ cd wildlife$ python setuppy install

To configure wildlife simply run

$ cd your-site-packageswildlifeconfig$ cp wildlifeymlexample wildlifeyml$ vim wildlifeyml

And then modify your configurations accordingly

After the configuration you can start wildlife journey by running

$ python restpy

7

wildlife Documentation Release 010

8 Chapter 3 How to Use amp Configure

CHAPTER 4

Important Notice

Please do NOT use ldquolistrdquo ldquodatardquo ldquochildrenrdquo and ldquoaclsrdquo as znodes names which have been preserved for theREST APIs usage and may result in conflicts if using

9

wildlife Documentation Release 010

10 Chapter 4 Important Notice

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 10: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

CHAPTER 3

How to Use amp Configure

To install wildlife simply run

$ git clone httpsgithubcomdixudxwildlife$ cd wildlife$ python setuppy install

To configure wildlife simply run

$ cd your-site-packageswildlifeconfig$ cp wildlifeymlexample wildlifeyml$ vim wildlifeyml

And then modify your configurations accordingly

After the configuration you can start wildlife journey by running

$ python restpy

7

wildlife Documentation Release 010

8 Chapter 3 How to Use amp Configure

CHAPTER 4

Important Notice

Please do NOT use ldquolistrdquo ldquodatardquo ldquochildrenrdquo and ldquoaclsrdquo as znodes names which have been preserved for theREST APIs usage and may result in conflicts if using

9

wildlife Documentation Release 010

10 Chapter 4 Important Notice

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 11: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

8 Chapter 3 How to Use amp Configure

CHAPTER 4

Important Notice

Please do NOT use ldquolistrdquo ldquodatardquo ldquochildrenrdquo and ldquoaclsrdquo as znodes names which have been preserved for theREST APIs usage and may result in conflicts if using

9

wildlife Documentation Release 010

10 Chapter 4 Important Notice

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 12: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

CHAPTER 4

Important Notice

Please do NOT use ldquolistrdquo ldquodatardquo ldquochildrenrdquo and ldquoaclsrdquo as znodes names which have been preserved for theREST APIs usage and may result in conflicts if using

9

wildlife Documentation Release 010

10 Chapter 4 Important Notice

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 13: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

10 Chapter 4 Important Notice

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 14: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

CHAPTER 5

Public REST APIs

51 REST APIs

bull GET

ndash hello page on wildlife REST APIs usages (see resthello for more details)

http[host][port]

ndash get all clusters info (see restclusters for more details)

http[host][port]wildlife

ndash get the basic information of a specific cluster(see restdetail_cluster for more details)

http[host][port]wildlife[cluster_name]

ndash get the root children of a specific cluster(see restcluster_list_children for more details)

http[host][port]wildlife[cluster_name]list

ndash get the znode data including the znodeStat(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

ndash get the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlife[cluster_name][pathznode]acls

ndash get the children of a znode in a specific cluster(see restcluster_znode_children for more details)

http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

ndash get only the data of a znode in a specific cluster(see restcluster_znode_data for more details)

http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

bull POST

ndash create a znode in a specific cluster(see restcluster_create_znode for more details)

http[host][port]wildlife[cluster_name]

bull PUT

11

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 15: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

ndash update the acls of a znode in a specific cluster(see restcluster_znode_acls for more details)

http[host][port]wildlifeltcluster_namegtltpathznodegtacls

ndash update the znode data(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

bull DELETE

ndash delete the znode(see restcluster_znode for more details)

http[host][port]wildlife[cluster_name][znode]

12 Chapter 5 Public REST APIs

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 16: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

CHAPTER 6

API Documentation

61 wildlifeapp

class wildlifeappWildApp(import_name conf_path static_path=None static_url_path=Nonestatic_folder=rsquostaticrsquo template_folder=rsquotemplatesrsquo in-stance_path=None instance_relative_config=False)

Bases flaskappFlask

A wrapped class to host flask app and backend WildLife

Inherit from Flask and Initialize WildLife in __init__

Parameters conf_path ndash the configuration yaml file path

62 wildlifemanager

class wildlifemanagerClusterManager(cluster)Bases threadingThread

63 wildliferest

wildliferestcluster_create_znode(cluster_name znode)create a znode in a specific cluster

POST http[host][port]wildlife[cluster_name]

Headers (optional if you need want to create these znodes

with an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo True ldquoallrdquo False

Content-Type ldquoapplicationjsonrdquo or ldquomultipartform-datardquo

DATA

ldquoznode_path1rdquo ldquoznode_data1rdquo ldquoznode_path2rdquo ldquoznode_data2rdquo

13

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 17: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

Response (string) [created_znode_path_list]

wildliferestcluster_list_children(cluster_name znode)get the root children of a specific cluster

GET http[host][port]wildlife[cluster_name]list

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [children_list]

wildliferestcluster_znode(cluster_name znode)get the znode data including the znodeStat update the znode data and delete the znode

GET http[host][port]wildlife[cluster_name][znode]

eg httplocalhost5000wildlifecluster01znode1znode2znode3

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 19 ldquomtimerdquo 1448608198011 ldquoczxidrdquo8589936224 ldquopzxidrdquo 8589936224 ldquoctimerdquo 1448608198011 ldquomzxidrdquo 8589936224ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 0

ldquodatardquo ldquodata for this znoderdquo

PUT http[host][port]wildlife[cluster_name][znode]

Content-Type ldquotextplaincharset=UTF-8rdquo ldquoapplicationjsonrdquo ldquotextxmlrdquo or ldquomultipartform-datardquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

Response (json data)

ldquoznodeStatrdquo

ldquoephemeralOwnerrdquo 0 ldquodataLengthrdquo 27 ldquomtimerdquo 1449033225435 ldquoczxidrdquo8589936438 ldquopzxidrdquo 8589936439 ldquoctimerdquo 1449033225435 ldquomzxidrdquo 8589936438ldquonumChildrenrdquo 0 ldquoversionrdquo 0 ldquoaversionrdquo 0 ldquocversionrdquo 1

ldquodatardquo ldquoupdated data for this znoderdquo

DELETE http[host][port]wildlife[cluster_name][znode]

14 Chapter 6 API Documentation

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 18: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) Successfully Delete Znode [znode] from Cluster [cluster_name]

wildliferestcluster_znode_acls(cluster_name znode)get or update the acls of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]acls

eg httplocalhost5000wildlifecluster01znode1znode2znode3acls

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) [ACL(perms=31 acl_list=[rsquoALLrsquo] id=Id(scheme=ursquoworldrsquo id=ursquoanyonersquo))]

PUT http[host][port]wildlife[cluster_name][znode]acls

Content-Type ldquotextplainrdquo or ldquotextxmlrdquo

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

DATA

[

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo ldquoreadrdquo True ldquowriterdquo False ldquocreaterdquoFalse ldquodeleterdquo False ldquoadminrdquo False ldquoallrdquo False

ldquoschemerdquo ldquodigestrdquo

ldquocredentialrdquo ldquouser2password2rdquo ldquoallrdquo True

]

Parameters Explanations scheme The scheme to use Ie digest credential A colon separated usernamepassword

The password should be hashed with the scheme specified

write (bool) Write permission create (bool) Create permission delete (bool) Delete permission admin(bool) Admin permission all (bool) All permissions

Response (string) [created_znode_path_list]

wildliferestcluster_znode_children(cluster_name znode)get the children of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]children

eg httplocalhost5000wildlifecluster01znode1znode2children

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

63 wildliferest 15

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 19: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

Response (string) [children_list]

wildliferestcluster_znode_data(cluster_name znode)get only the data of a znode in a specific cluster

GET http[host][port]wildlife[cluster_name][znode]data

eg httplocalhost5000wildlifecluster01znode1znode2znode3data

Headers (optional if the znode you are accessing needs an acl)

ldquoschemerdquo ldquodigestrdquo ldquocredentialrdquo ldquouser1password1rdquo

Response (string) data for this znode

wildliferestclusters()get all clusters

GET http[host][port]wildlife

Response (json data)

ldquoclustersrdquo [cluster_list]

wildliferestdetail_cluster(cluster_name znode)get the basic information of a specific cluster

GET http[host][port]wildlife[cluster_name]

Response (json data)

ldquoconnectionrdquo ldquoCONNECTEDrdquo ldquohostsrdquo ldquo10xxxxxx218110xxxxxx2182rdquo ldquonamerdquo ldquoclus-ter01rdquo ldquotimeoutrdquo 100 ldquorandomize_hostsrdquo true

wildliferesthello()This is the hello page on wildlife REST APIs usages

GET hello page on wildlife REST APIs usages http[host][port]

get all clusters info http[host][port]wildlife

get the basic information of a specific cluster http[host][port]wildlife[cluster_name]

get the root children of a specific cluster http[host][port]wildlife[cluster_name]list

get the znode data including the znodeStat http[host][port]wildlife[cluster_name][znode] eghttplocalhost5000wildlifecluster01znode1znode2znode3

get the acls of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]acls

get the children of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]childreneg httplocalhost5000wildlifecluster01znode1znode2children

get only the data of a znode in a specific cluster http[host][port]wildlife[cluster_name][znode]dataeg httplocalhost5000wildlifecluster01znode1znode2znode3data

POST create a znode in a specific cluster http[host][port]wildlife[cluster_name]

PUT update the znode data http[host][port]wildlife[cluster_name][znode]

DELETE delete the znode http[host][port]wildlife[cluster_name][znode]

16 Chapter 6 API Documentation

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 20: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

64 wildlifewild

class wildlifewildWildLife(conf_path)Bases threadingThread

An Wrapped Class to Handle and Process the Configuration File

Parameters conf_path ndash the configuration yaml file path

65 wildlifewildutils

class wildlifewildutilsACLConfig(raw_data)Bases wildlifewildutilsConfigValue

Configuration for ACL

class wildlifewildutilsClusterBases wildlifewildutilsConfigValue

Configuration Class for ZooKeeper Cluster

class wildlifewildutilsConfigBases wildlifewildutilsConfigValue

Configuration Class for WildLife

class wildlifewildutilsConfigValueBases object

Base Class for Configuration

64 wildlifewild 17

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 21: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

18 Chapter 6 API Documentation

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 22: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

CHAPTER 7

Indices and tables

bull genindex

bull modindex

bull search

19

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 23: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

20 Chapter 7 Indices and tables

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 24: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

Python Module Index

wwildlifeapp 13wildliferest 13wildlifewild 17wildlifewildutils 17

21

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 25: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

wildlife Documentation Release 010

22 Python Module Index

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index
Page 26: Release 0.1.0 Di Xu · A Flask-based Server Interface to Provide REST APIs forApache Zookeeper Contents 1. wildlife Documentation, Release 0.1.0 2 Contents . CHAPTER 1 About This

Index

AACLConfig (class in wildlifewildutils) 17

CCluster (class in wildlifewildutils) 17cluster_create_znode() (in module wildliferest) 13cluster_list_children() (in module wildliferest) 14cluster_znode() (in module wildliferest) 14cluster_znode_acls() (in module wildliferest) 15cluster_znode_children() (in module wildliferest) 15cluster_znode_data() (in module wildliferest) 16ClusterManager (class in wildlifemanager) 13clusters() (in module wildliferest) 16Config (class in wildlifewildutils) 17ConfigValue (class in wildlifewildutils) 17

Ddetail_cluster() (in module wildliferest) 16

Hhello() (in module wildliferest) 16

WWildApp (class in wildlifeapp) 13WildLife (class in wildlifewild) 17wildlifeapp (module) 13wildliferest (module) 13wildlifewild (module) 17wildlifewildutils (module) 17

23

  • About This Project
  • Important Links
  • How to Use amp Configure
  • Important Notice
  • Public REST APIs
    • REST APIs
      • API Documentation
        • wildlifeapp
        • wildlifemanager
        • wildliferest
        • wildlifewild
        • wildlifewildutils
          • Indices and tables
          • Python Module Index