'loadbalancer' interface protocol API library
Project description
loadbalancer Interface Protocol API Library
This library provides an API for requesting and providing load balancers or ingress endpoints from one charm to another. It can be used in either charms written in the newer Operator Framework or older charms still using the charms.reactive Framework.
Installation / Setup
Include this library as a dependency for your charm, either in
requirements.txt for Operator Framework charms, or wheelhouse.txt for
reactive charms:
loadbalancer_interface
Usage
Requesting Load Balancers
Requesting a load balancer from a provider is done via the LBProvider class.
The general pattern for using the class is:
- Wait for the provider to become available
- Get a
Requestobject via theget_request(name)method - Set the appropriate fields on the request object
- Send the
Requestvia thesend_request(request)method - Wait for the
Responseto be provided (or updated) - Get the
Responseobject via either theget_response(name)method or via thenew_responsesproperty - Confirm that the request was successful and use the provided LB's address
- Acknowledge the
Responseviaack_response(response)
There are examples in the docs on how to do this in an operator charm or in a reactive charm.
Providing Load Balancers
Providing a load balancer to consumers is done via the LBConsumers class. The
general pattern for using the class is:
- Wait for new or updated requests to come in
- Iterate over each request object in the
new_requestsproperty - Create a load balancer according to the request's fields
- Set the appropriate fields on the request's
responseobject - Send the request's response via the
send_response(request)method
There are examples in the docs on how to do this in an operator charm or in a reactive charm.
API Reference
See the API docs for detailed reference on the API.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file loadbalancer_interface-1.0.1.tar.gz.
File metadata
- Download URL: loadbalancer_interface-1.0.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ed3231d03e579536eb9fd58e79d0c84041a20d9b9ec8ca3f5e5eab1bfdae266
|
|
| MD5 |
46195a7ffe20ef19324ecfe1a10ce0bc
|
|
| BLAKE2b-256 |
6840709cdeb064112c5c7b31f86e354eedfe7515460d8efa2ae38fc03a888929
|