<s> from kmip . core import attributes <EOL> from kmip . core import misc <EOL> from kmip . core import objects <EOL> from kmip . core . enums import Tags <EOL> from kmip . core . messages . payloads . create_key_pair import CreateKeyPairResponsePayload <EOL> from kmip . core . primitives import Struct <EOL> from kmip . core . utils import BytearrayStream <EOL> class RekeyKeyPairRequestPayload ( Struct ) : <EOL> def __init__ ( self , <EOL> private_key_uuid = None , <EOL> offset = None , <EOL> common_template_attribute = None , <EOL> private_key_template_attribute = None , <EOL> public_key_template_attribute = None ) : <EOL> super ( RekeyKeyPairRequestPayload , self ) . __init__ ( Tags . REQUEST_PAYLOAD ) <EOL> self . private_key_uuid = private_key_uuid <EOL> self . offset = offset <EOL> self . common_template_attribute = common_template_attribute <EOL> self . private_key_template_attribute = private_key_template_attribute <EOL> self . public_key_template_attribute = public_key_template_attribute <EOL> self . validate ( ) <EOL> def read ( self , istream ) : <EOL> super ( RekeyKeyPairRequestPayload , self ) . read ( istream ) <EOL> tstream = BytearrayStream ( istream . read ( self . length ) ) <EOL> if self . is_tag_next ( Tags . PRIVATE_KEY_UNIQUE_IDENTIFIER , tstream ) : <EOL> self . private_key_uuid = attributes . PrivateKeyUniqueIdentifier ( ) <EOL> self . private_key_uuid . read ( tstream ) <EOL> if self . is_tag_next ( Tags . OFFSET , tstream ) : <EOL> self . offset = misc . Offset ( ) <EOL> self . offset . read ( tstream ) <EOL> if self . is_tag_next ( Tags . COMMON_TEMPLATE_ATTRIBUTE , tstream ) : <EOL> self . common_template_attribute = objects . CommonTemplateAttribute ( ) <EOL> self . common_template_attribute . read ( tstream ) <EOL> if self . is_tag_next ( Tags . PRIVATE_KEY_TEMPLATE_ATTRIBUTE , tstream ) : <EOL> self . private_key_template_attribute = objects . PrivateKeyTemplateAttribute ( ) <EOL> self . private_key_template_attribute . read ( tstream ) <EOL> if self . is_tag_next ( Tags . PUBLIC_KEY_TEMPLATE_ATTRIBUTE , tstream ) : <EOL> self . public_key_template_attribute = objects . PublicKeyTemplateAttribute ( ) <EOL> self . public_key_template_attribute . read ( tstream ) <EOL> self . is_oversized ( tstream ) <EOL> self . validate ( ) <EOL> def write ( self , ostream ) : <EOL> tstream = BytearrayStream ( ) <EOL> if self . private_key_uuid is not None : <EOL> self . private_key_uuid . write ( tstream ) <EOL> if self . offset is not None : <EOL> self . offset . write ( tstream ) <EOL> if self . common_template_attribute is not None : <EOL> self . common_template_attribute . write ( tstream ) <EOL> if self . private_key_template_attribute is not None : <EOL> self . private_key_template_attribute . write ( tstream ) <EOL> if self . public_key_template_attribute is not None : <EOL> self . public_key_template_attribute . write ( tstream ) <EOL> self . length = tstream . length ( ) <EOL> super ( RekeyKeyPairRequestPayload , self ) . write ( ostream ) <EOL> ostream . write ( tstream . buffer ) <EOL> def validate ( self ) : <EOL> self . __validate ( ) <EOL> def __validate ( self ) : <EOL> if self . private_key_uuid is not None : <EOL> if not isinstance ( self . private_key_uuid , <EOL> attributes . PrivateKeyUniqueIdentifier ) : <EOL> msg = "<STR_LIT>" <EOL> msg += "<STR_LIT>" . format ( <EOL> attributes . PrivateKeyUniqueIdentifier , <EOL> self . private_key_uuid ) <EOL> raise TypeError ( msg ) <EOL> if self . offset is not None : <EOL> if not isinstance ( self . offset , misc . Offset ) : <EOL> msg = "<STR_LIT>" <EOL> msg += "<STR_LIT>" . format ( <EOL> misc . Offset , self . offset ) <EOL> raise TypeError ( msg ) <EOL> if self . common_template_attribute is not None : <EOL> if not isinstance ( self . common_template_attribute , <EOL> objects . CommonTemplateAttribute ) : <EOL> msg = "<STR_LIT>" <EOL> msg += "<STR_LIT>" . format ( <EOL> objects . CommonTemplateAttribute , <EOL> self . common_template_attribute ) <EOL> raise TypeError ( msg ) <EOL> if self . private_key_template_attribute is not None : <EOL> if not isinstance ( self . private_key_template_attribute , <EOL> objects . PrivateKeyTemplateAttribute ) : <EOL> msg = "<STR_LIT>" <EOL> msg += "<STR_LIT>" . format ( <EOL> objects . PrivateKeyTemplateAttribute , <EOL> self . private_key_template_attribute ) <EOL> raise TypeError ( msg ) <EOL> if self . public_key_template_attribute is not None : <EOL> if not isinstance ( self . public_key_template_attribute , <EOL> objects . PublicKeyTemplateAttribute ) : <EOL> msg = "<STR_LIT>" <EOL> msg += "<STR_LIT>" . format ( <EOL> objects . PublicKeyTemplateAttribute , <EOL> self . public_key_template_attribute ) <EOL> raise TypeError ( msg ) <EOL> class RekeyKeyPairResponsePayload ( CreateKeyPairResponsePayload ) : <EOL> def __init__ ( self , <EOL> private_key_uuid = None , <EOL> public_key_uuid = None , <EOL> private_key_template_attribute = None , <EOL> public_key_template_attribute = None ) : <EOL> super ( RekeyKeyPairResponsePayload , self ) . __init__ ( <EOL> private_key_uuid , public_key_uuid , private_key_template_attribute , <EOL> public_key_template_attribute ) </s>
