Charmed-Kubernetes/kubernetes-worker/hooks/relations/vsphere-integration/docs/provides.md

2.1 KiB

provides

This is the provides side of the interface layer, for use only by the vSphere integration charm itself.

The flags that are set by the provides side of this interface are:

  • endpoint.{endpoint_name}.requested This flag is set when there is a new or updated request by a remote unit for vSphere integration features. The vSphere integration charm should then iterate over each request, perform whatever actions are necessary to satisfy those requests, and then mark them as complete.

VsphereIntegrationProvides

VsphereIntegrationProvides(self, endpoint_name, relation_ids=None)

Example usage:

from charms.reactive import when, endpoint_from_flag
from charms import layer

@when('endpoint.vsphere.requests-pending')
def handle_requests():
    vsphere = endpoint_from_flag('endpoint.vsphere.requests-pending')
    for request in vsphere.requests:
        request.set_credentials(layer.vsphere.get_user_credentials())
    vsphere.mark_completed()

requests

A list of the new or updated IntegrationRequests that have been made.

mark_completed

VsphereIntegrationProvides.mark_completed(self)

Mark all requests as completed and remove the requests-pending flag.

IntegrationRequest

IntegrationRequest(self, unit)

A request for integration from a single remote unit.

has_credentials

Whether or not credentials have been set via set_credentials.

is_changed

Whether this request has changed since the last time it was marked completed (if ever).

set_credentials

IntegrationRequest.set_credentials(self, vsphere_ip, user, password, datacenter, datastore)

Set the credentials for this request.