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

Latest commit

 

History

History
140 lines (90 loc) · 3.99 KB

requires.md

File metadata and controls

140 lines (90 loc) · 3.99 KB

requires

This is the requires side of the interface layer, for use in charms that wish to request integration with GCP native features. The integration will be provided by the GCP integration charm, which allows the requiring charm to not require cloud credentials itself and not have a lot of GCP specific API code.

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

  • endpoint.{endpoint_name}.joined This flag is set when the relation has been joined, and the charm should then use the methods documented below to request specific GCP features. This flag is automatically removed if the relation is broken. It should not be removed by the charm.

  • endpoint.{endpoint_name}.ready This flag is set once the requested features have been enabled for the GCP instance on which the charm is running. This flag is automatically removed if new integration features are requested. It should not be removed by the charm.

GCPIntegrationRequires

GCPIntegrationRequires(self, *args, **kwargs)

Interface to request integration access.

Note that due to resource limits and permissions granularity, policies are limited to being applied at the charm level. That means that, if any permissions are requested (i.e., any of the enable methods are called), what is granted will be the sum of those ever requested by any instance of the charm on this cloud.

Labels, on the other hand, will be instance specific.

Example usage:

from charms.reactive import when, endpoint_from_flag

@when('endpoint.gcp.joined')
def request_gcp_integration():
    gcp = endpoint_from_flag('endpoint.gcp.joined')
    gcp.label_instance({
        'tag1': 'value1',
        'tag2': None,
    })
    gcp.request_load_balancer_management()
    # ...

@when('endpoint.gcp.ready')
def gcp_integration_ready():
    update_config_enable_gcp()

instance

This unit's instance name.

is_ready

Whether or not the request for this instance has been completed.

zone

The zone this unit is in.

label_instance

GCPIntegrationRequires.label_instance(self, labels)

Request that the given labels be applied to this instance.

Parameters

  • labels (dict): Mapping of labels names to values.

enable_instance_inspection

GCPIntegrationRequires.enable_instance_inspection(self)

Request the ability to inspect instances.

enable_network_management

GCPIntegrationRequires.enable_network_management(self)

Request the ability to manage networking.

enable_security_management

GCPIntegrationRequires.enable_security_management(self)

Request the ability to manage security (e.g., firewalls).

enable_block_storage_management

GCPIntegrationRequires.enable_block_storage_management(self)

Request the ability to manage block storage.

enable_dns_management

GCPIntegrationRequires.enable_dns_management(self)

Request the ability to manage DNS.

enable_object_storage_access

GCPIntegrationRequires.enable_object_storage_access(self)

Request the ability to access object storage.

enable_object_storage_management

GCPIntegrationRequires.enable_object_storage_management(self)

Request the ability to manage object storage.