def put_role_policy(self, role_name, policy_name, policy_document): self._check_role_exists(role_name) # PutRolePolicy will happily overwrite existing role policies self.mock_iam_role_policies[policy_name] = dict( policy_document=quote(policy_document), role_name=role_name) return self._wrap_result('put_role_policy')
def create_role(self, role_name, assume_role_policy_document, path=None): # real boto has a default for assume_role_policy_document; not # supporting this for now. It also allows assume_role_policy_document # to be a string, which we don't. self._check_path(path) self._check_role_does_not_exist(role_name) # there's no validation of assume_role_policy_document; not entirely # sure what the rules are self.mock_iam_roles[role_name] = dict( assume_role_policy_document=quote(json.dumps( assume_role_policy_document)), create_date=to_iso8601(datetime.utcnow()), path=(path or self.DEFAULT_PATH), policy_names=[], ) result = dict(role=self._describe_role(role_name)) return self._wrap_result('create_role', result)
def create_role(self, role_name, assume_role_policy_document, path=None): # real boto has a default for assume_role_policy_document; not # supporting this for now. It also allows assume_role_policy_document # to be a string, which we don't. self._check_path(path) self._check_role_does_not_exist(role_name) # there's no validation of assume_role_policy_document; not entirely # sure what the rules are self.mock_iam_roles[role_name] = dict( assume_role_policy_document=quote( json.dumps(assume_role_policy_document)), create_date=to_iso8601(datetime.utcnow()), path=(path or self.DEFAULT_PATH), policy_names=[], ) result = dict(role=self._describe_role(role_name)) return self._wrap_result('create_role', result)