Esempio n. 1
0
 def amend_relationship(self, relationship):
     self.logger.info('Amend Asset Manager Relationship: %s and %s', relationship.asset_manager_id,
                      relationship.related_id)
     url = '%s/asset-manager-relationships/%s' % (self.endpoint, relationship.asset_manager_id)
     response = self.session.put(url, json=relationship.to_interface())
     if response.ok:
         self.logger.info('Successfully Amended Asset Manager Relationship: %s', relationship.asset_manager_id)
         return json_to_relationship(response.json())
     else:
         self.logger.error(response.text)
         response.raise_for_status()
Esempio n. 2
0
 def retrieve_user_relationships(self, user_asset_manager_id, relationship_types=None, include_inactive=False):
     self.logger.info('Retrieve User Relationships: %s', user_asset_manager_id)
     url = '%s/asset-manager-related-amid/%s' % (self.endpoint, user_asset_manager_id)
     params = {'include_inactive': include_inactive}
     if relationship_types:
         params['relationship_type'] = ','.join(relationship_types)
     response = self.session.get(url, params=params)
     if response.ok:
         self.logger.info('Successfully Retrieved User Relationships: %s', user_asset_manager_id)
         return [json_to_relationship(json_relationship) for json_relationship in response.json()]
     else:
         self.logger.error(response.text)
         response.raise_for_status()
Esempio n. 3
0
 def retrieve_relationships(self, asset_manager_id, related_id=None, include_inactive=False):
     self.logger.info('Retrieve Asset Manager Relationship: %s', asset_manager_id)
     url = '%s/asset-manager-relationships/%s' % (self.endpoint, asset_manager_id)
     params = {'include_inactive': include_inactive}
     if related_id:
         params['related_id'] = related_id
     response = self.session.get(url, params=params)
     if response.ok:
         self.logger.info('Successfully Retrieved Asset Manager Relationship: %s', asset_manager_id)
         return [json_to_relationship(json_relationship) for json_relationship in response.json()]
     else:
         self.logger.error(response.text)
         response.raise_for_status()