@@ 752-771 (lines=20) @@ | ||
749 | ROLE = 'role' |
|
750 | ||
751 | ||
752 | def get_permission_subject_type_from_string( |
|
753 | subject_type: Optional[str], |
|
754 | ) -> Optional[PermissionSubjectType]: |
|
755 | """Convert a permission subject type string to an actual |
|
756 | PermissionSubjectType instance |
|
757 | ||
758 | Arguments: |
|
759 | subject_type: Permission subject type string to convert to a |
|
760 | PermissionSubjectType |
|
761 | """ |
|
762 | if not subject_type: |
|
763 | return None |
|
764 | ||
765 | try: |
|
766 | return PermissionSubjectType[subject_type.upper()] |
|
767 | except KeyError: |
|
768 | raise InvalidArgument( |
|
769 | argument='subject_type', |
|
770 | function=get_permission_subject_type_from_string.__name__, |
|
771 | ) from None |
|
772 | ||
773 | ||
774 | class PortRangeType(Enum): |
@@ 520-539 (lines=20) @@ | ||
517 | ROLE = 'role' |
|
518 | ||
519 | ||
520 | def get_permission_subject_type_from_string( |
|
521 | subject_type: Optional[str], |
|
522 | ) -> Optional[PermissionSubjectType]: |
|
523 | """Convert a permission subject type string to an actual |
|
524 | PermissionSubjectType instance |
|
525 | ||
526 | Arguments: |
|
527 | subject_type: Permission subject type string to convert to a |
|
528 | PermissionSubjectType |
|
529 | """ |
|
530 | if not subject_type: |
|
531 | return None |
|
532 | ||
533 | try: |
|
534 | return PermissionSubjectType[subject_type.upper()] |
|
535 | except KeyError: |
|
536 | raise InvalidArgument( |
|
537 | argument='subject_type', |
|
538 | function=get_permission_subject_type_from_string.__name__, |
|
539 | ) from None |
|
540 | ||
541 | ||
542 | class PortRangeType(Enum): |