Esempio n. 1
0
        public static bool CheckConnection()
        {
            try
            {
                AmazonEC2 ec2 = AWSClientFactory.CreateAmazonEC2Client(
                    App.Settings.AWSAccessKey,
                    App.Settings.AWSSecretKey,
                    new AmazonEC2Config {
                    ServiceURL = App.Settings.ServiceUrl
                }
                    );

                ec2.DescribeInstances(new DescribeInstancesRequest());

                return(true);
            }
            catch (AmazonEC2Exception ex)
            {
                string message = ex.Message + "\r\n" +
                                 "Response Status Code: " + ex.StatusCode + "\r\n" +
                                 "Error Code: " + ex.ErrorCode + "\r\n" +
                                 "Error Type: " + ex.ErrorType + "\r\n" +
                                 "Request ID: " + ex.RequestId;
                ExceptionDialog.Show(new AmazonEC2Exception(message, ex));
                return(false);
            }
            catch (Exception ex)
            {
                ExceptionDialog.Show(ex);
                return(false);
            }
        }
Esempio n. 2
0
 public static bool CheckConfig()
 {
     if (!File.Exists(Settings.PuttyPath))
     {
         ExceptionDialog.Show("Putty not found. Please check your configuration");
         return(false);
     }
     if (!File.Exists(Settings.KeyPath))
     {
         ExceptionDialog.Show("Key file not found. Please check your configuration");
         return(false);
     }
     if (string.IsNullOrWhiteSpace(Settings.AWSAccessKey) || string.IsNullOrWhiteSpace(Settings.AWSAccessKey))
     {
         ExceptionDialog.Show("Amazon security credentials are empty. Please check your configuration");
         return(false);
     }
     return(true);
 }