Reference Guide

This library provides classes that allow to communicate with Envase Identity Manager. The library can be used by Envase applications and services to handle envase users, organizations and different apps/services.

Data Classes

enimc.data

This module contains data classes that can be used with the different clients to interact with Envase Identity Manager to deal with users, organizations and services. The data classes implement the ISerializable interface, and the clients rely on this interface to communicate with Envase Identity Manager. Applications can use the classes on this module or implement their own to customize how the serialization happens.

class OrganizationInfo(name: str)

Serializable data structure that represents the Organization supported by Envase Identity Manager.

Parameters

name (str) – The name of the organization

class PartnerInfo(organization_id: str)
Serializable data structure that represents the Organization info to share tms with it

supported by Envase Identity Manager.

Parameters

organization_id (str) – The id of the organization to have the tms shared with.

class TmsInfo(name: str, type: str, url: str)

Serializable data structure that represents the Tms supported by Envase Identity Manager.

Parameters
  • name (str) – The name of the tms

  • type (str) – The type of the tms [PROFITTOOLS, GTG, etc…]

  • url (str) – The url of the tms

class UserInfo(name: str, email: str, role: str, organization_id: str = '')

Serializable data structure that represents the User supported by Envase Identity Manager.

Parameters
  • name (str) – The full name of the user

  • email (str) – A valid email for the user

  • role (str) – A role from [‘USER’, ‘ORG_ADMIN’, ‘SYS_ADMIN’] that represents the role level of the user.

  • organization_id (str) – A valid organization id that a user would belong to.

class UserTmsInfo(tms_id: str, role: str = '', tms_internal_id: str = '')

Serializable data structure that represents the User-Tms Association info supported by Envase Identity Manager.

Parameters
  • tms_id (str) – The id of the tms

  • role (str) – The user role on this tms [driver, carrier, …. etc]

  • tms_internal_id (str) – The internal id associated with this user in this tms

Clients

enimc.users

This module provides classes that allow an application and service to talk to Envase Identity Manager users service.

class UsersClient(environment, authorizer, base_url=None, _test_session=None)

This class provides the client interface to communicate with Envase Identity Manager Users.

Parameters
  • environment (str) – Environment identifier for the Envase Identity Manager instance to connect.

  • authorizer (Authorizer) – Authorizer class that allows to send authorized calls to Envase Identity Manager.

  • (optional) (str base_url) – Base url for identity manager service. if not passed it will default to get it from en_environment.

associate_to_service(user_id, serializable_user_service)

Associates a user to a service in the identity manager.

param str user_id

The id of the user to associate with a service.

Parameters

serializable_user_service (Serializable) – Serializable object that serializes to a valid payload to create a new User-Service Association.

Returns

An object with the properties of the created Association.

associate_to_tms(user_id, serializable_user_tms)

Associates a user to a tms in the identity manager.

param str user_id

The id of the user to associate with a tms.

Parameters

serializable_user_tms (Serializable) – Serializable object that serializes to a valid payload to create a new User-Tms Association.

Returns

An object with the properties of the created Association.

create(serializable_user)

Creates a new User.

Parameters

serializable_user (Serializable) – Serializable object that serializes to a valid payload to create a new User.

Returns

An object with the properties of the created User.

delete(user_id)

Deletes a User from Identity Manager Service.

Parameters

user_id (str) – Id of the User to delete.

Returns

True if the User existed and was deleted or False otherwise. Regardless, the User will no longer be available.

get(user_id)

Get User.

Parameters

user_id (str) – Id of the user that will be retrieved.

Returns

An object with the properties of the User.

update(user_id, serializable_user)

update user info. :param str user_id:

Id of the user that will be updated.

Parameters

serializable_user (Serializable) – Serializable object that serializes to a valid payload to update user.

Returns

An object with the properties of the updated user.

enimc.organizations

This module provides classes that allow an application and service to talk to Envase Identity Manager Organizations service.

class OrganizationsClient(environment, authorizer, base_url=None, _test_session=None)

