In Files

Parent

Files

Class/Module Index [+]

Quicksearch

Parser

Author

Murali Raju (<murali.raju@appliv.com>)

Copyright

Copyright © 2011 Murali Raju.

License

Apache License, Version 2.0

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

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.

Public Instance Methods

list_auth_configs() click to toggle source

Parse swift-manager configs (JSON)

# File lib/parser.rb, line 22
def list_auth_configs
        auth_config_path = Dir.home + "/.swift-manager/authentication/*.json"
        auth_configs = Dir.glob(auth_config_path)

        #Display table output using the terminal-table gem
        table = Terminal::Table.new :headings => ['Auth Config']
        unless auth_configs.empty?
                auth_configs.each do |row|
                        @row = []
                        @row << "#{File.basename(row, '.*').chomp(File.extname(row))}".bright
                        table << @row
                end
        
        end
        puts table.to_s
        puts ''

end
show_auth_config(auth_json) click to toggle source
# File lib/parser.rb, line 41
def show_auth_config(auth_json)
        auth_config = File.read(Dir.home + "/.swift-manager/authentication/#{auth_json}.json")
        auth_params = JSON.parse(auth_config)

        #Display table output using the terminal-table gem
        table = Terminal::Table.new :headings => [ 'Tag', 'Provider', 'Service', 'Secret Access Key', 'Access Key ID', 'Auth URL IP']
        auth_params.each do |row|
          @row = []
          @row << auth_params["tag"]
          @row << auth_params["provider"]
          @row << auth_params["service"]
          @row << auth_params["keys"]["secret_access_key"]
          @row << auth_params["keys"]["access_key_id"]
          @row << auth_params["url_ip"]
        end
        table << @row
        puts table.to_s
        puts ''
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.