moto 4.2.3.dev35__py2.py3-none-any.whl → 4.2.3.dev37__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
moto/__init__.py CHANGED
@@ -212,7 +212,7 @@ mock_all = MockAll
212
212
  # logging.getLogger('boto').setLevel(logging.CRITICAL)
213
213
 
214
214
  __title__ = "moto"
215
- __version__ = "4.2.3.dev35"
215
+ __version__ = "4.2.3.dev37"
216
216
 
217
217
 
218
218
  try:
moto/core/models.py CHANGED
@@ -56,8 +56,8 @@ class BaseMockAWS(ContextManager["BaseMockAWS"]):
56
56
  self.backends_for_urls.extend(default_backends)
57
57
 
58
58
  self.FAKE_KEYS = {
59
- "AWS_ACCESS_KEY_ID": "foobar_key",
60
- "AWS_SECRET_ACCESS_KEY": "foobar_secret",
59
+ "AWS_ACCESS_KEY_ID": "FOOBARKEY",
60
+ "AWS_SECRET_ACCESS_KEY": "FOOBARSECRET",
61
61
  }
62
62
  self.ORIG_KEYS: Dict[str, Optional[str]] = {}
63
63
  self.default_session_mock = patch("boto3.DEFAULT_SESSION", None)
moto/iam/models.py CHANGED
@@ -84,9 +84,17 @@ def mark_account_as_visited(
84
84
  ) -> None:
85
85
  account = iam_backends[account_id]
86
86
  if access_key in account["global"].access_keys:
87
- account["global"].access_keys[access_key].last_used = AccessKeyLastUsed(
87
+ key = account["global"].access_keys[access_key]
88
+ key.last_used = AccessKeyLastUsed(
88
89
  timestamp=utcnow(), service=service, region=region
89
90
  )
91
+ if key.role_arn:
92
+ try:
93
+ role = account["global"].get_role_by_arn(key.role_arn)
94
+ role.last_used = utcnow()
95
+ except IAMNotFoundException:
96
+ # User assumes a non-existing role
97
+ pass
90
98
  else:
91
99
  # User provided access credentials unknown to us
92
100
  pass
@@ -1082,6 +1090,7 @@ class AccessKey(CloudFormationModel):
1082
1090
  self.status = status
1083
1091
  self.create_date = utcnow()
1084
1092
  self.last_used: Optional[datetime] = None
1093
+ self.role_arn: Optional[str] = None
1085
1094
 
1086
1095
  @property
1087
1096
  def created_iso_8601(self) -> str:
moto/sts/models.py CHANGED
@@ -108,6 +108,7 @@ class STSBackend(BaseBackend):
108
108
  duration,
109
109
  external_id,
110
110
  )
111
+ access_key.role_arn = role_arn
111
112
  account_backend = sts_backends[account_id]["global"]
112
113
  account_backend.assumed_roles.append(role)
113
114
  return role
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: moto
3
- Version: 4.2.3.dev35
3
+ Version: 4.2.3.dev37
4
4
  Home-page: https://github.com/getmoto/moto
5
5
  Author: Steve Pulec
6
6
  Author-email: "spulec@gmail.com"
@@ -1,4 +1,4 @@
1
- moto/__init__.py,sha256=TqiACibe7-OERV6ACpDwEE3NSETY2hu7rUYaEvJzPVc,9689
1
+ moto/__init__.py,sha256=R9OghyMXciMZscRUbeoOtIVgMLzHDXTEXhYKzRocOak,9689
2
2
  moto/backend_index.py,sha256=JDpbrcbt5e30v7D8c5IsxbqIDUXTvm4OuClX6V81cJU,10707
3
3
  moto/backends.py,sha256=rC9WUMUUWmVmX7ZEfXpVKAQAw6oI8qYobCEPxP2Zv9U,1805
4
4
  moto/server.py,sha256=cp8kIe5jVOm7Z2BlNN2AMbTfrRvLBEKSb4mt7O8nu34,2858
@@ -166,7 +166,7 @@ moto/core/common_types.py,sha256=SFKnDUPi8PFhXgUrQNqXEfDY745ENjzb-FLqSV4daD0,155
166
166
  moto/core/custom_responses_mock.py,sha256=-e8kIDZOAOFkKlihgdu3rRxWDJaDgFoJ5J5O_vKp9Bw,6412
167
167
  moto/core/exceptions.py,sha256=jaH9g49vuedHkqLk1P1ivTzV9TMUqfdoWJAyqRAGYYw,5861
168
168
  moto/core/model_instances.py,sha256=q1WR4hsoHssBjOxhNOS3e0j3rc_ZaN_-74ihnwQuEGA,482
169
- moto/core/models.py,sha256=I5_MdN3yoGXJ8hsG-TFkL8DONSJDHSjxkSbTe47Xh3s,16662
169
+ moto/core/models.py,sha256=tBaXhC5UX1BhhWD_JVigjr-BN4UvDzjxdNxdD1cMY00,16660
170
170
  moto/core/responses.py,sha256=0ucNQyNJaWAPbaxTtYYbdj5RHJjOAd2WJG104g9gtC8,42241
171
171
  moto/core/responses_custom_registry.py,sha256=NNMwJAqNvQ8RLeIDQPweZd-ol2rE3kFAq1SRNEAC4-s,2491
172
172
  moto/core/utils.py,sha256=Bz-jdoFetLJnUahqvnKtDOHTOGls-qZdJGO98354l38,15319
@@ -574,7 +574,7 @@ moto/iam/access_control.py,sha256=FSZj8fDyejH56NAPjTPOVqHhi_kZuqs_e7T3M2Iarl4,17
574
574
  moto/iam/aws_managed_policies.py,sha256=evLFbwLABM5R6EawPB53REb5rbQf0IZALECvFEV1UBY,1599363
