SoftLayer.metadata

Metadata Manager/helpers

license

MIT, see LICENSE for more details.

class SoftLayer.managers.metadata.MetadataManager(client=None, timeout=5)[source]

Provides an interface for the SoftLayer metadata service.

See product information here: http://sldn.softlayer.com/reference/services/SoftLayer_Resource_Metadata

This provides metadata about the resourse it is called from. See METADATA_ATTRIBUTES for full list of attributes.

Usage:

>>> import SoftLayer
>>> client = SoftLayer.create_client_from_env()
>>> from SoftLayer import MetadataManager
>>> meta = MetadataManager(client)
>>> meta.get('datacenter')
'dal05'
>>> meta.get('fqdn')
'test.example.com'
Parameters

client (SoftLayer.API.BaseClient) – the client instance

get(name, param=None)[source]

Retreive a metadata attribute.

Parameters
  • name (string) – name of the attribute to retrieve. See attribs

  • param – Required parameter for some attributes

private_network(**kwargs)[source]

Returns details about the private network.

Parameters
  • router (boolean) – True to return router details

  • vlans (boolean) – True to return vlan details

  • vlan_ids (boolean) – True to return vlan_ids

public_network(**kwargs)[source]

Returns details about the public network.

Parameters
  • router (boolean) – True to return router details

  • vlans (boolean) – True to return vlan details

  • vlan_ids (boolean) – True to return vlan_ids

metadata.METADATA_ATTRIBUTES = dict_keys(['backend_mac', 'datacenter', 'datacenter_id', 'domain', 'frontend_mac', 'fqdn', 'hostname', 'id', 'primary_backend_ip', 'primary_ip', 'primary_frontend_ip', 'provision_state', 'router', 'tags', 'user_data', 'user_metadata', 'vlan_ids', 'vlans'])