static bool Passwd(IList<string> unparsed) { if (unparsed.Count != 0) { Console.Error.WriteLine("Too many arguments for [change_password]: {0}", String.Join(", ", unparsed.Select(s => String.Format("'{0}'", s)))); Console.Error.WriteLine("Usage: vmc passwd"); return false; } IVcapClient vc = new VcapClient(); VcapClientResult rslt = vc.Info(); Info info = rslt.GetResponseMessage<Info>(); Console.WriteLine("Changing password for '{0}'", info.User); Console.Write("New Password: "******"Verify Password: "******"Passwords did not match!"); return false; } }
public ProviderResponse<bool> ChangePassword(Cloud cloud, string newPassword) { var response = new ProviderResponse<bool>(); try { IVcapClient client = new VcapClient(cloud); client.ChangePassword(newPassword); response.Response = true; } catch (Exception ex) { response.Message = ex.Message; } return response; }
public ProviderResponse<bool> ChangePassword(Cloud cloud, string newPassword) { var response = new ProviderResponse<bool>(); try { IVcapClient client = new VcapClient(cloud); var vcapResult = client.ChangePassword(newPassword); if (!vcapResult.Success) throw new Exception(vcapResult.Message); response.Response = true; } catch (Exception ex) { response.Message = ex.Message; } return response; }