575
575
  moto/iam/config.py,sha256=1EzR6jyRGxiRgcT5eipreet42aNhfZ36fnjJpVcmVCI,14247
576
576
  moto/iam/exceptions.py,sha256=NwspEsNOzAcqdRcJ8xbhz_HQB7GuLiLq4d2VnkJfW8s,3532
577
- moto/iam/models.py,sha256=Wu5z3uz8C__nJS7dcH6CorrBbiFJyJdPUpWFNuBiWxo,119079
577
+ moto/iam/models.py,sha256=TD4y3s_qkQAl6pEcZPyB6xMggebcXBeaz7Szls-DrhQ,119409
578
578
  moto/iam/policy_validation.py,sha256=2f-ZBGNqHNa6G2OTY6l7L0vF1VFqhUa0ZgRGhMHJb2k,23273
579
579
  moto/iam/responses.py,sha256=mzq5u1xa6C_JAeys3TNC_3KG0Yfl0MYhkwQUoHqG160,107330
580
580
  moto/iam/urls.py,sha256=MrlUR650mLyoZ0i0T77OjMJvyF08in3IvK8305sZ0Z8,134
@@ -970,7 +970,7 @@ moto/stepfunctions/urls.py,sha256=P1xKTZHPm_YYGx6QwJ3IMQRxekQTScDaCq1HVCdYjcE,15
970
970
  moto/stepfunctions/utils.py,sha256=EAxWSdbWCbVpOXkGQW5CdKew93wD7FBY02xXTBIaGZ8,755
971
971
  moto/sts/__init__.py,sha256=UMtQ5v3E3AtGmG3Z5fmmByCXiry41daVgj889RKFyCc,115
972
972
  moto/sts/exceptions.py,sha256=jpr2e4xHLsauuDb1dk9U42V3FqdeSFAc6bAwJhtkVOY,272
973
- moto/sts/models.py,sha256=72fyNSWxBzuL2cVB4XsFOWt-b9ktHByVbI_sqV4tbuE,7152
973
+ moto/sts/models.py,sha256=7mHQTu4gd8xB3OsL2zrO27Eyd6Xcqv-NNutbjq__mVE,7191
974
974
  moto/sts/responses.py,sha256=PM0s7RBfBxL63X6o1WmnffSmNS0JclyHXVwFx3BeGYE,8965
975
975
  moto/sts/urls.py,sha256=7y7AQ02m_T3kay4wgLf3gOgHw2OnqGXgQwjbSQs0EAQ,138
976
976
  moto/sts/utils.py,sha256=TMRc52EZKQHbdbPXiw-NUlUtX9orMErK5GBhoex3Duo,778
@@ -1034,10 +1034,10 @@ moto/xray/mock_client.py,sha256=nYl8JVJbl3OY-tnUafkVOG4K4-cFm5bsft3Hxo7fKwI,3809
1034
1034
  moto/xray/models.py,sha256=0QL6nmhpVVwAiyi9aw4pBwVTRhqPW9oIy2uwPDhPKug,11179
1035
1035
  moto/xray/responses.py,sha256=p2xsg2-P9h_1DCyuBC7GenmC5L64tXAX6a-XCb2j5-o,6316
1036
1036
  moto/xray/urls.py,sha256=R6T3gMwobWipukWcC1DQ36CU1Rjt6oqBDoe-7HqaIZU,393
1037
- moto-4.2.3.dev35.dist-info/AUTHORS.md,sha256=dDUhasV8HGSkzb7zj7a0b3alnqY0P1LPOyOUNoo8Mpo,2976
1038
- moto-4.2.3.dev35.dist-info/LICENSE,sha256=8S75_TlqE-kIeGMLG0-rRxxu2ct6SM8quyUWKBYyIY4,10834
1039
- moto-4.2.3.dev35.dist-info/METADATA,sha256=qn3HwyiET_zvLegs6xQbw7pT4IJ1aRnY7idI-2ssTuY,12102
1040
- moto-4.2.3.dev35.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
1041
- moto-4.2.3.dev35.dist-info/entry_points.txt,sha256=aPovbZuFXCwt8_m2vcolpH4Qr3rOF3yXeRElP9Zkauo,49
1042
- moto-4.2.3.dev35.dist-info/top_level.txt,sha256=TETRKAPcAAvoZDkSkwQiZtTSr-1gzaEAXVm9FmZKj8s,5
1043
- moto-4.2.3.dev35.dist-info/RECORD,,
1037
+ moto-4.2.3.dev37.dist-info/AUTHORS.md,sha256=dDUhasV8HGSkzb7zj7a0b3alnqY0P1LPOyOUNoo8Mpo,2976
1038
+ moto-4.2.3.dev37.dist-info/LICENSE,sha256=8S75_TlqE-kIeGMLG0-rRxxu2ct6SM8quyUWKBYyIY4,10834
1039
+ moto-4.2.3.dev37.dist-info/METADATA,sha256=R18Li1ewC9il8GFsgTB7vJNA80-RBEY80epc4kUyOrY,12102
1040
+ moto-4.2.3.dev37.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
1041
+ moto-4.2.3.dev37.dist-info/entry_points.txt,sha256=aPovbZuFXCwt8_m2vcolpH4Qr3rOF3yXeRElP9Zkauo,49
1042
+ moto-4.2.3.dev37.dist-info/top_level.txt,sha256=TETRKAPcAAvoZDkSkwQiZtTSr-1gzaEAXVm9FmZKj8s,5
1043
+ moto-4.2.3.dev37.dist-info/RECORD,,