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

        Args:
            output_buffer (stream): A data stream in which to encode
                CapabilityInformation 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:
            VersionNotSupported: Raised when a KMIP version is provided that
                does not support the CapabilityInformation structure.
        """
        if kmip_version < enums.KMIPVersion.KMIP_1_3:
            raise exceptions.VersionNotSupported(
                "KMIP {} does not support the CapabilityInformation "
                "object.".format(
                    kmip_version.value
                )
            )

        local_buffer = BytearrayStream()

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

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

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

        if kmip_version >= enums.KMIPVersion.KMIP_1_4:
            if self._batch_undo_capability:
                self._batch_undo_capability.write(
                    local_buffer,
                    kmip_version=kmip_version
                )

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

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

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

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

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

        self.length = local_buffer.length()
        super(CapabilityInformation, 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 CapabilityInformation "
                "object.".format(
                    kmip_version.value
                )
            )

        local_buffer = BytearrayStream()

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

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

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

        if kmip_version >= enums.KMIPVersion.KMIP_1_4:
            if self._batch_undo_capability:
                self._batch_undo_capability.write(
                    local_buffer,
                    kmip_version=kmip_version
                )

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

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

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

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

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

        self.length = local_buffer.length()
        super(CapabilityInformation, 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 CapabilityInformation " "object." . format ( kmip_version . value ) ) local_buffer = BytearrayStream ( ) if self . _streaming_capability : self . _streaming_capability . write ( local_buffer , kmip_version = kmip_version ) if self . _asynchronous_capability : self . _asynchronous_capability . write ( local_buffer , kmip_version = kmip_version ) if self . _attestation_capability : self . _attestation_capability . write ( local_buffer , kmip_version = kmip_version ) if kmip_version >= enums . KMIPVersion . KMIP_1_4 : if self . _batch_undo_capability : self . _batch_undo_capability . write ( local_buffer , kmip_version = kmip_version ) if self . _batch_continue_capability : self . _batch_continue_capability . write ( local_buffer , kmip_version = kmip_version ) if self . _unwrap_mode : self . _unwrap_mode . write ( local_buffer , kmip_version = kmip_version ) if self . _destroy_action : self . _destroy_action . write ( local_buffer , kmip_version = kmip_version ) if self . _shredding_algorithm : self . _shredding_algorithm . write ( local_buffer , kmip_version = kmip_version ) if self . _rng_mode : self . _rng_mode . write ( local_buffer , kmip_version = kmip_version ) self . length = local_buffer . length ( ) super ( CapabilityInformation , self ) . write ( output_buffer , kmip_version = kmip_version ) output_buffer . write ( local_buffer . buffer )
Write the CapabilityInformation structure encoding to the data stream.

        Args:
            output_buffer (stream): A data stream in which to encode
                CapabilityInformation 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:
            VersionNotSupported: Raised when a KMIP version is provided that
                does not support the CapabilityInformation structure.
Write the CapabilityInformation structure encoding to the data stream .