kmip/core/objects.py
def read(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_2_0):
        """
        Read the data stream and decode the AttributeReference structure into
        its parts.

        Args:
            input_buffer (stream): A data stream containing encoded object
                data, supporting a read method.
            kmip_version (enum): A KMIPVersion enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 2.0.

        Raises:
            InvalidKmipEncoding: Raised if the vendor identification or
                attribute name is missing from the encoding.
            VersionNotSupported: Raised when a KMIP version is provided that
                does not support the AttributeReference structure.
        """
        if kmip_version < enums.KMIPVersion.KMIP_2_0:
            raise exceptions.VersionNotSupported(
                "KMIP {} does not support the AttributeReference "
                "object.".format(
                    kmip_version.value
                )
            )

        super(AttributeReference, self).read(
            input_buffer,
            kmip_version=kmip_version
        )
        local_buffer = BytearrayStream(input_buffer.read(self.length))

        if self.is_tag_next(enums.Tags.VENDOR_IDENTIFICATION, local_buffer):
            self._vendor_identification = primitives.TextString(
                tag=enums.Tags.VENDOR_IDENTIFICATION
            )
            self._vendor_identification.read(
                local_buffer,
                kmip_version=kmip_version
            )
        else:
            raise exceptions.InvalidKmipEncoding(
                "The AttributeReference encoding is missing the vendor "
                "identification string."
            )

        if self.is_tag_next(enums.Tags.ATTRIBUTE_NAME, local_buffer):
            self._attribute_name = primitives.TextString(
                tag=enums.Tags.ATTRIBUTE_NAME
            )
            self._attribute_name.read(
                local_buffer,
                kmip_version=kmip_version
            )
        else:
            raise exceptions.InvalidKmipEncoding(
                "The AttributeReference encoding is missing the attribute "
                "name string."
            )

        self.is_oversized(local_buffer)
def read(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_2_0):
        if kmip_version < enums.KMIPVersion.KMIP_2_0:
            raise exceptions.VersionNotSupported(
                "KMIP {} does not support the AttributeReference "
                "object.".format(
                    kmip_version.value
                )
            )

        super(AttributeReference, self).read(
            input_buffer,
            kmip_version=kmip_version
        )
        local_buffer = BytearrayStream(input_buffer.read(self.length))

        if self.is_tag_next(enums.Tags.VENDOR_IDENTIFICATION, local_buffer):
            self._vendor_identification = primitives.TextString(
                tag=enums.Tags.VENDOR_IDENTIFICATION
            )
            self._vendor_identification.read(
                local_buffer,
                kmip_version=kmip_version
            )
        else:
            raise exceptions.InvalidKmipEncoding(
                "The AttributeReference encoding is missing the vendor "
                "identification string."
            )

        if self.is_tag_next(enums.Tags.ATTRIBUTE_NAME, local_buffer):
            self._attribute_name = primitives.TextString(
                tag=enums.Tags.ATTRIBUTE_NAME
            )
            self._attribute_name.read(
                local_buffer,
                kmip_version=kmip_version
            )
        else:
            raise exceptions.InvalidKmipEncoding(
                "The AttributeReference encoding is missing the attribute "
                "name string."
            )

        self.is_oversized(local_buffer)
def read ( self , input_buffer , kmip_version = enums . KMIPVersion . KMIP_2_0 ) : if kmip_version < enums . KMIPVersion . KMIP_2_0 : raise exceptions . VersionNotSupported ( "KMIP {} does not support the AttributeReference " "object." . format ( kmip_version . value ) ) super ( AttributeReference , self ) . read ( input_buffer , kmip_version = kmip_version ) local_buffer = BytearrayStream ( input_buffer . read ( self . length ) ) if self . is_tag_next ( enums . Tags . VENDOR_IDENTIFICATION , local_buffer ) : self . _vendor_identification = primitives . TextString ( tag = enums . Tags . VENDOR_IDENTIFICATION ) self . _vendor_identification . read ( local_buffer , kmip_version = kmip_version ) else : raise exceptions . InvalidKmipEncoding ( "The AttributeReference encoding is missing the vendor " "identification string." ) if self . is_tag_next ( enums . Tags . ATTRIBUTE_NAME , local_buffer ) : self . _attribute_name = primitives . TextString ( tag = enums . Tags . ATTRIBUTE_NAME ) self . _attribute_name . read ( local_buffer , kmip_version = kmip_version ) else : raise exceptions . InvalidKmipEncoding ( "The AttributeReference encoding is missing the attribute " "name string." ) self . is_oversized ( local_buffer )
Read the data stream and decode the AttributeReference structure into
        its parts.

        Args:
            input_buffer (stream): A data stream containing encoded object
                data, supporting a read method.
            kmip_version (enum): A KMIPVersion enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 2.0.

        Raises:
            InvalidKmipEncoding: Raised if the vendor identification or
                attribute name is missing from the encoding.
            VersionNotSupported: Raised when a KMIP version is provided that
                does not support the AttributeReference structure.
Read the data stream and decode the AttributeReference structure into its parts .