@staticmethod
    def create_link(key, next_key, next_bucket, position, action, logs,
                    bucket):
        digest_logs = []
        if len(logs) > position:
            digest_logs = logs[position]
        end_date = parse_date(extract_digest_key_date(key))
        # gap actions have no previous link.
        if action == 'gap':
            digest = MockDigestProvider.create_digest(
                key=key, bucket=bucket, fingerprint=str(position),
                start_date=end_date, logs=digest_logs)
        else:
            digest = MockDigestProvider.create_digest(
                key=key, bucket=bucket, fingerprint=str(position),
                start_date=end_date, next_bucket=next_bucket, next_key=next_key,
                logs=digest_logs)
            # Mark the digest as invalid if specified in the action.
            if action == 'invalid':
                digest['_invalid'] = True
        return digest, json.dumps(digest)
Creates a link in a digest chain for testing.
dataset/ETHPy150Open aws/aws-cli/tests/unit/customizations/cloudtrail/test_validation.py/MockDigestProvider.create_link