pyvcloud.vcd.api_extension module

class pyvcloud.vcd.api_extension.APIExtension(client)

Bases: object

ATTRIBUTES = ['name', 'namespace', 'enabled', 'exchange', 'routingKey', 'priority', 'isAuthorizationEnabled', 'href', 'id']
add_extension(name, namespace, routing_key, exchange, patterns)

Add an API extension service.

Parameters:
  • name (str) – name of the new API extension service.
  • namespace (str) – namespace of the new API extension service.
  • routing_key (str) – AMQP routing key to use with the extension.
  • exchange (str) – AMQP exchange to use with the extension.
  • patterns (list) – list of url API filters to register with the extension.
Returns:

object containing EntityType.ADMIN_SERVICE XML data i.e. the sparse representation of the API extension.

Return type:

lxml.objectify.ObjectifiedElement

delete_extension(name, namespace)

Delete an API extension service.

Parameters:
  • name (str) – the name of the extension service whose we want to delete.
  • namespace (str) – the namespace of the extension service. If not specified (i.e. = None), we will use the value passed in the name parameter.
Raises:
enable_extension(name, enabled=True, namespace=None)

Enable or disable an API extension service.

Parameters:
  • name (str) – the name of the extension service whose we want to enable/disable.
  • namespace (str) – the namespace of the extension service. If not specified (i.e. = None), we will use the value passed in the name parameter.
  • enabled (bool) – flag to enable or disable the extension.
Returns:

href of the service being enabled/disabled.

Return type:

str

Raises:
get_api_filters(service_id)

Fetch the API filters defined for the service.

Parameters:service_id (str) – the id of the extension service.
Returns:API filters registered for the API extension.
Return type:generator object
get_extension(name, namespace=None)

Fetch info about a particular API extension service.

Parameters:
  • name (str) – the name of the extension service whose info we want to retrieve.
  • namespace (str) – the namespace of the extension service.
Returns:

information about the extension service.

Return type:

dict

Raises:
get_extension_info(name, namespace=None)

Return info about an API extension, including filters.

Parameters:
  • name (str) – the name of the extension service whose info we want to retrieve.
  • namespace (str) – the namespace of the extension service. If not specified (i.e. = None), we will use the value passed in the name parameter.
Returns:

information about the extension.

Return type:

dict

Raises:
list_extensions()

Fetch the API extension services defined in the system.

Returns:all the registered API extension services in the system.
Return type:list