private bool keyExistOnServer() { bool exist = false; CEc2Service serv = new CEc2Service(); List <string> kps = serv.descrbibeKeyPairs(); foreach (string kp in kps) { if (string.Compare(kp, _keyPairName) == 0) { exist = true; break; } } if (exist == true) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "PEM files (*.pem)|*.pem"; ofd.InitialDirectory = CAwsConfig.getEc2BootstrapperDirectory(); ofd.Title = "Select private key file for " + _keyPairName; if (System.Windows.Forms.DialogResult.OK == ofd.ShowDialog()) { CAwsConfig.Instance.setKeyFilePath(_keyPairName, ofd.FileName); CAwsConfig.Instance.commit(); } else { throw new Exception("key " + _keyPairName + " is not associated its key file."); } } return(exist); }
private bool securitryGroupExistOnServer() { bool exist = false; CEc2Service serv = new CEc2Service(); List <string> sgs = serv.descrbibeSecurityGroups(); foreach (string sg in sgs) { if (string.Compare(sg, _securityGroups) == 0) { exist = true; break; } } return(exist); }
public void getInstances() { try { if (_instances.Count == 0) { CEc2Service serv = new CEc2Service(); List<CEc2Instance> list = serv.describeInstances(); foreach (CEc2Instance inst in list) { _instances.Add(inst); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } _dashboard.Dispatcher.Invoke(new StopProgressbarCallback(_dashboard.disableProgressBar)); this.Dispatcher.Invoke(new SetBorderThickNessCallback(setBorderThickNess)); fectchingInstance = false; }
void terminate_Click(object sender, RoutedEventArgs e) { try { ContextMenu cm = (ContextMenu)ContextMenu.ItemsControlFromItemContainer((MenuItem)e.OriginalSource); CEc2Instance ins = (CEc2Instance)((FrameworkElement)(((Panel)(cm.PlacementTarget)).Children[0])).DataContext; MessageBoxResult result = MessageBox.Show( "You are about to terminate the selected instance. Are you sure you want to continue?", "Terminate Instance", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No); if (result == MessageBoxResult.No) return; if (!string.IsNullOrEmpty(ins.instanceId)) { CEc2Service serv = new CEc2Service(); serv.terminate(ins.instanceId); } else { MessageBox.Show("No instance ID available"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void fetchMyAmis() { if (_myAmis == null || _myAmis.Count == 0) { CEc2Service serv = new CEc2Service(); _myAmis = serv.describeImages("self"); } }
void fetchCommunityAmis() { if (_commAmis == null || _commAmis.Count == 0) { CEc2Service serv = new CEc2Service(); _commAmis = serv.describeImages(null); } }
private bool securitryGroupExistOnServer() { bool exist = false; CEc2Service serv = new CEc2Service(); List<string> sgs = serv.descrbibeSecurityGroups(); foreach (string sg in sgs) { if (string.Compare(sg, _securityGroups) == 0) { exist = true; break; } } return exist; }
private bool keyExistOnServer() { bool exist = false; CEc2Service serv = new CEc2Service(); List<string> kps = serv.descrbibeKeyPairs(); foreach (string kp in kps) { if (string.Compare(kp, _keyPairName) == 0) { exist = true; break; } } if (exist == true) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "PEM files (*.pem)|*.pem"; ofd.InitialDirectory = CAwsConfig.getEc2BootstrapperDirectory(); ofd.Title = "Select private key file for " + _keyPairName; if (System.Windows.Forms.DialogResult.OK == ofd.ShowDialog()) { CAwsConfig.Instance.setKeyFilePath(_keyPairName, ofd.FileName); CAwsConfig.Instance.commit(); } else { throw new Exception("key " + _keyPairName + " is not associated its key file."); } } return exist; }