public Result BringOffline(string serverName, string farm, LoadBalancerSuspendMethod suspendMethod) { var credentials = GetCredentials(_config.CustomConfig); var endpoint = GetEndpoint(_config.CustomConfig); var ec2Client = new AmazonEC2Client(credentials, endpoint); var client = new AmazonElasticLoadBalancingClient(credentials, endpoint); var request = new DeregisterInstancesFromLoadBalancerRequest(farm, new List <Instance> { new Instance(GetInstanceId(ec2Client, serverName)) }); var response = client.DeregisterInstancesFromLoadBalancer(request); var result = Result.SuccessChanged(); result.Data.HttpStatusCode = response.HttpStatusCode; result.Data.ActiveInstances = response.Instances; return(result); }
public void ElasticLoadBalancingDeregisterInstancesFromLoadBalancer() { #region elb-deregister-instances-from-load-balancer-1 var client = new AmazonElasticLoadBalancingClient(); var response = client.DeregisterInstancesFromLoadBalancer(new DeregisterInstancesFromLoadBalancerRequest { Instances = new List <Instance> { new Instance { InstanceId = "i-d6f6fae3" } }, LoadBalancerName = "my-load-balancer" }); List <Instance> instances = response.Instances; #endregion }