Пример #1
0
        private string FindInstanceId(string ipAddress)
        {
            try
            {
                ApDashboardService service = new ApDashboardService();
                MonoscapeCredentials credentials = new MonoscapeCredentials(Settings.MonoscapeAccessKey, Settings.MonoscapeSecretKey);
                ApDescribeInstancesRequest request = new ApDescribeInstancesRequest(credentials);
                ApDescribeInstancesResponse response = service.DescribeInstances(request);

                foreach (Instance instance in response.Instances)
                {
                    if (instance.IpAddress.Equals(ipAddress))
                        return instance.InstanceId;
                }
            }
            catch (Exception)
            {
                Log.Error(this, "Could not find Instance ID of " + ipAddress);
            }
            return null;
        }
Пример #2
0
        public ApDescribeInstancesResponse DescribeInstances(ApDescribeInstancesRequest request)
        {
            Log.Debug(this, "DescribeInstances()");

            try
            {
                Authenticate(request);
                ApDescribeInstancesResponse response = new ApDescribeInstancesResponse();
                response.Instances = IaasClient.DescribeInstances();
                return response;
            }
            catch (Exception e)
            {
                Log.Error(this, e);
                throw e;
            }
        }
Пример #3
0
 private List<Instance> DescribeInstances()
 {
     ApDescribeInstancesRequest request = new ApDescribeInstancesRequest(Credentials);
     ApDescribeInstancesResponse response = EndPoints.ApDashboardService.DescribeInstances(request);
     return response.Instances;
 }