launch_configuration_cleaner 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.gitignore +9 -0
 - data/.rspec +2 -0
 - data/.travis.yml +3 -0
 - data/CODE_OF_CONDUCT.md +13 -0
 - data/Gemfile +3 -0
 - data/LICENSE.txt +21 -0
 - data/README.md +67 -0
 - data/Rakefile +6 -0
 - data/bin/clean_lc +4 -0
 - data/bin/console +14 -0
 - data/bin/setup +7 -0
 - data/cleaner.rb +61 -0
 - data/launch_configuration_cleaner.gemspec +27 -0
 - data/lib/launch_configuration_cleaner.rb +2 -0
 - data/lib/launch_configuration_cleaner/CLI.rb +35 -0
 - data/lib/launch_configuration_cleaner/agent.rb +42 -0
 - data/lib/launch_configuration_cleaner/version.rb +3 -0
 - metadata +133 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 24b9c12a72d1b1af8f6b340d2a1f2f8e328703eb
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 33e5cda2c3264bc799ea274c5b37c2da5d236c37
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 45931a312cb063c5df1d84e64b2ecc880858d0bc442b15561946cb2b3a5c4b4c8f82590f7de400cacb29c51f469676ae7ee615aa3cd59abb307e526d651849f3
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 6cf495c3480fca069a78c75875b6050e0506c56f55023a72fd78f503670cda8350f2cb9ad0630867ab1354276b79d8bb17b6c71ee123eed89f04abddf3043dbf
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.rspec
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/CODE_OF_CONDUCT.md
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Contributor Code of Conduct
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
         
     | 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2015 ryonext
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in
         
     | 
| 
      
 13 
     | 
    
         
            +
            all copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         
     | 
| 
      
 21 
     | 
    
         
            +
            THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,67 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # LaunchConfigurationCleaner
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            You can remove many LaunchConfigurations (AWS autoscaling setting) easier.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 10 
     | 
    
         
            +
            gem 'launch_configuration_cleaner'
         
     | 
| 
      
 11 
     | 
    
         
            +
            ```
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                $ gem install launch_configuration_cleaner
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            1. Execute `clean_lc` in your terminal.
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            ```
         
     | 
| 
      
 26 
     | 
    
         
            +
            $ clean_lc
         
     | 
| 
      
 27 
     | 
    
         
            +
            ```
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            2. Then, this app shows your LaunchConfigurations.
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            ```
         
     | 
| 
      
 32 
     | 
    
         
            +
            [
         
     | 
| 
      
 33 
     | 
    
         
            +
              YourLaunchConfiguration1,
         
     | 
| 
      
 34 
     | 
    
         
            +
              YourLaunchConfiguration2,
         
     | 
| 
      
 35 
     | 
    
         
            +
              YourLaunchConfiguration3,
         
     | 
| 
      
 36 
     | 
    
         
            +
              YourLaunchConfiguration4,
         
     | 
| 
      
 37 
     | 
    
         
            +
              YourLaunchConfiguration5,
         
     | 
| 
      
 38 
     | 
    
         
            +
            ]
         
     | 
| 
      
 39 
     | 
    
         
            +
            ```
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            3. Enter "y", if you want to remove a LaunchConfiguration
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            ```
         
     | 
| 
      
 44 
     | 
    
         
            +
            Do you want to delete YourLaunchConfiguration1? (y/n)
         
     | 
| 
      
 45 
     | 
    
         
            +
            ```
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            4. After judging each configurations, you need to enter a final answer.
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            ```
         
     | 
| 
      
 50 
     | 
    
         
            +
            These launch configurations will be deleted.
         
     | 
| 
      
 51 
     | 
    
         
            +
            [
         
     | 
| 
      
 52 
     | 
    
         
            +
              YourLaunchConfiguration1,
         
     | 
| 
      
 53 
     | 
    
         
            +
              YourLaunchConfiguration3,
         
     | 
| 
      
 54 
     | 
    
         
            +
              YourLaunchConfiguration5,
         
     | 
| 
      
 55 
     | 
    
         
            +
            ]
         
     | 
