Repository URL to install this package:
|
Version:
3.3.32 ▾
|
python-workloadmgrclient
/
usr
/
lib
/
python2.7
/
dist-packages
/
workloadmgrclient
/
v1
/
trusts.py
|
|---|
# Copyright (c) 2013 TrilioData, Inc.
"""
Trusts Interface (1.1 extension).
"""
from workloadmgrclient import base
class Trust(base.Resource):
"""A trust describes the trust between the user and triliovault service account """
def __repr__(self):
return "<Trust: %s>" % self.trust_id
def delete(self):
"""Delete this trust."""
return self.manager.delete(self)
class TrustsManager(base.ManagerWithFind):
"""Manage :class:`Trust` resources."""
resource_class = Trust
def create(self, role_name, is_cloud_trust=False):
"""Create a trust. """
body = {'trusts': {'role_name': role_name, 'is_cloud_trust': is_cloud_trust}}
return self._create('/trusts', body, 'trust', return_raw = True)
def get(self, trust_id):
"""Show details of a trust.
"""
resp, body = self.api.client.get("/trusts/%s" % trust_id)
return body['trust']
def list(self, get_hidden = False):
"""Get a list of all trusts.
:rtype: list of :class:`Setting`
"""
resp, body = self.api.client.get("/trusts")
return body['trust']
def delete(self, trust_id):
"""Delete a trust.
"""
self._delete("/trusts/%s" % base.getid(trust_id))