kmip/core/objects.py
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
        """
        Read the data encoding the DeviceCredential struct and decode it into
        its constituent parts.

        Args:
            input_stream (stream): A data stream containing encoded object
                data, supporting a read method; usually a BytearrayStream
                object.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.
        """
        super(DeviceCredential, self).read(
            input_stream,
            kmip_version=kmip_version
        )
        local_stream = BytearrayStream(input_stream.read(self.length))

        if self.is_tag_next(enums.Tags.DEVICE_SERIAL_NUMBER, local_stream):
            self._device_serial_number = primitives.TextString(
                tag=enums.Tags.DEVICE_SERIAL_NUMBER
            )
            self._device_serial_number.read(
                local_stream,
                kmip_version=kmip_version
            )

        if self.is_tag_next(enums.Tags.PASSWORD, local_stream):
            self._password = primitives.TextString(
                tag=enums.Tags.PASSWORD
            )
            self._password.read(local_stream, kmip_version=kmip_version)

        if self.is_tag_next(enums.Tags.DEVICE_IDENTIFIER, local_stream):
            self._device_identifier = primitives.TextString(
                tag=enums.Tags.DEVICE_IDENTIFIER
            )
            self._device_identifier.read(
                local_stream,
                kmip_version=kmip_version
            )

        if self.is_tag_next(enums.Tags.NETWORK_IDENTIFIER, local_stream):
            self._network_identifier = primitives.TextString(
                tag=enums.Tags.NETWORK_IDENTIFIER
            )
            self._network_identifier.read(
                local_stream,
                kmip_version=kmip_version
            )

        if self.is_tag_next(enums.Tags.MACHINE_IDENTIFIER, local_stream):
            self._machine_identifier = primitives.TextString(
                tag=enums.Tags.MACHINE_IDENTIFIER
            )
            self._machine_identifier.read(
                local_stream,
                kmip_version=kmip_version
            )

        if self.is_tag_next(enums.Tags.MEDIA_IDENTIFIER, local_stream):
            self._media_identifier = primitives.TextString(
                tag=enums.Tags.MEDIA_IDENTIFIER
            )
            self._media_identifier.read(
                local_stream,
                kmip_version=kmip_version
            )

        self.is_oversized(local_stream)
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
        """
        Read the data encoding the DeviceCredential struct and decode it into
        its constituent parts.

        Args:
            input_stream (stream): A data stream containing encoded object
                data, supporting a read method; usually a BytearrayStream
                object.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.
        """
        super(DeviceCredential, self).read(
            input_stream,
            kmip_version=kmip_version
        )
        local_stream = BytearrayStream(input_stream.read(self.length))

        if self.is_tag_next(enums.Tags.DEVICE_SERIAL_NUMBER, local_stream):
            self._device_serial_number = primitives.TextString(
                tag=enums.Tags.DEVICE_SERIAL_NUMBER
            )
            self._device_serial_number.read(
                local_stream,
                kmip_version=kmip_version
            )

        if self.is_tag_next(enums.Tags.PASSWORD, local_stream):
            self._password = primitives.TextString(
                tag=enums.Tags.PASSWORD
            )
            self._password.read(local_stream, kmip_version=kmip_version)

        if self.is_tag_next(enums.Tags.DEVICE_IDENTIFIER, local_stream):
            self._device_identifier = primitives.TextString(
                tag=enums.Tags.DEVICE_IDENTIFIER
            )
            self._device_identifier.read(
                local_stream,
                kmip_version=kmip_version
            )

        if self.is_tag_next(enums.Tags.NETWORK_IDENTIFIER, local_stream):
            self._network_identifier = primitives.TextString(
                tag=enums.Tags.NETWORK_IDENTIFIER
            )
            self._network_identifier.read(
                local_stream,
                kmip_version=kmip_version
            )

        if self.is_tag_next(enums.Tags.MACHINE_IDENTIFIER, local_stream):
            self._machine_identifier = primitives.TextString(
                tag=enums.Tags.MACHINE_IDENTIFIER
            )
            self._machine_identifier.read(
                local_stream,
                kmip_version=kmip_version
            )

        if self.is_tag_next(enums.Tags.MEDIA_IDENTIFIER, local_stream):
            self._media_identifier = primitives.TextString(
                tag=enums.Tags.MEDIA_IDENTIFIER
            )
            self._media_identifier.read(
                local_stream,
                kmip_version=kmip_version
            )

        self.is_oversized(local_stream)
Read the data encoding the DeviceCredential struct and decode it into
        its constituent parts.

        Args:
            input_stream (stream): A data stream containing encoded object
                data, supporting a read method; usually a BytearrayStream
                object.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.