Example #1
0
        public Result BringOnline(string serverName, string farm)
        {
            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 RegisterInstancesWithLoadBalancerRequest(farm, new List <Instance> {
                new Instance(GetInstanceId(ec2Client, serverName))
            });
            var response = client.RegisterInstancesWithLoadBalancer(request);
            var result   = Result.SuccessChanged();

            result.Data.HttpStatusCode  = response.HttpStatusCode;
            result.Data.ActiveInstances = response.Instances;
            return(result);
        }
Example #2
0
        public void ElasticLoadBalancingRegisterInstancesWithLoadBalancer()
        {
            #region elb-register-instances-with-load-balancer-1

            var client   = new AmazonElasticLoadBalancingClient();
            var response = client.RegisterInstancesWithLoadBalancer(new RegisterInstancesWithLoadBalancerRequest
            {
                Instances = new List <Instance> {
                    new Instance {
                        InstanceId = "i-d6f6fae3"
                    }
                },
                LoadBalancerName = "my-load-balancer"
            });

            List <Instance> instances = response.Instances;

            #endregion
        }