def tag_instance_profile(self): profile_name = self._get_param('InstanceProfileName') tags = self._get_multi_param('Tags.member') tags = {tag['Key']: tag['Value'] for tag in tags or []} profile = moto_iam_backend.get_instance_profile(profile_name) profile.tags.update(tags) return ''
def tag_instance_profile(self): profile_name = self._get_param("InstanceProfileName") tags = self._get_multi_param("Tags.member") tags = {tag["Key"]: tag["Value"] for tag in tags or []} profile = moto_iam_backend.get_instance_profile(profile_name) profile.tags.update(tags) return ""
def untag_instance_profile(self): profile_name = self._get_param("InstanceProfileName") tag_keys = self._get_multi_param("TagKeys.member") profile = moto_iam_backend.get_instance_profile(profile_name) profile.tags = { k: v for k, v in profile.tags.items() if k not in tag_keys } return ""
def untag_instance_profile( self, context: RequestContext, instance_profile_name: instanceProfileNameType, tag_keys: tagKeyListType, ) -> None: profile = moto_iam_backend.get_instance_profile(instance_profile_name) for tag in tag_keys: profile.tags.pop(tag, None)
def tag_instance_profile( self, context: RequestContext, instance_profile_name: instanceProfileNameType, tags: tagListType, ) -> None: profile = moto_iam_backend.get_instance_profile(instance_profile_name) value_by_key = {tag["Key"]: tag["Value"] for tag in tags} profile.tags.update(value_by_key)
def list_instance_profile_tags(self): profile_name = self._get_param("InstanceProfileName") profile = moto_iam_backend.get_instance_profile(profile_name) result = { "ListInstanceProfileTagsResponse": { "@xmlns": XMLNS_IAM, "ListInstanceProfileTagsResult": {"Tags": profile.tags}, } } return xmltodict.unparse(result)
def list_instance_profile_tags(self): profile_name = self._get_param('InstanceProfileName') profile = moto_iam_backend.get_instance_profile(profile_name) result = { 'ListInstanceProfileTagsResponse': { '@xmlns': XMLNS_IAM, 'ListInstanceProfileTagsResult': {'Tags': profile.tags} } } return xmltodict.unparse(result)
def list_instance_profile_tags( self, context: RequestContext, instance_profile_name: instanceProfileNameType, marker: markerType = None, max_items: maxItemsType = None, ) -> ListInstanceProfileTagsResponse: profile = moto_iam_backend.get_instance_profile(instance_profile_name) response = ListInstanceProfileTagsResponse() response["Tags"] = [ Tag(Key=k, Value=v) for k, v in profile.tags.items() ] return response