awscli 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- metadata +5 -53
- data/README.rdoc +0 -5
- data/Rakefile +0 -44
- data/bin/awscli +0 -32
- data/features/awscli.feature +0 -8
- data/features/step_definitions/awscli_steps.rb +0 -6
- data/features/support/env.rb +0 -15
- data/lib/awscli.rb +0 -44
- data/lib/awscli/cli.rb +0 -21
- data/lib/awscli/cli/ec2.rb +0 -23
- data/lib/awscli/cli/ec2/ami.rb +0 -46
- data/lib/awscli/cli/ec2/ebs.rb +0 -85
- data/lib/awscli/cli/ec2/eip.rb +0 -56
- data/lib/awscli/cli/ec2/instances.rb +0 -195
- data/lib/awscli/cli/ec2/keypairs.rb +0 -60
- data/lib/awscli/cli/ec2/monitoring.rb +0 -35
- data/lib/awscli/cli/ec2/placement.rb +0 -42
- data/lib/awscli/cli/ec2/reservedinstmng.rb +0 -45
- data/lib/awscli/cli/ec2/secgroups.rb +0 -66
- data/lib/awscli/cli/ec2/spot.rb +0 -81
- data/lib/awscli/cli/ec2/subnet.rb +0 -43
- data/lib/awscli/cli/ec2/tags.rb +0 -45
- data/lib/awscli/cli/ec2/vmmng.rb +0 -17
- data/lib/awscli/cli/ec2/vpc.rb +0 -42
- data/lib/awscli/cli/ec2/vpc/connections.rb +0 -0
- data/lib/awscli/cli/ec2/vpc/cust_gateways.rb +0 -0
- data/lib/awscli/cli/ec2/vpc/dhcp.rb +0 -51
- data/lib/awscli/cli/ec2/vpc/internet_gateways.rb +0 -58
- data/lib/awscli/cli/ec2/vpc/net_interfaces.rb +0 -75
- data/lib/awscli/cli/ec2/vpc/network_acls.rb +0 -29
- data/lib/awscli/cli/ec2/vpc/priv_gatewats.rb +0 -0
- data/lib/awscli/cli/ec2/vpc/route_tables.rb +0 -0
- data/lib/awscli/cli/s3.rb +0 -12
- data/lib/awscli/cli/s3/directories.rb +0 -82
- data/lib/awscli/cli/s3/files.rb +0 -77
- data/lib/awscli/connection.rb +0 -55
- data/lib/awscli/ec2.rb +0 -790
- data/lib/awscli/errors.rb +0 -64
- data/lib/awscli/helper.rb +0 -8
- data/lib/awscli/s3.rb +0 -108
- data/lib/awscli/version.rb +0 -3
- data/test/default_test.rb +0 -14
- data/test/test_helper.rb +0 -9
data/lib/awscli/errors.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
module Awscli
|
2
|
-
module Errors
|
3
|
-
require 'awscli/helper'
|
4
|
-
|
5
|
-
class Error < StandardError
|
6
|
-
attr_accessor :verbose
|
7
|
-
|
8
|
-
def self.slurp(error, message=nil)
|
9
|
-
new_error = new(message)
|
10
|
-
new_error.set_backtrace(error.backtrace)
|
11
|
-
new_error.verbose = error.message
|
12
|
-
new_error
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
class LoadError < LoadError; end
|
17
|
-
|
18
|
-
class NotImplemented < Awscli::Errors::Error; end
|
19
|
-
|
20
|
-
def self.missing_environment_variable
|
21
|
-
message = <<-ERRMSG1.gsub(/^ {8}/, '')
|
22
|
-
Missing AWSCLI_CONFIG_FILE environment variable
|
23
|
-
Please export the variable 'export AWSCLI_CONFIG_FILE="~/awscli_config.yml'
|
24
|
-
ERRMSG1
|
25
|
-
raise(Awscli::Errors::LoadError.new(message))
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.missing_config_file
|
29
|
-
message = <<-ERRMSG2.gsub(/^ {8}/, '')
|
30
|
-
File Load Error, check if file exists
|
31
|
-
ERRMSG2
|
32
|
-
raise(Awscli::Errors::LoadError.new(message))
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.missing_credentials
|
36
|
-
message = <<-ERRMSG3.gsub(/^ {8}/, '')
|
37
|
-
MISSING CREDENTIALS
|
38
|
-
Add the following to your resource config file:
|
39
|
-
#############################
|
40
|
-
#Aws Credentials
|
41
|
-
#Key value pairs should look like this
|
42
|
-
#aws_access_key_id: 022QF06E7MXBSAMPLE
|
43
|
-
aws_access_key_id:
|
44
|
-
aws_secret_access_key:
|
45
|
-
region:
|
46
|
-
#
|
47
|
-
#End of Aws Credentials
|
48
|
-
############################
|
49
|
-
ERRMSG3
|
50
|
-
raise(Awscli::Errors::LoadError.new(message))
|
51
|
-
end
|
52
|
-
|
53
|
-
def self.invalid_credentials
|
54
|
-
message = "Invalid Credentials, Please check your AWS access and secret key id."
|
55
|
-
raise(Awscli::Errors::LoadError.new(message))
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.invalid_region
|
59
|
-
message = "Invalid region found in config file , Available Regions #{Awscli::Instances::REGIONS}"
|
60
|
-
raise(Awscli::Errors::LoadError.new(message))
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
end
|
data/lib/awscli/helper.rb
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
module Awscli
|
2
|
-
module Instances
|
3
|
-
INSTANCE_SIZES = %w(t1.micro m1.small m1.medium m1.large m1.xlarge m3.xlarge m3.2xlarge m2.xlarge
|
4
|
-
m2.2xlarge m2.4xlarge c1.medium c1.xlarge hs1.8xlarge)
|
5
|
-
INSTANCE_TYPES = %w(on-demand spot)
|
6
|
-
REGIONS = %w(eu-west-1 sa-east-1 us-east-1 ap-northeast-1 us-west-2 us-west-1 ap-southeast-1 ap-southeast-2)
|
7
|
-
end
|
8
|
-
end
|
data/lib/awscli/s3.rb
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
module Awscli
|
2
|
-
module S3
|
3
|
-
|
4
|
-
class Files
|
5
|
-
def initialize connection, options = {}
|
6
|
-
@@conn = connection
|
7
|
-
end
|
8
|
-
|
9
|
-
def list dir_name
|
10
|
-
dir = @@conn.directories.get(dir_name)
|
11
|
-
abort "cannot find bucket: #{dir_name}" unless dir
|
12
|
-
puts "LastModified \t SIZE \t Object"
|
13
|
-
dir.files.each do |file|
|
14
|
-
puts "#{file.last_modified} \t #{file.content_length} \t #{file.key}"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def upload_file dir_name, file_path
|
19
|
-
dir = @@conn.directories.get(dir_name)
|
20
|
-
abort "cannot find bucket: #{dir_name}" unless dir
|
21
|
-
file = File.expand_path(file_path)
|
22
|
-
abort "Invalid file path: #{file_path}" unless File.exist?(file)
|
23
|
-
file_name = File.basename(file)
|
24
|
-
dir.files.create(
|
25
|
-
:key => file_name,
|
26
|
-
:body => File.open(file),
|
27
|
-
:public => true
|
28
|
-
)
|
29
|
-
puts "Uploaded file: #{file_name} to bucket: #{dir_name}"
|
30
|
-
end
|
31
|
-
|
32
|
-
def download_file dir_name, file_name, path
|
33
|
-
dir = @@conn.directories.get(dir_name)
|
34
|
-
abort "cannot find bucket: #{dir_name}" unless dir
|
35
|
-
local_path = File.expand_path(path)
|
36
|
-
abort "Invalid file path: #{path}" unless File.exist?(local_path)
|
37
|
-
remote_file = dir.files.get(file_name)
|
38
|
-
abort "cannot find file: #{file_name}" unless remote_file
|
39
|
-
File.open("#{local_path}/#{remote_file.key}", 'w') do |f|
|
40
|
-
f.write(remote_file.body)
|
41
|
-
end
|
42
|
-
puts "Downloaded file: #{remote_file.key} to path: #{local_path}"
|
43
|
-
end
|
44
|
-
|
45
|
-
def delete_file dir_name, file_name
|
46
|
-
dir = @@conn.directories.get(dir_name)
|
47
|
-
abort "cannot find bucket: #{dir_name}" unless dir
|
48
|
-
remote_file = dir.files.get(file_name)
|
49
|
-
abort "cannot find file: #{file_name}" unless remote_file
|
50
|
-
remote_file.destroy
|
51
|
-
puts "Deleted file: #{file_name}"
|
52
|
-
end
|
53
|
-
|
54
|
-
def copy_file source_dir, source_file, dest_dir, dest_file
|
55
|
-
@@conn.directories.get(source_dir).files.get(source_file).copy(dest_dir, dest_file)
|
56
|
-
end
|
57
|
-
|
58
|
-
def get_public_url dir_name, file_name
|
59
|
-
url = @@conn.directories.get(dir_name).files.get(file_name).public_url
|
60
|
-
puts "public url for the file: #{file_name} is #{url}"
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
class Directories
|
65
|
-
def initialize connection, options = {}
|
66
|
-
@@conn = connection
|
67
|
-
end
|
68
|
-
|
69
|
-
def list
|
70
|
-
@@conn.directories.table
|
71
|
-
end
|
72
|
-
|
73
|
-
def create options
|
74
|
-
dir = @@conn.directories.create(options)
|
75
|
-
puts "Create bucket: #{dir.key}"
|
76
|
-
end
|
77
|
-
|
78
|
-
def delete dir_name
|
79
|
-
dir = @@conn.directories.get(dir_name)
|
80
|
-
abort "Cannot find bucket #{dir_name}" unless dir
|
81
|
-
dir.destroy
|
82
|
-
puts "Deleted Bucket: #{dir_name}"
|
83
|
-
end
|
84
|
-
|
85
|
-
def get_acl dir_name
|
86
|
-
dir = @@conn.directories.get(dir_name)
|
87
|
-
abort "Cannot find bucket #{dir_name}" unless dir
|
88
|
-
puts dir.acl
|
89
|
-
end
|
90
|
-
|
91
|
-
def set_acl dir_name, acl
|
92
|
-
dir = @@conn.directories.get(dir_name)
|
93
|
-
abort "Cannot find bucket #{dir_name}" unless dir
|
94
|
-
dir.acl = acl
|
95
|
-
puts "Acl has been changed to #{acl}"
|
96
|
-
end
|
97
|
-
|
98
|
-
def get_logging_status dir_name
|
99
|
-
puts @@conn.get_bucket_logging(dir_name).body['BucketLoggingStatus']
|
100
|
-
end
|
101
|
-
|
102
|
-
def set_logging_status dir_name, logging_status = {}
|
103
|
-
@@conn.put_bucket_logging dir_name, logging_status
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|
108
|
-
end
|
data/lib/awscli/version.rb
DELETED
data/test/default_test.rb
DELETED