This class provides the client interface to communicate with Envase Identity Manager Organizations.

Parameters
  • environment (str) – Environment identifier for the Envase Identity Manager instance to connect.

  • authorizer (Authorizer) – Authorizer class that allows to send authorized calls to Envase Identity Manager.

  • (optional) (str base_url) – Base url for identity manager service. if not passed it will default to get it from en_environment.

create(serializable_organization)

Creates a new Organization.

Parameters

serializable_organization (Serializable) – Serializable object that serializes to a valid payload to create a new Organization.

Returns

An object with the properties of the created Organization.

create_service(organization_id, serializable_service)

Creates a new Organization Service.

Parameters
  • organization_id (str) – The Id of the organization to create a service for.

  • serializable_tms (Serializable) – Serializable object that serializes to a valid payload to create a new Organization Service.

Returns

An object with the properties of the created Organization Service.

create_tms(organization_id, serializable_tms)

Creates a new Organization Tms.

Parameters
  • organization_id (str) – The Id of the organization to create a tms for.

  • serializable_tms (Serializable) – Serializable object that serializes to a valid payload to create a new Organization Tms.

Returns

An object with the properties of the created Organization Tms.

delete(organization_id)

Deletes an Organization from Identity Manager Service.

Parameters

organization_id (str) – Id of the Organization to delete.

Returns

True if the Organization existed and was deleted or False otherwise. Regardless, the Organization will no longer be available.

delete_service(organization_id, service_id)

Deletes an Organization Service from Identity Manager Service.

Parameters
  • organization_id (str) – Id of the Organization that has the service to delete.

  • service_id (str) – Id of the Service to delete.

Returns

True if the Service existed and was deleted or False otherwise. Regardless, the Service will no longer be available.

delete_tms(organization_id, tms_id)

Deletes an Organization Tms from Identity Manager Service.

Parameters
  • organization_id (str) – Id of the Organization that has the tms to delete.

  • tms_id (str) – Id of the Tms to delete.

Returns

True if the Tms existed and was deleted or False otherwise. Regardless, the Tms will no longer be available.

get(organization_id)

Get Organization info.

param str organization_id

Id of the Organization to get.

Returns

An object that wraps the organization data and provides the attributes to access it.

get_tms(organization_id, tms_id)

Gets an Organization Tms from Identity Manager Service.

Parameters
  • organization_id (str) – Id of the Organization that has the tms to retrieve.

  • tms_id (str) – Id of the Tms to get.

Returns

An object with the properties of the existing Organization Tms.

share_tms(owner_organization_id, shared_tms_id, serializable_partner)
Parameters
  • owner_organization_id (str) – Id of the Organization that owns the tms.

  • shared_tms_id (str) – Id of the Tms to share.

  • serializable_partner (Serializable) – Serializable object that serializes to a valid payload containing the organizationId of the partner.

Returns

An object with the properties of the shared tms info.

update(organization_id, serializable_organization)

update Organization info. :param str organization_id:

Id of the organization that will be updated.

Parameters

serializable_organization (Serializable) – Serializable object that serializes to a valid payload to update Organization.

Returns

An object with the properties of the updated Organization.

enimc.tms

This module provides classes that allow an application and service to talk to Envase Identity Manager tms service.

class TmsClient(environment, authorizer, base_url=None, _test_session=None)

This class provides the client interface to communicate with Envase Identity Manager tms.

Parameters
  • environment (str) – Environment identifier for the Envase Identity Manager instance to connect.

  • authorizer (Authorizer) – Authorizer class that allows to send authorized calls to Envase Identity Manager.

  • (optional) (str base_url) – Base url for identity manager service. if not passed it will default to get it from en_environment.

get_all_tms()

Gets all tms from Identity Manager Service.

Returns

A collection of tms objects, each object includes properties of the tms.

get_tms(tms_id)

Gets a tms from Identity Manager Service.

Parameters

tms_id (str) – Id of the tms.

Returns

An object with the properties of the tms.