4.2 KiB
requires
This is the requires side of the interface layer, for use in charms that wish to request integration with Azure native features. The integration will be provided by the Azure integrator charm, which allows the requiring charm to not require cloud credentials itself and not have a lot of Azure specific API code.
The flags that are set by the requires side of this interface are:
-
endpoint.{endpoint_name}.joinedThis flag is set when the relation has been joined, and the charm should then use the methods documented below to request specific Azure features. This flag is automatically removed if the relation is broken. It should not be removed by the charm. -
endpoint.{endpoint_name}.readyThis flag is set once the requested features have been enabled for the Azure 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.
AzureIntegrationRequires
AzureIntegrationRequires(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.azure.joined')
def request_azure_integration():
azure = endpoint_from_flag('endpoint.azure.joined')
azure.tag_instance({
'tag1': 'value1',
'tag2': None,
})
azure.request_load_balancer_management()
# ...
@when('endpoint.azure.ready')
def azure_integration_ready():
update_config_enable_azure()
is_ready
Whether or not the request for this instance has been completed.
resource_group
The resource group this unit is in.
vm_id
This unit's instance ID.
vm_name
This unit's instance name.
tag_instance
AzureIntegrationRequires.tag_instance(self, tags)
Request that the given tags be applied to this instance.
Parameters
tags(dict): Mapping of tags names to values.
enable_instance_inspection
AzureIntegrationRequires.enable_instance_inspection(self)
Request the ability to inspect instances.
enable_network_management
AzureIntegrationRequires.enable_network_management(self)
Request the ability to manage networking.
enable_security_management
AzureIntegrationRequires.enable_security_management(self)
Request the ability to manage security (e.g., firewalls).
enable_block_storage_management
AzureIntegrationRequires.enable_block_storage_management(self)
Request the ability to manage block storage.
enable_dns_management
AzureIntegrationRequires.enable_dns_management(self)
Request the ability to manage DNS.
enable_object_storage_access
AzureIntegrationRequires.enable_object_storage_access(self)
Request the ability to access object storage.
enable_object_storage_management
AzureIntegrationRequires.enable_object_storage_management(self)
Request the ability to manage object storage.