|
Self | decrypted (self, Optional[RSAPrivateKey] key=None) |
|
bool | refresh (self, Optional[Dict[str, Any]] jsonObject=None) |
|
bool | update (self, **Any kwargs) |
|
Self | fetchById (cls, int objectId, **Any kwargs) |
|
Self | fetchByName (cls, str name) |
|
Self | fetchNodeSecret (cls, str name, str accessToken) |
|
Represents base Secret entity from Coretex.ai
Definition at line 32 of file secret.py.
◆ decrypted()
Self coretex.entities.secret.secret.Secret.decrypted |
( |
|
self, |
|
|
Optional[RSAPrivateKey] |
key = None |
|
) |
| |
Returns
-------
Self -> Decrypted Coretex Secret
Definition at line 54 of file secret.py.
54 def decrypted(self, key: Optional[RSAPrivateKey] =
None) -> Self:
58 Self -> Decrypted Coretex Secret
62 key = rsa.getPrivateKey()
64 decrypted = copy.deepcopy(self)
66 for field
in self._encryptedFields():
67 if not field
in decrypted.__dict__:
68 raise AttributeError(f
"\"{type(decrypted)}\".\"{field}\" not found")
70 value = decrypted.__dict__[field]
71 if not isinstance(value, str):
72 raise TypeError(f
"Expected \"str\" received \"{type(value)}\"")
74 decrypted.__dict__[field] = rsa.decrypt(key, b64decode(value)).decode(
"utf-8")
◆ fetchById()
Self coretex.entities.secret.secret.Secret.fetchById |
( |
|
cls, |
|
|
int |
objectId, |
|
|
**Any |
kwargs |
|
) |
| |
Secret does not support this method
Definition at line 97 of file secret.py.
97 def fetchById(cls, objectId: int, **kwargs: Any) -> Self:
99 Secret does not support this method
102 return NotImplemented
◆ fetchByName()
Self coretex.entities.secret.secret.Secret.fetchByName |
( |
|
cls, |
|
|
str |
name |
|
) |
| |
Fetches a single Secret with the matching name
Parameters
----------
name : str
name of the Secret which is fetched
Returns
-------
Self -> fetched Secret
Raises
------
NetworkRequestError -> If the request for fetching failed
Definition at line 105 of file secret.py.
105 def fetchByName(cls, name: str) -> Self:
107 Fetches a single Secret with the matching name
112 name of the Secret which is fetched
116 Self -> fetched Secret
120 NetworkRequestError -> If the request for fetching failed
123 response = networkManager.get(f
"{cls._endpoint()}/data", {
127 if response.hasFailed():
128 raise NetworkRequestError(response, f
"Failed to fetch Secret \"{name}\"")
130 return cls.decode(response.getJson(dict))
◆ fetchNodeSecret()
Self coretex.entities.secret.secret.Secret.fetchNodeSecret |
( |
|
cls, |
|
|
str |
name, |
|
|
str |
accessToken |
|
) |
| |
Fetches a single Node Secret with the matching name
Parameters
----------
name : str
name of the Node Secret which is fetched
accessToken : str
Node access token
Returns
-------
Self -> fetched Node Secret
Raises
------
NetworkRequestError -> If the request for fetching failed
Definition at line 133 of file secret.py.
133 def fetchNodeSecret(cls, name: str, accessToken: str) -> Self:
135 Fetches a single Node Secret with the matching name
140 name of the Node Secret which is fetched
146 Self -> fetched Node Secret
150 NetworkRequestError -> If the request for fetching failed
153 headers = networkManager._headers()
154 headers[
"node-access-token"] = accessToken
156 response = networkManager.request(
"secret/node", RequestType.get, headers, {
160 if response.hasFailed():
161 raise NetworkRequestError(response, f
"Failed to fetch Node Secret \"{name}\"")
163 return cls.decode(response.getJson(dict))
◆ refresh()
bool coretex.entities.secret.secret.Secret.refresh |
( |
|
self, |
|
|
Optional[Dict[str, Any]] |
jsonObject = None |
|
) |
| |
Secret does not support this method
Definition at line 82 of file secret.py.
82 def refresh(self, jsonObject: Optional[Dict[str, Any]] =
None) -> bool:
84 Secret does not support this method
◆ update()
bool coretex.entities.secret.secret.Secret.update |
( |
|
self, |
|
|
**Any |
kwargs |
|
) |
| |
Secret does not support this method
Definition at line 89 of file secret.py.
89 def update(self, **kwargs: Any) -> bool:
91 Secret does not support this method
The documentation for this class was generated from the following file: