Sha256: 8c101a2c2e5dd13768a5fb3361b317ae0809e6a700ea01aacd176d30e48cbc59

Contents?: true

Size: 1.87 KB

Versions: 8

Compression:

Stored size: 1.87 KB

Contents

# Copyright 2015 Adaptavist.com Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require_relative './cloud_server.rb'
using Rainbow
module AvstCloud
    class AwsServer < AvstCloud::CloudServer

        def stop
            if @server
                logger.debug "Stopping #{@server_name}"
                @server.stop
                wait_for_state() {|serv| serv.state == 'stopped'}
                logger.debug "[DONE]\n\n"
                logger.debug "Server #{@server_name} stopped...".green
            else
                raise "Server #{@server_name} does not exist!".red
            end
        end

        def start
            if @server
                logger.debug "Starting #{@server_name}"
                @server.start
                wait_for_state() {|serv| serv.ready?}
                logger.debug "[DONE]\n\n"
                logger.debug "Server #{@server_name} started...".green
            else
                raise "Server #{@server_name} does not exist!".red
            end
        end

        def destroy
            if @server
                logger.debug "Killing #{@server_name}"
                @server.destroy
                wait_for_state() {|serv| serv.state == 'terminated'}
                logger.debug "Server #{@server_name} destroyed...".green
            else
                raise "Server #{@server_name} does not exist!".red
            end
        end

    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
avst-cloud-0.1.42 lib/avst-cloud/aws_server.rb
avst-cloud-0.1.41 lib/avst-cloud/aws_server.rb
avst-cloud-0.1.40 lib/avst-cloud/aws_server.rb
avst-cloud-0.1.39 lib/avst-cloud/aws_server.rb
avst-cloud-0.1.38 lib/avst-cloud/aws_server.rb
avst-cloud-0.1.37 lib/avst-cloud/aws_server.rb
avst-cloud-0.1.36 lib/avst-cloud/aws_server.rb
avst-cloud-0.1.35 lib/avst-cloud/aws_server.rb