@@ -1673,7 +1673,6 @@ def __len__(self):
16731673
16741674class StoragePassword (Entity ):
16751675 """This class contains a storage password.
1676-
16771676 """
16781677 def __init__ (self , service , path , ** kwargs ):
16791678 state = kwargs .get ('state' , None )
@@ -1701,7 +1700,6 @@ def username(self):
17011700class StoragePasswords (Collection ):
17021701 """This class provides access to the storage passwords from this Splunk
17031702 instance. Retrieve this collection using :meth:`Service.storage_passwords`.
1704-
17051703 """
17061704 def __init__ (self , service ):
17071705 if service .namespace .owner == '-' or service .namespace .app == '-' :
@@ -1711,13 +1709,12 @@ def __init__(self, service):
17111709 def create (self , password , username , realm = None ):
17121710 """ Creates a storage password.
17131711
1714- The identifier can be passed in through the username parameter as
1715- <username> or <realm>:<username>, but the preferred way is by
1716- passing in the username and realm parameters.
1712+ A `StoragePassword` can be identified by <username>, or by <realm>:<username> if the
1713+ optional realm parameter is also provided.
17171714
17181715 :param password: The password for the credentials - this is the only part of the credentials that will be stored securely.
17191716 :type name: ``string``
1720- :param username: The username for the credentials, or <realm>:<username> if the realm parameter is omitted .
1717+ :param username: The username for the credentials.
17211718 :type name: ``string``
17221719 :param realm: The credential realm. (optional)
17231720 :type name: ``string``
@@ -1727,7 +1724,10 @@ def create(self, password, username, realm=None):
17271724 if not isinstance (username , basestring ):
17281725 raise ValueError ("Invalid name: %s" % repr (username ))
17291726
1730- response = self .post (password = password , realm = realm , name = username )
1727+ if realm is None :
1728+ response = self .post (password = password , name = username )
1729+ else :
1730+ response = self .post (password = password , realm = realm , name = username )
17311731
17321732 if response .status != 201 :
17331733 raise ValueError ("Unexpected status code %s returned from creating a stanza" % response .status )
@@ -1737,8 +1737,9 @@ def create(self, password, username, realm=None):
17371737 storage_password = StoragePassword (self .service , self ._entity_path (state ), state = state , skip_refresh = True )
17381738
17391739 return storage_password
1740-
1741- """Delete a storage password by username and/or realm.
1740+
1741+ def delete (self , username , realm = None ):
1742+ """Delete a storage password by username and/or realm.
17421743
17431744 The identifier can be passed in through the username parameter as
17441745 <username> or <realm>:<username>, but the preferred way is by
@@ -1748,9 +1749,9 @@ def create(self, password, username, realm=None):
17481749 :type name: ``string``
17491750 :param realm: The credential realm. (optional)
17501751 :type name: ``string``
1751-
1752- """
1753- def delete ( self , username , realm = None ):
1752+ :return: The `StoragePassword` collection.
1753+ :rtype: ``self``
1754+ """
17541755 if realm is None :
17551756 # This case makes the username optional, so
17561757 # the full name can be passed in as realm.
0 commit comments