Service Module

There is rarely a need to create a custom instance of any of the classes here. :py:

class arrowhead_client.service.Service(service_definition, service_uri='', interface=None, access_policy=AccessPolicy.CERTIFICATE, metadata=None, version=None)

Arrowhead Service class.

Parameters
  • service_definition (str) –

  • service_uri (str) –

  • interface (ServiceInterface) –

  • access_policy (str) –

  • metadata (Metadata) –

  • version (Version) –

Return type

None

service_definition

Service definition as str.

service_uri

Service uri location as str.

interface

Service interface triple, given as str (ex. 'HTTP-SECURITY_SECURE-JSON') or as ServiceInterface.

access_policy

Access policy for the service, needs to be one of NOT_SECURE, POLICY_CERTIFICATE, or POLICY_TOKEN.

metadata

Metadata provided in a json-compliant dictionary.

version

Service version.

class arrowhead_client.service.ServiceInterface(protocol, secure, payload)

Service interface triple class.

Parameters
  • protocol (str) –

  • secure (str) –

  • payload (str) –

Return type

None

protocol

Protocol description.

Type

str

secure

Security information description.

Type

str

payload

Payload format description.

Type

str

classmethod from_str(interface_str)

Construct a ServiceInterface from a string representation.

Parameters

interface_str (str) – string representation of type ‘PROTOCOL-SECURITY_SECURE-PAYLOAD’

Return type

ServiceInterface

Returns

ServiceInterface from string description.

Raises

TypeError if interface string is malformed.

classmethod with_access_policy(protocol, access_policy, payload)

Construct a ServiceInterface similar to the normal constructor, but using the name of an access policy instead of ‘SECURITY_SECURE’ or ‘SECURITY_INSECURE’

Parameters
  • protocol – Protocol supported by service.

  • access_policy – Access policy.

  • payload – Payload type.

Returns

ServiceInterface from string description.