kmip/core/messages/contents.py
def protocol_version_to_kmip_version(value):
    """
    Convert a ProtocolVersion struct to its KMIPVersion enumeration equivalent.

    Args:
        value (ProtocolVersion): A ProtocolVersion struct to be converted into
            a KMIPVersion enumeration.

    Returns:
        KMIPVersion: The enumeration equivalent of the struct. If the struct
            cannot be converted to a valid enumeration, None is returned.
    """
    if not isinstance(value, ProtocolVersion):
        return None

    if value.major == 1:
        if value.minor == 0:
            return enums.KMIPVersion.KMIP_1_0
        elif value.minor == 1:
            return enums.KMIPVersion.KMIP_1_1
        elif value.minor == 2:
            return enums.KMIPVersion.KMIP_1_2
        elif value.minor == 3:
            return enums.KMIPVersion.KMIP_1_3
        elif value.minor == 4:
            return enums.KMIPVersion.KMIP_1_4
        else:
            return None
    else:
        return None
def protocol_version_to_kmip_version(value):
    if not isinstance(value, ProtocolVersion):
        return None

    if value.major == 1:
        if value.minor == 0:
            return enums.KMIPVersion.KMIP_1_0
        elif value.minor == 1:
            return enums.KMIPVersion.KMIP_1_1
        elif value.minor == 2:
            return enums.KMIPVersion.KMIP_1_2
        elif value.minor == 3:
            return enums.KMIPVersion.KMIP_1_3
        elif value.minor == 4:
            return enums.KMIPVersion.KMIP_1_4
        else:
            return None
    else:
        return None
def protocol_version_to_kmip_version ( value ) : if not isinstance ( value , ProtocolVersion ) : return None if value . major == 1 : if value . minor == 0 : return enums . KMIPVersion . KMIP_1_0 elif value . minor == 1 : return enums . KMIPVersion . KMIP_1_1 elif value . minor == 2 : return enums . KMIPVersion . KMIP_1_2 elif value . minor == 3 : return enums . KMIPVersion . KMIP_1_3 elif value . minor == 4 : return enums . KMIPVersion . KMIP_1_4 else : return None else : return None
Convert a ProtocolVersion struct to its KMIPVersion enumeration equivalent.

    Args:
        value (ProtocolVersion): A ProtocolVersion struct to be converted into
            a KMIPVersion enumeration.

    Returns:
        KMIPVersion: The enumeration equivalent of the struct. If the struct
            cannot be converted to a valid enumeration, None is returned.
Convert a ProtocolVersion struct to its KMIPVersion enumeration equivalent .