Exemple #1
0
        public Ec2Stopper(AwsStopOptionsValues options)
        {
            _options = options;
            var config = new AmazonEC2Config {
                RegionEndpoint = _options.RegionEndpoint
            };

            _client          = new AmazonEC2Client(_options.Credentials, config);
            _instanceHandler = new Ec2InstanceHandler(_client);
        }
        /// <summary>
        /// Stops the instances that are identified by the given bootstrap id.
        /// </summary>
        /// <param name="ec2"></param>
        /// <param name="bootstrapId">Unique, case-sensitive identifier you provide to identify the instances to stop.
        /// In AWS this is refered to as the Client Token.</param>
        /// <returns></returns>
        public static Result StopInstances(this IOfferAwsEc2Operations ec2, string bootstrapId)
        {
            var ec2Builder = ec2 as AwsEc2OperationsBuilder;

            var options          = new AwsStopOptionsValues(bootstrapId);
            var awsStopOperation = new AwsStopOperation(options);

            OperationExecutor.Execute((LocalBuilder)ec2, awsStopOperation);
            return(ec2Builder.Result);
        }
 public AwsStopOperation(AwsStopOptionsValues options) : base(options)
 {
     _options = options;
 }