Bind
- Canonical IS DevOps
Channel | Revision | Published | Runs on |
---|---|---|---|
latest/edge | 39 | 19 Dec 2024 |
juju deploy bind --channel edge
Deploy universal operators easily with Juju, the Universal Operator Lifecycle Manager.
Platform:
charms.bind.v0.dns_record
-
- Last updated 09 Dec 2024
- Revision Library version 0.3
Library to manage the integration with the Bind charm.
This library contains the Requires and Provides classes for handling the integration
between an application and a charm providing the dns_record
integration.
Requirer Charm
from charms.bind.v0.dns_record import DNSRecordRequires
class DNSRecordRequirerCharm(ops.CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.dns_record = DNSRecordRequires(self)
self.framework.observe(self.dns_record.on.dns_record_request_processed, self._handler)
...
def _handler(self, events: DNSRecordRequestProcessed) -> None:
...
As shown above, the library provides a custom event to handle the scenario in which new DNS data has been added or updated.
The DNSRecordRequires provides an update_relation_data
method to update the relation data by
passing a DNSRecordRequirerData
data object, requesting new DNS records.
Provider Charm
Following the previous example, this is an example of the provider charm.
from charms.bind.v0.dns_record import DNSRecordProvides
class DNSRecordProviderCharm(ops.CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.dns_record = DNSRecordProvides(self)
...
The DNSRecordProvides object wraps the list of relations into a relations
property
and provides an update_relation_data
method to update the relation data by passing
a DNSRecordRelationData
data object.
class DNSRecordProviderCharm(ops.CharmBase):
...
def _on_config_changed(self, _) -> None:
for relation in self.model.relations[self.dns_record.relation_name]:
self.dns_record.update_relation_data(relation, self._get_dns_record_data())
Index
class Status
Represent the status values.
Attributes
Methods
Status. _missing_( cls , _: object )
Handle the enum when the value is missing.
Returns
Status.UNKNOWN.
class RecordType
Represent the DNS record types.
Attributes
class RecordClass
Represent the DNS record classes.
Attributes
class DNSProviderData
Represent the DNS provider data.
Attributes
class DNSRecordProviderData
List of entries for the provider to manage.
Attributes
Methods
DNSRecordProviderData. to_relation_data( self )
Convert an instance of DNSRecordProviderData to the relation representation.
Returns
Dict containing the representation.
DNSRecordProviderData. from_relation( cls , relation )
Initialize a new instance of the DNSRecordProviderData class from the relation.
Arguments
the relation.
Returns
A DNSRecordProviderData instance.
class RequirerEntry
DNS requirer entries requested.
Attributes
Methods
RequirerEntry. validate_dns_entry( self , _: ValidationInfo )
Validate DNS entries.
Returns
the DNS entry if valid.
class DNSRecordRequirerData
List of domains for the provider to manage.
Attributes
Methods
DNSRecordRequirerData. to_relation_data( self )
Convert an instance of DNSRecordRequirerData to the relation representation.
Returns
Dict containing the representation.
DNSRecordRequirerData. from_relation( cls , relation )
Get a Tuple of DNSRecordRequirerData and DNSRecordProviderData from the relation data.
Arguments
the relation.
Returns
the relation data and the processed entries for it.
class DNSRecordRequestProcessed
DNS event emitted when a new request is processed.
Attributes
Methods
DNSRecordRequestProcessed. get_dns_record_provider_relation_data( self )
Get a DNSRecordProviderData for the relation data.
Returns
the DNSRecordProviderData for the relation data.
DNSRecordRequestProcessed. dns_entries( self )
Description
Fetch the DNS entries from the relation. None
class DNSRecordRequestReceived
DNS event emitted when a new request is made.
Attributes
Methods
DNSRecordRequestReceived. dns_record_requirer_relation_data( self )
Description
Get the requirer data and corresponding provider data the relation data. None
DNSRecordRequestReceived. dns_entries( self )
Description
Fetch the DNS entries from the relation. None
DNSRecordRequestReceived. processed_entries( self )
Description
Fetch the processed DNS entries. None
class DNSRecordRequiresEvents
DNS record requirer events.
Attributes
Description
This class defines the events that a DNS record requirer can emit.
class DNSRecordRequires
Requirer side of the DNS requires relation.
Attributes
Methods
DNSRecordRequires. __init__( self , charm , relation_name: str )
Construct.
Arguments
the provider charm.
the relation name.
DNSRecordRequires. get_remote_relation_data( self )
Retrieve the remote relation data.
Returns
the relation data.
DNSRecordRequires. update_relation_data( self , relation , dns_record_requirer_data: DNSRecordRequirerData )
Update the relation data.
Arguments
the relation for which to update the data.
DNSRecordRequirerData wrapping the data to be updated.
class DNSRecordProvidesEvents
DNS record provider events.
Attributes
Description
This class defines the events that a DNS record provider can emit.
class DNSRecordProvides
Provider side of the DNS record relation.
Attributes
Methods
DNSRecordProvides. __init__( self , charm , relation_name: str )
Construct.
Arguments
the provider charm.
the relation name.
DNSRecordProvides. get_remote_relation_data( self )
Retrieve all the remote relations data.
Returns
the relation data and the processed entries for it.
DNSRecordProvides. update_relation_data( self , relation , dns_record_provider_data: DNSRecordProviderData )
Update the relation data.
Arguments
the relation for which to update the data.
a DNSRecordProviderData instance wrapping the data to be updated.