kmip/core/objects.py
def write(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_1_3):
        """
        Write the ValidationInformation structure encoding to the data stream.

        Args:
            output_buffer (stream): A data stream in which to encode
                ValidationInformation structure data, supporting a write
                method.
            kmip_version (enum): A KMIPVersion enumeration defining the KMIP
                version with which the object will be encoded. Optional,
                defaults to KMIP 2.0.

        Raises:
            InvalidField: Raised if the validation authority type, validation
                version major, validation type, and/or validation level fields
                are not defined.
            VersionNotSupported: Raised when a KMIP version is provided that
                does not support the ValidationInformation structure.
        """
        if kmip_version < enums.KMIPVersion.KMIP_1_3:
            raise exceptions.VersionNotSupported(
                "KMIP {} does not support the ValidationInformation "
                "object.".format(
                    kmip_version.value
                )
            )

        local_buffer = BytearrayStream()

        if self._validation_authority_type:
            self._validation_authority_type.write(
                local_buffer,
                kmip_version=kmip_version
            )
        else:
            raise exceptions.InvalidField(
                "The ValidationInformation structure is missing the "
                "validation authority type field."
            )

        if self._validation_authority_country:
            self._validation_authority_country.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._validation_authority_uri:
            self._validation_authority_uri.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._validation_version_major:
            self._validation_version_major.write(
                local_buffer,
                kmip_version=kmip_version
            )
        else:
            raise exceptions.InvalidField(
                "The ValidationInformation structure is missing the "
                "validation version major field."
            )

        if self._validation_version_minor:
            self._validation_version_minor.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._validation_type:
            self._validation_type.write(
                local_buffer,
                kmip_version=kmip_version
            )
        else:
            raise exceptions.InvalidField(
                "The ValidationInformation structure is missing the "
                "validation type field."
            )

        if self._validation_level:
            self._validation_level.write(
                local_buffer,
                kmip_version=kmip_version
            )
        else:
            raise exceptions.InvalidField(
                "The ValidationInformation structure is missing the "
                "validation level field."
            )

        if self._validation_certificate_identifier:
            self._validation_certificate_identifier.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._validation_certificate_uri:
            self._validation_certificate_uri.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._validation_vendor_uri:
            self._validation_vendor_uri.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._validation_profiles:
            for validation_profile in self._validation_profiles:
                validation_profile.write(
                    local_buffer,
                    kmip_version=kmip_version
                )

        self.length = local_buffer.length()
        super(ValidationInformation, self).write(
            output_buffer,
            kmip_version=kmip_version
        )
        output_buffer.write(local_buffer.buffer)
def write(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_1_3):
        if kmip_version < enums.KMIPVersion.KMIP_1_3:
            raise exceptions.VersionNotSupported(
                "KMIP {} does not support the ValidationInformation "
                "object.".format(
                    kmip_version.value
                )
            )

        local_buffer = BytearrayStream()

        if self._validation_authority_type:
            self._validation_authority_type.write(
                local_buffer,
                kmip_version=kmip_version
            )
        else:
            raise exceptions.InvalidField(
                "The ValidationInformation structure is missing the "
                "validation authority type field."
            )

        if self._validation_authority_country:
            self._validation_authority_country.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._validation_authority_uri:
            self._validation_authority_uri.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._validation_version_major:
            self._validation_version_major.write(
                local_buffer,
                kmip_version=kmip_version
            )
        else:
            raise exceptions.InvalidField(
                "The ValidationInformation structure is missing the "
                "validation version major field."
            )

        if self._validation_version_minor:
            self._validation_version_minor.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._validation_type:
            self._validation_type.write(
                local_buffer,
                kmip_version=kmip_version
            )
        else:
            raise exceptions.InvalidField(
                "The ValidationInformation structure is missing the "
                "validation type field."
            )

        if self._validation_level:
            self._validation_level.write(
                local_buffer,
                kmip_version=kmip_version
            )
        else:
            raise exceptions.InvalidField(
                "The ValidationInformation structure is missing the "
                "validation level field."
            )

        if self._validation_certificate_identifier:
            self._validation_certificate_identifier.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._validation_certificate_uri:
            self._validation_certificate_uri.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._validation_vendor_uri:
            self._validation_vendor_uri.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._validation_profiles:
            for validation_profile in self._validation_profiles:
                validation_profile.write(
                    local_buffer,
                    kmip_version=kmip_version
                )

        self.length = local_buffer.length()
        super(ValidationInformation, self).write(
            output_buffer,
            kmip_version=kmip_version
        )
        output_buffer.write(local_buffer.buffer)
def write ( self , output_buffer , kmip_version = enums . KMIPVersion . KMIP_1_3 ) : if kmip_version < enums . KMIPVersion . KMIP_1_3 : raise exceptions . VersionNotSupported ( "KMIP {} does not support the ValidationInformation " "object." . format ( kmip_version . value ) ) local_buffer = BytearrayStream ( ) if self . _validation_authority_type : self . _validation_authority_type . write ( local_buffer , kmip_version = kmip_version ) else : raise exceptions . InvalidField ( "The ValidationInformation structure is missing the " "validation authority type field." ) if self . _validation_authority_country : self . _validation_authority_country . write ( local_buffer , kmip_version = kmip_version ) if self . _validation_authority_uri : self . _validation_authority_uri . write ( local_buffer , kmip_version = kmip_version ) if self . _validation_version_major : self . _validation_version_major . write ( local_buffer , kmip_version = kmip_version ) else : raise exceptions . InvalidField ( "The ValidationInformation structure is missing the " "validation version major field." ) if self . _validation_version_minor : self . _validation_version_minor . write ( local_buffer , kmip_version = kmip_version ) if self . _validation_type : self . _validation_type . write ( local_buffer , kmip_version = kmip_version ) else : raise exceptions . InvalidField ( "The ValidationInformation structure is missing the " "validation type field." ) if self . _validation_level : self . _validation_level . write ( local_buffer , kmip_version = kmip_version ) else : raise exceptions . InvalidField ( "The ValidationInformation structure is missing the " "validation level field." ) if self . _validation_certificate_identifier : self . _validation_certificate_identifier . write ( local_buffer , kmip_version = kmip_version ) if self . _validation_certificate_uri : self . _validation_certificate_uri . write ( local_buffer , kmip_version = kmip_version ) if self . _validation_vendor_uri : self . _validation_vendor_uri . write ( local_buffer , kmip_version = kmip_version ) if self . _validation_profiles : for validation_profile in self . _validation_profiles : validation_profile . write ( local_buffer , kmip_version = kmip_version ) self . length = local_buffer . length ( ) super ( ValidationInformation , self ) . write ( output_buffer , kmip_version = kmip_version ) output_buffer . write ( local_buffer . buffer )
Write the ValidationInformation structure encoding to the data stream.

        Args:
            output_buffer (stream): A data stream in which to encode
                ValidationInformation structure data, supporting a write
                method.
            kmip_version (enum): A KMIPVersion enumeration defining the KMIP
                version with which the object will be encoded. Optional,
                defaults to KMIP 2.0.

        Raises:
            InvalidField: Raised if the validation authority type, validation
                version major, validation type, and/or validation level fields
                are not defined.
            VersionNotSupported: Raised when a KMIP version is provided that
                does not support the ValidationInformation structure.
Write the ValidationInformation structure encoding to the data stream .