kmip/core/messages/payloads/query.py
def read(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0):
        """
        Read the data encoding the QueryResponsePayload object and decode it
        into its constituent parts.

        Args:
            input_buffer (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(QueryResponsePayload, self).read(
            input_buffer,
            kmip_version=kmip_version
        )
        local_buffer = utils.BytearrayStream(input_buffer.read(self.length))

        operations = []
        while(self.is_tag_next(enums.Tags.OPERATION, local_buffer)):
            operation = primitives.Enumeration(
                enums.Operation,
                tag=enums.Tags.OPERATION
            )
            operation.read(local_buffer, kmip_version=kmip_version)
            operations.append(operation)
        self._operations = operations

        object_types = []
        while(self.is_tag_next(enums.Tags.OBJECT_TYPE, local_buffer)):
            object_type = primitives.Enumeration(
                enums.ObjectType,
                tag=enums.Tags.OBJECT_TYPE
            )
            object_type.read(local_buffer, kmip_version=kmip_version)
            object_types.append(object_type)
        self._object_types = object_types

        if self.is_tag_next(enums.Tags.VENDOR_IDENTIFICATION, local_buffer):
            vendor_identification = primitives.TextString(
                tag=enums.Tags.VENDOR_IDENTIFICATION
            )
            vendor_identification.read(
                local_buffer,
                kmip_version=kmip_version
            )
            self._vendor_identification = vendor_identification

        if self.is_tag_next(enums.Tags.SERVER_INFORMATION, local_buffer):
            server_information = misc.ServerInformation()
            server_information.read(
                local_buffer,
                kmip_version=kmip_version
            )
            self._server_information = server_information

        application_namespaces = []
        while(self.is_tag_next(
                enums.Tags.APPLICATION_NAMESPACE,
                local_buffer
            )
        ):
            application_namespace = primitives.TextString(
                tag=enums.Tags.APPLICATION_NAMESPACE
            )
            application_namespace.read(local_buffer, kmip_version=kmip_version)
            application_namespaces.append(application_namespace)
        self._application_namespaces = application_namespaces

        if kmip_version >= enums.KMIPVersion.KMIP_1_1:
            extensions_information = []
            while(self.is_tag_next(
                    enums.Tags.EXTENSION_INFORMATION,
                    local_buffer
                )
            ):
                extension_information = objects.ExtensionInformation()
                extension_information.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                extensions_information.append(extension_information)
            self._extension_information = extensions_information

        if kmip_version >= enums.KMIPVersion.KMIP_1_2:
            attestation_types = []
            while(self.is_tag_next(enums.Tags.ATTESTATION_TYPE, local_buffer)):
                attestation_type = primitives.Enumeration(
                    enums.AttestationType,
                    tag=enums.Tags.ATTESTATION_TYPE
                )
                attestation_type.read(local_buffer, kmip_version=kmip_version)
                attestation_types.append(attestation_type)
            self._attestation_types = attestation_types

        if kmip_version >= enums.KMIPVersion.KMIP_1_3:
            rngs_parameters = []
            while(self.is_tag_next(enums.Tags.RNG_PARAMETERS, local_buffer)):
                rng_parameters = objects.RNGParameters()
                rng_parameters.read(local_buffer, kmip_version=kmip_version)
                rngs_parameters.append(rng_parameters)
            self._rng_parameters = rngs_parameters

            profiles_information = []
            while(self.is_tag_next(
                    enums.Tags.PROFILE_INFORMATION,
                    local_buffer
                )
            ):
                profile_information = objects.ProfileInformation()
                profile_information.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                profiles_information.append(profile_information)
            self._profile_information = profiles_information

            validations_information = []
            while(self.is_tag_next(
                    enums.Tags.VALIDATION_INFORMATION,
                    local_buffer
                )
            ):
                validation_information = objects.ValidationInformation()
                validation_information.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                validations_information.append(validation_information)
            self._validation_information = validations_information

            capabilities_information = []
            while(self.is_tag_next(
                    enums.Tags.CAPABILITY_INFORMATION,
                    local_buffer
                )
            ):
                capability_information = objects.CapabilityInformation()
                capability_information.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                capabilities_information.append(capability_information)
            self._capability_information = capabilities_information

            client_registration_methods = []
            while(self.is_tag_next(
                    enums.Tags.CLIENT_REGISTRATION_METHOD,
                    local_buffer
                )
            ):
                client_registration_method = primitives.Enumeration(
                    enums.ClientRegistrationMethod,
                    tag=enums.Tags.CLIENT_REGISTRATION_METHOD
                )
                client_registration_method.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                client_registration_methods.append(client_registration_method)
            self._client_registration_methods = client_registration_methods

        if kmip_version >= enums.KMIPVersion.KMIP_2_0:
            if self.is_tag_next(enums.Tags.DEFAULTS_INFORMATION, local_buffer):
                defaults_information = objects.DefaultsInformation()
                defaults_information.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                self._defaults_information = defaults_information

            storage_protection_masks = []
            while(self.is_tag_next(
                    enums.Tags.PROTECTION_STORAGE_MASK,
                    local_buffer
                )
            ):
                storage_protection_mask = primitives.Integer(
                    tag=enums.Tags.PROTECTION_STORAGE_MASK
                )
                storage_protection_mask.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                storage_protection_masks.append(storage_protection_mask)
            self._storage_protection_masks = storage_protection_masks

        self.is_oversized(local_buffer)
def read(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0):
        """
        Read the data encoding the QueryResponsePayload object and decode it
        into its constituent parts.

        Args:
            input_buffer (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(QueryResponsePayload, self).read(
            input_buffer,
            kmip_version=kmip_version
        )
        local_buffer = utils.BytearrayStream(input_buffer.read(self.length))

        operations = []
        while(self.is_tag_next(enums.Tags.OPERATION, local_buffer)):
            operation = primitives.Enumeration(
                enums.Operation,
                tag=enums.Tags.OPERATION
            )
            operation.read(local_buffer, kmip_version=kmip_version)
            operations.append(operation)
        self._operations = operations

        object_types = []
        while(self.is_tag_next(enums.Tags.OBJECT_TYPE, local_buffer)):
            object_type = primitives.Enumeration(
                enums.ObjectType,
                tag=enums.Tags.OBJECT_TYPE
            )
            object_type.read(local_buffer, kmip_version=kmip_version)
            object_types.append(object_type)
        self._object_types = object_types

        if self.is_tag_next(enums.Tags.VENDOR_IDENTIFICATION, local_buffer):
            vendor_identification = primitives.TextString(
                tag=enums.Tags.VENDOR_IDENTIFICATION
            )
            vendor_identification.read(
                local_buffer,
                kmip_version=kmip_version
            )
            self._vendor_identification = vendor_identification

        if self.is_tag_next(enums.Tags.SERVER_INFORMATION, local_buffer):
            server_information = misc.ServerInformation()
            server_information.read(
                local_buffer,
                kmip_version=kmip_version
            )
            self._server_information = server_information

        application_namespaces = []
        while(self.is_tag_next(
                enums.Tags.APPLICATION_NAMESPACE,
                local_buffer
            )
        ):
            application_namespace = primitives.TextString(
                tag=enums.Tags.APPLICATION_NAMESPACE
            )
            application_namespace.read(local_buffer, kmip_version=kmip_version)
            application_namespaces.append(application_namespace)
        self._application_namespaces = application_namespaces

        if kmip_version >= enums.KMIPVersion.KMIP_1_1:
            extensions_information = []
            while(self.is_tag_next(
                    enums.Tags.EXTENSION_INFORMATION,
                    local_buffer
                )
            ):
                extension_information = objects.ExtensionInformation()
                extension_information.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                extensions_information.append(extension_information)
            self._extension_information = extensions_information

        if kmip_version >= enums.KMIPVersion.KMIP_1_2:
            attestation_types = []
            while(self.is_tag_next(enums.Tags.ATTESTATION_TYPE, local_buffer)):
                attestation_type = primitives.Enumeration(
                    enums.AttestationType,
                    tag=enums.Tags.ATTESTATION_TYPE
                )
                attestation_type.read(local_buffer, kmip_version=kmip_version)
                attestation_types.append(attestation_type)
            self._attestation_types = attestation_types

        if kmip_version >= enums.KMIPVersion.KMIP_1_3:
            rngs_parameters = []
            while(self.is_tag_next(enums.Tags.RNG_PARAMETERS, local_buffer)):
                rng_parameters = objects.RNGParameters()
                rng_parameters.read(local_buffer, kmip_version=kmip_version)
                rngs_parameters.append(rng_parameters)
            self._rng_parameters = rngs_parameters

            profiles_information = []
            while(self.is_tag_next(
                    enums.Tags.PROFILE_INFORMATION,
                    local_buffer
                )
            ):
                profile_information = objects.ProfileInformation()
                profile_information.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                profiles_information.append(profile_information)
            self._profile_information = profiles_information

            validations_information = []
            while(self.is_tag_next(
                    enums.Tags.VALIDATION_INFORMATION,
                    local_buffer
                )
            ):
                validation_information = objects.ValidationInformation()
                validation_information.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                validations_information.append(validation_information)
            self._validation_information = validations_information

            capabilities_information = []
            while(self.is_tag_next(
                    enums.Tags.CAPABILITY_INFORMATION,
                    local_buffer
                )
            ):
                capability_information = objects.CapabilityInformation()
                capability_information.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                capabilities_information.append(capability_information)
            self._capability_information = capabilities_information

            client_registration_methods = []
            while(self.is_tag_next(
                    enums.Tags.CLIENT_REGISTRATION_METHOD,
                    local_buffer
                )
            ):
                client_registration_method = primitives.Enumeration(
                    enums.ClientRegistrationMethod,
                    tag=enums.Tags.CLIENT_REGISTRATION_METHOD
                )
                client_registration_method.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                client_registration_methods.append(client_registration_method)
            self._client_registration_methods = client_registration_methods

        if kmip_version >= enums.KMIPVersion.KMIP_2_0:
            if self.is_tag_next(enums.Tags.DEFAULTS_INFORMATION, local_buffer):
                defaults_information = objects.DefaultsInformation()
                defaults_information.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                self._defaults_information = defaults_information

            storage_protection_masks = []
            while(self.is_tag_next(
                    enums.Tags.PROTECTION_STORAGE_MASK,
                    local_buffer
                )
            ):
                storage_protection_mask = primitives.Integer(
                    tag=enums.Tags.PROTECTION_STORAGE_MASK
                )
                storage_protection_mask.read(
                    local_buffer,
                    kmip_version=kmip_version
                )
                storage_protection_masks.append(storage_protection_mask)
            self._storage_protection_masks = storage_protection_masks

        self.is_oversized(local_buffer)
def read ( self , input_buffer , kmip_version = enums . KMIPVersion . KMIP_1_0 ) : super ( QueryResponsePayload , self ) . read ( input_buffer , kmip_version = kmip_version ) local_buffer = utils . BytearrayStream ( input_buffer . read ( self . length ) ) operations = [ ] while ( self . is_tag_next ( enums . Tags . OPERATION , local_buffer ) ) : operation = primitives . Enumeration ( enums . Operation , tag = enums . Tags . OPERATION ) operation . read ( local_buffer , kmip_version = kmip_version ) operations . append ( operation ) self . _operations = operations object_types = [ ] while ( self . is_tag_next ( enums . Tags . OBJECT_TYPE , local_buffer ) ) : object_type = primitives . Enumeration ( enums . ObjectType , tag = enums . Tags . OBJECT_TYPE ) object_type . read ( local_buffer , kmip_version = kmip_version ) object_types . append ( object_type ) self . _object_types = object_types if self . is_tag_next ( enums . Tags . VENDOR_IDENTIFICATION , local_buffer ) : vendor_identification = primitives . TextString ( tag = enums . Tags . VENDOR_IDENTIFICATION ) vendor_identification . read ( local_buffer , kmip_version = kmip_version ) self . _vendor_identification = vendor_identification if self . is_tag_next ( enums . Tags . SERVER_INFORMATION , local_buffer ) : server_information = misc . ServerInformation ( ) server_information . read ( local_buffer , kmip_version = kmip_version ) self . _server_information = server_information application_namespaces = [ ] while ( self . is_tag_next ( enums . Tags . APPLICATION_NAMESPACE , local_buffer ) ) : application_namespace = primitives . TextString ( tag = enums . Tags . APPLICATION_NAMESPACE ) application_namespace . read ( local_buffer , kmip_version = kmip_version ) application_namespaces . append ( application_namespace ) self . _application_namespaces = application_namespaces if kmip_version >= enums . KMIPVersion . KMIP_1_1 : extensions_information = [ ] while ( self . is_tag_next ( enums . Tags . EXTENSION_INFORMATION , local_buffer ) ) : extension_information = objects . ExtensionInformation ( ) extension_information . read ( local_buffer , kmip_version = kmip_version ) extensions_information . append ( extension_information ) self . _extension_information = extensions_information if kmip_version >= enums . KMIPVersion . KMIP_1_2 : attestation_types = [ ] while ( self . is_tag_next ( enums . Tags . ATTESTATION_TYPE , local_buffer ) ) : attestation_type = primitives . Enumeration ( enums . AttestationType , tag = enums . Tags . ATTESTATION_TYPE ) attestation_type . read ( local_buffer , kmip_version = kmip_version ) attestation_types . append ( attestation_type ) self . _attestation_types = attestation_types if kmip_version >= enums . KMIPVersion . KMIP_1_3 : rngs_parameters = [ ] while ( self . is_tag_next ( enums . Tags . RNG_PARAMETERS , local_buffer ) ) : rng_parameters = objects . RNGParameters ( ) rng_parameters . read ( local_buffer , kmip_version = kmip_version ) rngs_parameters . append ( rng_parameters ) self . _rng_parameters = rngs_parameters profiles_information = [ ] while ( self . is_tag_next ( enums . Tags . PROFILE_INFORMATION , local_buffer ) ) : profile_information = objects . ProfileInformation ( ) profile_information . read ( local_buffer , kmip_version = kmip_version ) profiles_information . append ( profile_information ) self . _profile_information = profiles_information validations_information = [ ] while ( self . is_tag_next ( enums . Tags . VALIDATION_INFORMATION , local_buffer ) ) : validation_information = objects . ValidationInformation ( ) validation_information . read ( local_buffer , kmip_version = kmip_version ) validations_information . append ( validation_information ) self . _validation_information = validations_information capabilities_information = [ ] while ( self . is_tag_next ( enums . Tags . CAPABILITY_INFORMATION , local_buffer ) ) : capability_information = objects . CapabilityInformation ( ) capability_information . read ( local_buffer , kmip_version = kmip_version ) capabilities_information . append ( capability_information ) self . _capability_information = capabilities_information client_registration_methods = [ ] while ( self . is_tag_next ( enums . Tags . CLIENT_REGISTRATION_METHOD , local_buffer ) ) : client_registration_method = primitives . Enumeration ( enums . ClientRegistrationMethod , tag = enums . Tags . CLIENT_REGISTRATION_METHOD ) client_registration_method . read ( local_buffer , kmip_version = kmip_version ) client_registration_methods . append ( client_registration_method ) self . _client_registration_methods = client_registration_methods if kmip_version >= enums . KMIPVersion . KMIP_2_0 : if self . is_tag_next ( enums . Tags . DEFAULTS_INFORMATION , local_buffer ) : defaults_information = objects . DefaultsInformation ( ) defaults_information . read ( local_buffer , kmip_version = kmip_version ) self . _defaults_information = defaults_information storage_protection_masks = [ ] while ( self . is_tag_next ( enums . Tags . PROTECTION_STORAGE_MASK , local_buffer ) ) : storage_protection_mask = primitives . Integer ( tag = enums . Tags . PROTECTION_STORAGE_MASK ) storage_protection_mask . read ( local_buffer , kmip_version = kmip_version ) storage_protection_masks . append ( storage_protection_mask ) self . _storage_protection_masks = storage_protection_masks self . is_oversized ( local_buffer )
Read the data encoding the QueryResponsePayload object and decode it
        into its constituent parts.

        Args:
            input_buffer (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.
Read the data encoding the QueryResponsePayload object and decode it into its constituent parts .