private static void UnmarshallResult(XmlUnmarshallerContext context, CreateLoginProfileResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("LoginProfile", targetDepth)) { var unmarshaller = LoginProfileUnmarshaller.Instance; response.LoginProfile = unmarshaller.Unmarshall(context); continue; } } } return; }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { CreateLoginProfileResponse response = new CreateLoginProfileResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("CreateLoginProfileResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
public void TestCreateGetLoginProfile() { string username = IAMUtil.CreateTestUser(Client); string password = "******"; try { CreateLoginProfileResponse createRes = Client.CreateLoginProfile(new CreateLoginProfileRequest { UserName = username, Password = password, PasswordResetRequired = true }); Thread.Sleep(3 * 3600); Assert.AreEqual(username, createRes.LoginProfile.UserName); GetLoginProfileResponse getRes = Client.GetLoginProfile(new GetLoginProfileRequest() { UserName = username }); Assert.AreNotEqual(DateTime.MinValue, getRes.LoginProfile.CreateDate); var login = getRes.LoginProfile; Assert.AreEqual(username, login.UserName); Assert.IsTrue(login.PasswordResetRequired); Client.UpdateLoginProfile(new UpdateLoginProfileRequest { UserName = username, Password = password, PasswordResetRequired = false }); Assert.AreEqual(username, createRes.LoginProfile.UserName); getRes = Client.GetLoginProfile(new GetLoginProfileRequest() { UserName = username }); Assert.AreNotEqual(DateTime.MinValue, getRes.LoginProfile.CreateDate); login = getRes.LoginProfile; Assert.AreEqual(username, login.UserName); Assert.IsFalse(login.PasswordResetRequired); } finally { IAMUtil.DeleteTestUsers(Client, username); } }
public static CreateLoginProfileResponse Unmarshall(UnmarshallerContext context) { CreateLoginProfileResponse createLoginProfileResponse = new CreateLoginProfileResponse(); createLoginProfileResponse.HttpResponse = context.HttpResponse; createLoginProfileResponse.RequestId = context.StringValue("CreateLoginProfile.RequestId"); CreateLoginProfileResponse.CreateLoginProfile_LoginProfile loginProfile = new CreateLoginProfileResponse.CreateLoginProfile_LoginProfile(); loginProfile.UserName = context.StringValue("CreateLoginProfile.LoginProfile.UserName"); loginProfile.PasswordResetRequired = context.BooleanValue("CreateLoginProfile.LoginProfile.PasswordResetRequired"); loginProfile.MFABindRequired = context.BooleanValue("CreateLoginProfile.LoginProfile.MFABindRequired"); loginProfile.CreateDate = context.StringValue("CreateLoginProfile.LoginProfile.CreateDate"); createLoginProfileResponse.LoginProfile = loginProfile; return(createLoginProfileResponse); }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { CreateLoginProfileResponse response = new CreateLoginProfileResponse(); while (context.Read()) { if (context.IsStartElement) { if (context.TestExpression("CreateLoginProfileResult", 2)) { response.CreateLoginProfileResult = CreateLoginProfileResultUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context); } } } return(response); }