| 
      
 56 
     | 
    
         
            +
            Are you sure? (yes or no)
         
     | 
| 
      
 57 
     | 
    
         
            +
            ```
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            If you enter "yes", LaunchConfigurations will be deleted.
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            1. Fork it ( https://github.com/[my-github-username]/launch_configuration_cleaner/fork )
         
     | 
| 
      
 64 
     | 
    
         
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
      
 65 
     | 
    
         
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
      
 66 
     | 
    
         
            +
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
      
 67 
     | 
    
         
            +
            5. Create a new Pull Request
         
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/bin/clean_lc
    ADDED
    
    
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "bundler/setup"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "launch_configuration_cleaner"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
      
 7 
     | 
    
         
            +
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
      
 10 
     | 
    
         
            +
            # require "pry"
         
     | 
| 
      
 11 
     | 
    
         
            +
            # Pry.start
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            require "irb"
         
     | 
| 
      
 14 
     | 
    
         
            +
            IRB.start
         
     | 
    
        data/bin/setup
    ADDED
    
    
    
        data/cleaner.rb
    ADDED
    
    | 
         @@ -0,0 +1,61 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "bundler"
         
     | 
| 
      
 2 
     | 
    
         
            +
            Bundler.require
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            def client
         
     | 
| 
      
 5 
     | 
    
         
            +
              @client ||= Aws::AutoScaling::Client.new(region: 'ap-southeast-1')
         
     | 
| 
      
 6 
     | 
    
         
            +
            end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            def launch_configurations
         
     | 
| 
      
 9 
     | 
    
         
            +
              @launch_configurations ||= client.describe_launch_configurations.launch_configurations
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            def list_current_configurations
         
     | 
| 
      
 13 
     | 
    
         
            +
              puts "These are your launch configurations"
         
     | 
| 
      
 14 
     | 
    
         
            +
              puts "["
         
     | 
| 
      
 15 
     | 
    
         
            +
              launch_configurations.each do |l|
         
     | 
| 
      
 16 
     | 
    
         
            +
                puts "  #{l.launch_configuration_name},"
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
              puts "]"
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            def ask_delete_target
         
     | 
| 
      
 22 
     | 
    
         
            +
              launch_configurations.map do |l|
         
     | 
| 
      
 23 
     | 
    
         
            +
                puts "Do you want to delete #{l.launch_configuration_name}? (y/n)"
         
     | 
| 
      
 24 
     | 
    
         
            +
                answer = gets.strip
         
     | 
| 
      
 25 
     | 
    
         
            +
                if answer == "y"
         
     | 
| 
      
 26 
     | 
    
         
            +
                  puts "Delete #{l.launch_configuration_name} later..."
         
     | 
| 
      
 27 
     | 
    
         
            +
                  l
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
              end.compact
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            def list_delete_target(delete_list)
         
     | 
| 
      
 33 
     | 
    
         
            +
              puts "These launch configurations will be deleted."
         
     | 
| 
      
 34 
     | 
    
         
            +
              puts "["
         
     | 
| 
      
 35 
     | 
    
         
            +
              delete_list.each do |l|
         
     | 
| 
      
 36 
     | 
    
         
            +
                puts "  #{l.launch_configuration_name},"
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
              puts "]"
         
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            delete_list = ask_delete_target
         
     | 
| 
      
 42 
     | 
    
         
            +
            exit if delete_list.size == 0
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            list_delete_target(delete_list)
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            while true do
         
     | 
| 
      
 47 
     | 
    
         
            +
              puts "Are you sure? (yes or no)"
         
     | 
| 
      
 48 
     | 
    
         
            +
              final_answer = gets.strip
         
     | 
| 
      
 49 
     | 
    
         
            +
              if final_answer == "yes"
         
     | 
| 
      
 50 
     | 
    
         
            +
                delete_list.each do |l|
         
     | 
| 
      
 51 
     | 
    
         
            +
                  client.delete_launch_configuration(launch_configuration_name: l.launch_configuration_name)
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
                puts "LaunchConfiguration have been deleted."
         
     | 
| 
      
 54 
     | 
    
         
            +
                break
         
     | 
| 
      
 55 
     | 
    
         
            +
              elsif final_answer == "no"
         
     | 
| 
      
 56 
     | 
    
         
            +
                puts "Ok, canceled."
         
     | 
| 
      
 57 
     | 
    
         
            +
                break
         
     | 
| 
      
 58 
     | 
    
         
            +
              else
         
     | 
| 
      
 59 
     | 
    
         
            +
                puts "Sorry, I don't understand your answer."
         
     | 
| 
      
 60 
     | 
    
         
            +
              end
         
     | 
| 
      
 61 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'launch_configuration_cleaner/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = "launch_configuration_cleaner"
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = LaunchConfigurationCleaner::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ["ryonext"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ["ryonext.s@gmail.com"]
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              spec.summary       = %q{Remove AWS LaunchConfiguration quickly.}
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.description   = %q{Remove AWS LaunchConfiguration quickly.}
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.homepage      = "https://github.com/ryonext/launch_configuration_cleaner"
         
     | 
| 
      
 15 
     | 
    
         
            +
              spec.license       = "MIT"
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.bindir        = "bin"
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.executables   = "clean_lc"
         
     | 
| 
      
 20 
     | 
    
         
            +
              spec.require_paths = ["lib"]
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_dependency "aws-sdk", "~> 2.0"
         
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_dependency "thor"
         
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_development_dependency "bundler", "~> 1.9"
         
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
      
 26 
     | 
    
         
            +
              spec.add_development_dependency "rspec"
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "thor"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "launch_configuration_cleaner/agent"
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module LaunchConfigurationCleaner
         
     | 
| 
      
 5 
     | 
    
         
            +
              class CLI < Thor
         
     | 
| 
      
 6 
     | 
    
         
            +
                default_task :execute
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                desc "execute", "Fetch LaunchConfiguration list from AWS and you can choose which you want to remove."
         
     | 
| 
      
 9 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 10 
     | 
    
         
            +
                  agent = Agent.new
         
     | 
| 
      
 11 
     | 
    
         
            +
                  agent.list_current_configurations
         
     | 
| 
      
 12 
     | 
    
         
            +
                  delete_list = agent.ask_delete_target
         
     | 
| 
      
 13 
     | 
    
         
            +
                  exit if delete_list.size == 0
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  agent.list_delete_target(delete_list)
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  while true do
         
     | 
| 
      
 18 
     | 
    
         
            +
                    puts "Are you sure? (yes or no)"
         
     | 
| 
      
 19 
     | 
    
         
            +
                    final_answer = gets.strip
         
     | 
| 
      
 20 
     | 
    
         
            +
                    if final_answer == "yes"
         
     | 
| 
      
 21 
     | 
    
         
            +
                      delete_list.each do |l|
         
     | 
| 
      
 22 
     | 
    
         
            +
                        agent.client.delete_launch_configuration(launch_configuration_name: l.launch_configuration_name)
         
     | 
| 
      
 23 
     | 
    
         
            +
                      end
         
     | 
| 
      
 24 
     | 
    
         
            +
                      puts "LaunchConfiguration have been deleted."
         
     | 
| 
      
 25 
     | 
    
         
            +
                      break
         
     | 
| 
      
 26 
     | 
    
         
            +
                    elsif final_answer == "no"
         
     | 
| 
      
 27 
     | 
    
         
            +
                      puts "Ok, canceled."
         
     | 
| 
      
 28 
     | 
    
         
            +
                      break
         
     | 
| 
      
 29 
     | 
    
         
            +
                    else
         
     | 
| 
      
 30 
     | 
    
         
            +
                      puts "Sorry, I don't understand your answer."
         
     | 
| 
      
 31 
     | 
    
         
            +
                    end
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,42 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "aws-sdk"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module LaunchConfigurationCleaner
         
     | 
| 
      
 4 
     | 
    
         
            +
              class Agent
         
     | 
| 
      
 5 
     | 
    
         
            +
                def client
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @client ||= Aws::AutoScaling::Client.new
         
     | 
| 
      
 7 
     | 
    
         
            +
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def launch_configurations
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @launch_configurations ||= client.describe_launch_configurations.launch_configurations
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                def list_current_configurations
         
     | 
| 
      
 14 
     | 
    
         
            +
                  puts "These are your launch configurations"
         
     | 
| 
      
 15 
     | 
    
         
            +
                  puts "["
         
     | 
| 
      
 16 
     | 
    
         
            +
                  launch_configurations.each do |l|
         
     | 
| 
      
 17 
     | 
    
         
            +
                    puts "  #{l.launch_configuration_name},"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
                  puts "]"
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                def ask_delete_target
         
     | 
| 
      
 23 
     | 
    
         
            +
                  launch_configurations.map do |l|
         
     | 
| 
      
 24 
     | 
    
         
            +
                    puts "Do you want to delete #{l.launch_configuration_name}? (y/n)"
         
     | 
| 
      
 25 
     | 
    
         
            +
                    answer = gets.strip
         
     | 
| 
      
 26 
     | 
    
         
            +
                    if answer == "y"
         
     | 
| 
      
 27 
     | 
    
         
            +
                      puts "Delete #{l.launch_configuration_name} later..."
         
     | 
| 
      
 28 
     | 
    
         
            +
                      l
         
     | 
| 
      
 29 
     | 
    
         
            +
                    end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end.compact
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                def list_delete_target(delete_list)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  puts "These launch configurations will be deleted."
         
     | 
| 
      
 35 
     | 
    
         
            +
                  puts "["
         
     | 
| 
      
 36 
     | 
    
         
            +
                  delete_list.each do |l|
         
     | 
| 
      
 37 
     | 
    
         
            +
                    puts "  #{l.launch_configuration_name},"
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
                  puts "]"
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
              end
         
     | 
| 
      
 42 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,133 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: launch_configuration_cleaner
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - ryonext
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-09-18 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: aws-sdk
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '2.0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '2.0'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: thor
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '1.9'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '1.9'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 83 
     | 
    
         
            +
            description: Remove AWS LaunchConfiguration quickly.
         
     | 
| 
      
 84 
     | 
    
         
            +
            email:
         
     | 
| 
      
 85 
     | 
    
         
            +
            - ryonext.s@gmail.com
         
     | 
| 
      
 86 
     | 
    
         
            +
            executables:
         
     | 
| 
      
 87 
     | 
    
         
            +
            - clean_lc
         
     | 
| 
      
 88 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 89 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 90 
     | 
    
         
            +
            files:
         
     | 
| 
      
 91 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 92 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
      
 93 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 94 
     | 
    
         
            +
            - CODE_OF_CONDUCT.md
         
     | 
| 
      
 95 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 96 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 97 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 98 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 99 
     | 
    
         
            +
            - bin/clean_lc
         
     | 
| 
      
 100 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 101 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
      
 102 
     | 
    
         
            +
            - cleaner.rb
         
     | 
| 
      
 103 
     | 
    
         
            +
            - launch_configuration_cleaner.gemspec
         
     | 
| 
      
 104 
     | 
    
         
            +
            - lib/launch_configuration_cleaner.rb
         
     | 
| 
      
 105 
     | 
    
         
            +
            - lib/launch_configuration_cleaner/CLI.rb
         
     | 
| 
      
 106 
     | 
    
         
            +
            - lib/launch_configuration_cleaner/agent.rb
         
     | 
| 
      
 107 
     | 
    
         
            +
            - lib/launch_configuration_cleaner/version.rb
         
     | 
| 
      
 108 
     | 
    
         
            +
            homepage: https://github.com/ryonext/launch_configuration_cleaner
         
     | 
| 
      
 109 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 110 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 111 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 112 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 113 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 114 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 115 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 116 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 117 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 118 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 119 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 120 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 121 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 122 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 123 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 124 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 125 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 126 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 127 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 128 
     | 
    
         
            +
            rubygems_version: 2.4.5
         
     | 
| 
      
 129 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 130 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 131 
     | 
    
         
            +
            summary: Remove AWS LaunchConfiguration quickly.
         
     | 
| 
      
 132 
     | 
    
         
            +
            test_files: []
         
     | 
| 
      
 133 
     | 
    
         
            +
            has_rdoc: 
         
     |