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

Latest commit

 

History

History
183 lines (101 loc) · 4.91 KB

provides.md

File metadata and controls

183 lines (101 loc) · 4.91 KB

provides

This is the provides side of the interface layer, for use only by the GCP 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 GCP integration features. The GCP integration charm should then iterate over each request, perform whatever actions are necessary to satisfy those requests, and then mark them as complete.

GCPIntegrationProvides

GCPIntegrationProvides(self, endpoint_name, relation_ids=None)

Example usage:

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

@when('endpoint.gcp.requests-pending')
def handle_requests():
    gcp = endpoint_from_flag('endpoint.gcp.requests-pending')
    for request in gcp.requests:
        if request.instance_labels:
            layer.gcp.label_instance(
                request.instance,
                request.zone,
                request.instance_labels)
        if request.requested_load_balancer_management:
            layer.gcp.enable_load_balancer_management(
                request.charm,
                request.instance,
                request.zone,
            )
        # ...
    gcp.mark_completed()

relation_ids

A list of the IDs of all established relations.

requests

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

get_departed_charms

GCPIntegrationProvides.get_departed_charms(self)

Get a list of all charms that have had all units depart since the last time this was called.

mark_completed

GCPIntegrationProvides.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.

application_name

The name of the application making the request.

charm

The charm name reported for this request.

has_credentials

Whether or not credentials have been set via set_credentials.

instance

The instance name reported for this request.

instance_labels

Mapping of label names to values to apply to this instance.

is_changed

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

model_uuid

The UUID of the model containing the application making this request.

relation_id

The ID of the relation for the unit making the request.

requested_block_storage_management

Flag indicating whether block storage management was requested.

requested_dns_management

Flag indicating whether DNS management was requested.

requested_instance_inspection

Flag indicating whether the ability to inspect instances was requested.

requested_network_management

Flag indicating whether the ability to manage networking was requested.

requested_object_storage_access

Flag indicating whether object storage access was requested.

requested_object_storage_management

Flag indicating whether object storage management was requested.

requested_security_management

Flag indicating whether security management was requested.

unit_name

The name of the unit making the request.

zone

The zone reported for this request.

mark_completed

IntegrationRequest.mark_completed(self)

Mark this request as having been completed.

set_credentials

IntegrationRequest.set_credentials(self, credentials)

Set the credentials for this request.