def _from_payload()

in awsiot/greengrasscoreipc/model.py [0:0]


    def _from_payload(cls, payload):
        new = cls()
        if 'topicName' in payload:
            new.topic_name = payload['topicName']
        if 'qos' in payload:
            new.qos = payload['qos']
        if 'payload' in payload:
            new.payload = base64.b64decode(payload['payload'])
        if 'retain' in payload:
            new.retain = payload['retain']
        if 'userProperties' in payload:
            new.user_properties = [UserProperty._from_payload(i) for i in payload['userProperties']]
        if 'messageExpiryIntervalSeconds' in payload:
            new.message_expiry_interval_seconds = int(payload['messageExpiryIntervalSeconds'])
        if 'correlationData' in payload:
            new.correlation_data = base64.b64decode(payload['correlationData'])
        if 'responseTopic' in payload:
            new.response_topic = payload['responseTopic']
        if 'payloadFormat' in payload:
            new.payload_format = payload['payloadFormat']
        if 'contentType' in payload:
            new.content_type = payload['contentType']
        return new