MAPI - Tenant Resources

New in version 0.9.4.

This class allows to work with the Tenant resources in HCP.

HCP needs to have MAPI enabled at the system-level.

Functions

listtenants

hcpsdk.mapi.listtenants(target, timeout=60, debuglevel=0)[source]

Get a list of available Tenants

Parameters:
  • target – an hcpsdk.Target object
  • timeout – the connection timeout in seconds
  • debuglevel – 0..9 (used in http.client)
Returns:

a list() of Tenant() objects

Raises:

hcpsdk.HcpsdkPortError in case target is initialized with a port different that P_MAPI

Classes

Tenant

class hcpsdk.mapi.Tenant(target, name, timeout=60, debuglevel=0)[source]

A class representing a Tenant

Parameters:
  • target – an hcpsdk.Target object
  • name – the Tenants name
  • timeout – the connection timeout in seconds
  • debuglevel – 0..9 (used in http.client)

Class attributes

name

The name of the Tenant represented by this object.

Class methods

info(cache=True)[source]

Get the settings of the Tenant

Parameters:cache – a bool indicating if cached information shall be used
Returns:a dict holding the Tenants settings
close()[source]

Close the underlying hcpsdk.Connection() object

Exceptions

exception hcpsdk.mapi.TenantError(reason)[source]

Base Exception used by the hcpsdk.mapi.Tenant() class

Parameters:reason – An error description

Sample Code

>>> from pprint import pprint
>>> import hcpsdk
>>> auth = hcpsdk.NativeAuthorization('service', 'service01')
>>> tgt = hcpsdk.Target('admin.hcp73.archivas.com', auth, port=hcpsdk.P_MAPI)
>>> tenants = hcpsdk.mapi.listtenants(tgt)
>>> pprint(tenants)
[<hcpsdk.mapi.tenant.Tenant object at 0x1032ce6a0>,
 <hcpsdk.mapi.tenant.Tenant object at 0x1032ce748>,
 <hcpsdk.mapi.tenant.Tenant object at 0x1032ce7b8>,
 <hcpsdk.mapi.tenant.Tenant object at 0x1032ce828>,
 <hcpsdk.mapi.tenant.Tenant object at 0x1032ce898>,
 <hcpsdk.mapi.tenant.Tenant object at 0x1032ce908>]
>>> tenants[0].name
'Default'
>>> pprint(tenants[0].info())
{'snmpLoggingEnabled': False,
 'syslogLoggingEnabled': False,
 'systemVisibleDescription': '',
 'tenantVisibleDescription': ''}

Warning

The Default Tenant has far less properties compared to the usual Tenants HCP provides.
>>> tenants[1].name
'm'
>>> pprint(tenants[1].info())
{'administrationAllowed': True,
 'authenticationTypes': {'authenticationType': ['LOCAL', 'EXTERNAL']},
 'complianceConfigurationEnabled': True,
 'dataNetwork': '[hcp_system]',
 'hardQuota': '200.00 GB',
 'managementNetwork': '[hcp_system]',
 'maxNamespacesPerUser': 100,
 'name': 'm',
 'namespaceQuota': 'None',
 'replicationConfigurationEnabled': True,
 'searchConfigurationEnabled': True,
 'servicePlanSelectionEnabled': True,
 'snmpLoggingEnabled': False,
 'softQuota': 85,
 'syslogLoggingEnabled': False,
 'systemVisibleDescription': 'Der üblicherweise als erstes erzeugte Tenant...',
 'tags': {'tag': []},
 'tenantVisibleDescription': '',
 'versioningConfigurationEnabled': True}
>>> for t in tenants:
...     t.close()
...
>>>