class ZAWS::AWSCLI

Attributes

home[RW]

Public Class Methods

new(shellout,keep_filestore_empty=false) click to toggle source
# File lib/zaws/external/awscli/awscli.rb, line 7
def initialize(shellout,keep_filestore_empty=false)
  @shellout=shellout
        @keep_filestore_empty=keep_filestore_empty
end

Public Instance Methods

command_ec2() click to toggle source
# File lib/zaws/external/awscli/awscli.rb, line 43
    def command_ec2
      @_command_ec2 ||= (ZAWS::AWSCLI::Commands::EC2.new(@shellout,self))
      return @_command_ec2
end
command_iam() click to toggle source
# File lib/zaws/external/awscli/awscli.rb, line 48
    def command_iam 
      @_command_iam ||= (ZAWS::AWSCLI::Commands::IAM.new(@shellout,self))
      return @_command_iam
end
data_ec2() click to toggle source
# File lib/zaws/external/awscli/awscli.rb, line 53
def data_ec2
  @_data_ec2 ||= (ZAWS::AWSCLI::Data::EC2.new(@shellout,self))
  return @_data_ec2
end
data_iam() click to toggle source
# File lib/zaws/external/awscli/awscli.rb, line 58
def data_iam
  @_data_iam ||= (ZAWS::AWSCLI::Data::IAM.new(@shellout,self))
  return @_data_iam
end
extended_Regions() click to toggle source
# File lib/zaws/external/awscli/regions.rb, line 8
def extended_Regions
  return %w(us-east-1 eu-central-1 ap-southeast-1 ap-northeast-1 ap-southeast-2 ap-northeast-2 sa-east-1)
end
filestore() click to toggle source
# File lib/zaws/external/awscli/awscli.rb, line 12
def filestore
  @filestore ||= ZAWS::Repository::Filestore.new(@keep_filestore_empty)
              @filestore.timeout = 1800
              return @filestore if @keep_filestore_empty
              @home ||= ENV['HOME']
  @filestore.location="#{@home}/.awsdata"
              unless File.directory?(@filestore.location)
                      FileUtils.mkdir_p(@filestore.location)
              end
  return @filestore
end
main_regions() click to toggle source
# File lib/zaws/external/awscli/regions.rb, line 4
def main_regions
  return %w(us-east-1 us-west-2 us-west-1 ap-southeast-1)
end
remove_creds() click to toggle source
# File lib/zaws/external/awscli/awscli.rb, line 24
def remove_creds
              if File.directory?("#{@home}/.awsdata")
                      FileUtils.rmtree("#{@home}/.awsdata")
              end
        if File.exist?("#{@home}/.aws/credentials")
                      File.delete("#{@home}/.aws/credentials")
              end
      end
version() click to toggle source
# File lib/zaws/external/awscli/awscli.rb, line 33
def version 
  if ! @version
        info = @shellout.cli("aws --version",nil)
        #aws-cli/1.2.13 Python/2.7.5 Linux/3.10.0-123.el7.x86_64
        version_match = /(?<version>aws-cli\/[1-9\.]*)/.match(info)
        @version ||= version_match[:version]
  end
  return @version
end