Example #1
0
    def get_client(self, target, version_cap, serializer=None):
        from trove.instance.models import get_instance_encryption_key

        instance_key = get_instance_encryption_key(self.id)
        return rpc.get_client(target, key=instance_key,
                              version_cap=version_cap,
                              serializer=serializer)
Example #2
0
    def get_client(self, target, version_cap, serializer=None):
        from trove.instance.models import get_instance_encryption_key

        instance_key = get_instance_encryption_key(self.id)
        return rpc.get_client(target, key=instance_key,
                              version_cap=version_cap,
                              serializer=serializer)
    def _serialize_entity(self, ctxt, entity):
        try:
            if ctxt.instance_id is None:
                return entity
        except (ValueError, TypeError):
            return entity

        instance_key = get_instance_encryption_key(ctxt.instance_id)

        estr = jsonutils.dumps(entity)
        return cu.encode_data(cu.encrypt_data(estr, instance_key))
Example #4
0
    def _serialize_context(self, ctxt):
        try:
            if ctxt.instance_id is None:
                return ctxt
        except (ValueError, TypeError):
            return ctxt

        instance_key = get_instance_encryption_key(ctxt.instance_id)

        cstr = jsonutils.dumps(ctxt)
        return {'context': cu.encode_data(cu.encrypt_data(cstr, instance_key))}
Example #5
0
    def _serialize_entity(self, ctxt, entity):
        try:
            if ctxt.instance_id is None:
                return entity
        except (ValueError, TypeError):
            return entity

        instance_key = get_instance_encryption_key(ctxt.instance_id)

        estr = jsonutils.dumps(entity)
        return cu.encode_data(cu.encrypt_data(estr, instance_key))
    def _serialize_context(self, ctxt):
        try:
            if ctxt.instance_id is None:
                return ctxt
        except (ValueError, TypeError):
            return ctxt

        instance_key = get_instance_encryption_key(ctxt.instance_id)

        cstr = jsonutils.dumps(ctxt)
        return {'context': cu.encode_data(cu.encrypt_data(cstr,
                                                          instance_key))}
Example #7
0
    def _deserialize_entity(self, ctxt, entity):
        try:
            entity = jsonutils.loads(entity)
            instance_id = entity['csz-instance-id']
        except (ValueError, TypeError):
            return entity

        instance_key = get_instance_encryption_key(instance_id)

        estr = cu.decrypt_data(cu.decode_data(entity['entity']), instance_key)
        entity = jsonutils.loads(estr)

        return entity
    def _deserialize_entity(self, ctxt, entity):
        try:
            entity = jsonutils.loads(entity)
            instance_id = entity['csz-instance-id']
        except (ValueError, TypeError):
            return entity

        instance_key = get_instance_encryption_key(instance_id)

        estr = cu.decrypt_data(cu.decode_data(entity['entity']),
                               instance_key)
        entity = jsonutils.loads(estr)

        return entity
    def _deserialize_context(self, ctxt):
        try:
            instance_id = ctxt.get('csz-instance-id', None)

            if instance_id is not None:
                instance_key = get_instance_encryption_key(instance_id)

                cstr = cu.decrypt_data(cu.decode_data(ctxt['context']),
                                       instance_key)
                ctxt = jsonutils.loads(cstr)
        except (ValueError, TypeError):
            return ctxt

        ctxt['instance_id'] = instance_id
        return ctxt
Example #10
0
    def _deserialize_context(self, ctxt):
        try:
            instance_id = ctxt.get('csz-instance-id', None)

            if instance_id is not None:
                instance_key = get_instance_encryption_key(instance_id)

                cstr = cu.decrypt_data(cu.decode_data(ctxt['context']),
                                       instance_key)
                ctxt = jsonutils.loads(cstr)
        except (ValueError, TypeError):
            return ctxt

        ctxt['instance_id'] = instance_id
        return ctxt