Skip to content

Commit

Permalink
add update identity metadata method
Browse files Browse the repository at this point in the history
  • Loading branch information
myuwono committed Feb 19, 2017
1 parent 88142f4 commit 55bd3a7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/main/python/covata/delta/api/requestsclient.py
Expand Up @@ -131,6 +131,20 @@ def update_secret_metadata(self,

response.raise_for_status()

def update_identity_metadata(self, requestor_id, identity_id, metadata,
version):
response = requests.put(
url="{base_url}{resource}/{identity_id}".format(
base_url=self.DELTA_URL,
resource=self.RESOURCE_IDENTITIES,
identity_id=identity_id),
headers={
"if-match": str(version)
},
json=dict(metadata=metadata),
auth=self.signer(requestor_id))
response.raise_for_status()

def signer(self, identity_id):
"""
Instantiates a new :class:`~covata.delta.api.RequestsCVTSigner` for
Expand Down
21 changes: 20 additions & 1 deletion src/main/python/covata/delta/interfaces.py
Expand Up @@ -127,7 +127,26 @@ def update_secret_metadata(self,
A newly created base secret has a metadata version of 1.
:param str requestor_id: the authenticating identity id
:param str secret_id: the secret id to be retrieved
:param str secret_id: the secret id to be updated
:param metadata: metadata dictionary
:type metadata: dict[str, str]
:param int version: metadata version, required for optimistic locking
"""

@abstractmethod
def update_identity_metadata(self,
requestor_id,
identity_id,
metadata,
version):
"""
Updates the metadata of the given identity given the version number.
The version of an identity's metadata can be obtained by calling
:func:`~.DeltaApiClient.get_identity`.
An identity has an initial metadata version of 1.
:param str requestor_id: the authenticating identity id
:param str identity_id: the identity id to be updated
:param metadata: metadata dictionary
:type metadata: dict[str, str]
:param int version: metadata version, required for optimistic locking
Expand Down

0 comments on commit 55bd3a7

Please sign in to comment.