aws-cloudformation / aws-cloudformation/cloudformation-cli-python-plugin

Cannot store non primitives in callback context - CFN Test and likely cloudformation

Đang mở
#249 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
107
Fork
46
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

[Java plugin](https://github.com/aws-cloudformation/cloudformation-cli-java-plugin/blob/d68a86267c5f5017337e25993712d089db97b6b6/src/main/java/software/amazon/cloudformation/proxy/StdCallbackContext.java#L191) supports serializing/deserializing class information in callback context , this plugin doesnt support that today.

Use case, related to #243. Say I want to store a datetime.datetime object. Right now it gets returned as a string, so the next time I use it when I am called back, it comes across as a string not as an original datetime object.

I confirmed this on the handler side by printing out a ProgressEvent post serialization.
```
{'message': '', 'callbackContext': {'resource_entry_end_time': datetime.datetime(2023, 1, 19, 16, 25, 19, 5602), 'handler_entry_time': datetime.datetime(2023, 1, 19, 16, 23, 19, 5606), 'working_model': ResourceModel(...), 'create_action1_completed': True, 'create_action1_request_id': '1234'}, 'callbackDelaySeconds': 1, 'resourceModel': {...}, 'status': 'IN_PROGRESS'}
```

Received on the `cfn test` side for contract testing:
```
{'message': '', 'callbackContext': {'resource_entry_end_time': '2023-01-19T16:25:19.005602', 'handler_entry_time': '2023-01-19T16:23:19.005606', 'working_model': {...}, 'create_action1_completed': True, 'create_action1_request_id': '1234'}, 'callbackDelaySeconds': 1, 'resourceModel': {....}, 'status': 'IN_PROGRESS'}

```

So if we attempt to store any non-primitive type its replaced with a string representation and no way to get back to it. This requires handler authors, if they want to use complex types, to do their own marshalling.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.