I have the following model defined. Its derived from a boto3 IAM response:
class UserInfo(BaseModel):
UserName: str
AccessKeyId: str
Status: str
CreateDate: datetime.datetime
class HTTPHeaders(BaseModel):
server: str
date: str
x_amzn_requestid: str = Field(..., alias='x-amzn-requestid')
class ResponseMetadata(BaseModel):
RequestId: str
HTTPStatusCode: int
HTTPHeaders: HTTPHeaders
RetryAttempts: int
class ListAccessKeysModel(BaseModel):
AccessKeyMetadata: List[UserInfo]
IsTruncated: bool
ResponseMetadata: ResponseMetadata
I’ve tried everything, but I cannot, for the life of me, figure out how to update the ‘CreateDate’ field, in the UserInfo model. How would I go about doing that? Really, I’m just trying to modify the date for unit test purposes. Thank you!
I’ve tried the following, but its not working as it just gives back the same data (CreatedDate not changed).
list_access_keys = list_access_keys_model.model_copy(update={'AccessKeyMetaData': [{'CreateDate': create_date}]})
user24962262 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.