Skip to content

Commit 719fee7

Browse files
mgr/smb: add a new entry class for tls credential resources
Add a new entry class for the new tls credential resources. It should work similarly to the join auth resources. Signed-off-by: John Mulligan <[email protected]>
1 parent 2789802 commit 719fee7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/pybind/mgr/smb/internal.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,23 @@ def get_users_and_groups(self) -> resources.UsersAndGroups:
206206
return self.get_resource_type(resources.UsersAndGroups)
207207

208208

209+
class TLSCredentialEntry(CommonResourceEntry):
210+
"""TLSCredentialEntry resource getter/setter for the smb internal data
211+
store(s).
212+
"""
213+
214+
namespace = ConfigNS.TLS_CREDENTIALS
215+
_for_resource = resources.TLSCredential
216+
217+
@classmethod
218+
def to_key(cls, resource: SMBResource) -> ResourceKey:
219+
assert isinstance(resource, cls._for_resource)
220+
return ResourceIDKey(resource.tls_credential_id)
221+
222+
def get_tls_credential(self) -> resources.TLSCredential:
223+
return self.get_resource_type(resources.TLSCredential)
224+
225+
209226
def _map_resource_entry(
210227
resource: Union[SMBResource, Type[SMBResource]]
211228
) -> Type[ResourceEntry]:
@@ -217,6 +234,7 @@ def _map_resource_entry(
217234
resources.RemovedShare: ShareEntry,
218235
resources.JoinAuth: JoinAuthEntry,
219236
resources.UsersAndGroups: UsersAndGroupsEntry,
237+
resources.TLSCredential: TLSCredentialEntry,
220238
}
221239
try:
222240
return _map[rcls]

0 commit comments

Comments
 (0)