Juju Operator Framework Charm Interface for MySQL & MariaDB Relations
To use this interface in your
Juju Operator Framework charm,
instruct charmcraft to embed
it into your built Operator Framework charm by adding ops-lib-mysql to
your requirements.txt file::
ops
ops-lib-mysql
Your charm needs to declare its use of the interface in its metadata.yaml file:
requires:
db:
interface: mysql
limit: 1 # Most charms only handle a single MySQL Application.
Your charm needs to bootstrap it and handle events:
from opslib.mysql import MySQLClient, MySQLRelationEvent
class MyCharm(ops.charm.CharmBase):
_state = ops.framework.StoredState()
def __init__(self, *args):
super().__init__(*args)
self._state.set_default(
db_available=False, db_conn_str=None, db_host=None, db_port=None, db_name=None,
db_user=None, db_password=None, db_root_password=None,
)
self.db = MySQLClient(self, 'db') # 'db' relation in metadata.yaml
self.framework.observe(self.db.on.database_changed, self._on_database_changed)
def _on_database_changed(self, event: MySQLRelationEvent):
self._state.db_available = event.is_available # Boolean flag
self._state.db_conn_str = event.connection_string # host={host} port={port} ...
self._state.db_host = event.host
self._state.db_port = event.port
self._state.db_name = event.database
self._state.db_user = event.user
self._state.db_password = event.password
self._state.db_root_password = event.root_password
Metadata
Release files for ops-lib-mysql 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ops-lib-mysql-1.0.zip | 9.5 kB | Without provenance | Details for ops-lib-mysql-1.0.zip |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ops_lib_mysql-1.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for ops_lib_mysql-1.0-py2.py3-none-any.whl |
Total release size: 16.6 kB
Release files / ops-lib-mysql-1.0.zip
| Download URL | ops-lib-mysql-1.0.zip |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
093215604f00176b0693de7857d4eb7f7da1190fdff4d1a3a95d1cb5d839ac5a
|
|
BLAKE2b-256 checksum How to use checksums |
5fdc77e5602009e7fa96625fa84be8f6c1dce1cefe156e703853772ade188542
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
|
Release files / ops_lib_mysql-1.0-py2.py3-none-any.whl
| Download URL | ops_lib_mysql-1.0-py2.py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
97bf3cf7c2aff0124516d6811071010a3fcdf4f39a01a8855c1c1f27edd7a448
|
|
BLAKE2b-256 checksum How to use checksums |
fe4bdbe3919dfe6f3df36c6dafee29cf3e9c777606fd8007f5de40c6cbedd4c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
|
Security for ops-lib-mysql 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.