Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Latest commit

 

History

History
71 lines (42 loc) · 2.32 KB

common.md

File metadata and controls

71 lines (42 loc) · 2.32 KB

class JobRequest(BaseRequest)

Base class for requests using the request / response pattern.

Subclasses must set the RESPONSE_CLASS attribute to a subclass of the :class:BaseResponse which defines the fields that the response will use. They must also define additional attributes as :class:Fields.

For example::

class TLSResponse(BaseResponse):
    key = Field('Private key for the cert')
    cert = Field('Public cert info')


class TLSRequest(BaseRequest):
    RESPONSE_CLASS = TLSResponse

    common_name = Field('Common Name (CN) for the cert to be created')
    sans = Field('List of Subject Alternative Names (SANs)')

egress_subnets

Subnets over which network traffic to the requester will flow.

None

Returns a new dict with keys from iterable and values equal to value.

ingress_address

Address to use if a connection to the requester is required.

is_created

Whether this request was created by this side of the relation.

is_received

Whether this request was received by the other side of the relation.

def respond(self, success, reason=None)

Acknowledge this request, and indicate success or failure with an optional explanation.

def to_json(self, ca_file=None, cert_file=None, key_file=None)

Render the job request to JSON string which can be included directly into Prometheus config.

Keys will be sorted in the rendering to ensure a stable ordering for comparisons to detect changes.

If ca_file is given, it will be used to replace the value of any ca_file fields in the job.

If cert_file and key_file are given, they will be used to replace the value of any cert_file and key_file fields in the job.

The charm should ensure that the request's ca_cert, client_cert and client_key data is writen to those paths prior to calling this method.

class JobResponse(BaseResponse)

Base class for responses using the request / response pattern.

None

Returns a new dict with keys from iterable and values equal to value.