gvm/protocols/gmpv7/types.py 1 location
|
@@ 291-304 (lines=14) @@
|
| 288 |
|
USERNAME_SSH_KEY = 'usk' |
| 289 |
|
|
| 290 |
|
|
| 291 |
|
def get_credential_type_from_string( |
| 292 |
|
credential_type: Optional[str] |
| 293 |
|
) -> Optional[CredentialType]: |
| 294 |
|
""" Convert a credential type string into a CredentialType instance |
| 295 |
|
""" |
| 296 |
|
if not credential_type: |
| 297 |
|
return None |
| 298 |
|
|
| 299 |
|
try: |
| 300 |
|
return CredentialType[credential_type.upper()] |
| 301 |
|
except KeyError: |
| 302 |
|
raise InvalidArgument( |
| 303 |
|
argument='credential_type', |
| 304 |
|
function=get_credential_type_from_string.__name__, |
| 305 |
|
) |
| 306 |
|
|
| 307 |
|
|
gvm/protocols/gmpv8/types.py 1 location
|
@@ 241-254 (lines=14) @@
|
| 238 |
|
PASSWORD_ONLY = 'pw' |
| 239 |
|
|
| 240 |
|
|
| 241 |
|
def get_credential_type_from_string( |
| 242 |
|
credential_type: Optional[str] |
| 243 |
|
) -> Optional[CredentialType]: |
| 244 |
|
""" Convert a credential type string into a CredentialType instance |
| 245 |
|
""" |
| 246 |
|
if not credential_type: |
| 247 |
|
return None |
| 248 |
|
|
| 249 |
|
try: |
| 250 |
|
return CredentialType[credential_type.upper()] |
| 251 |
|
except KeyError: |
| 252 |
|
raise InvalidArgument( |
| 253 |
|
argument='credential_type', |
| 254 |
|
function=get_credential_type_from_string.__name__, |
| 255 |
|
) |
| 256 |
|
|
| 257 |
|
|