aws_helper 0.0.4 → 0.0.5

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.
data/lib/awshelper/cli.rb CHANGED
@@ -132,26 +132,30 @@ end
132
132
 
133
133
  desc "snap_email TO FROM EMAIL_SERVER", "Email Snapshot List."
134
134
  option :rows, :type => :numeric, :required => false
135
+ option :owner, :type => :numeric, :required => false
135
136
 
136
137
  long_desc <<-LONGDESC
137
- 'snap_email TO FROM EMAIL_SERVER ['EBS Backups'] --rows=<numeric>''
138
+ 'snap_email TO FROM EMAIL_SERVER ['EBS Backups'] --rows=<numeric> --owner=<numeric>'
138
139
  \x5 Emails the last 20 snapshots from specific email address via the email_server.
139
140
  \x5 All commands rely on environment variables or the server having an IAM role
140
141
  \x5 export AWS_ACCESS_KEY_ID ='xxxxxxxxxxxx'
141
142
  \x5 export AWS_SECRET_ACCESS_KEY ='yyyyyyyy'
142
143
  \x5 For example
143
- \x5 aws_helper snap_email me@mycompany.com ebs.backups@mycompany.com emailserver.com 'My EBS Backups' --rows=20
144
- \x5 will email the list of the latest 20 snapshots to email address me@mycompany.com via email server emailserver.com
144
+ \x5 aws_helper snap_email me@mycompany.com ebs.backups@mycompany.com emailserver.com 'My EBS Backups' --rows=20 -owner=999887777
145
+ \x5 will email the list of the latest 20 snapshots to email address me@mycompany.com via email server emailserver.com
146
+ \x5 that belong to aws owner 999887777
145
147
  LONGDESC
146
148
 
147
149
  def snap_email(to, from, email_server, subject='EBS Backups')
148
150
  rows = 20
149
151
  rows = options[:rows] if options[:rows]
152
+ owner = {}
153
+ owner = {:owner, options[:owner]} if options[:owner]
150
154
  message = ""
151
155
  log("Report on snapshots")
152
156
  # ({ Name="start-time", Values="today in YYYY-MM-DD"})
153
157
  i = rows
154
- ec2.describe_snapshots.sort { |a,b| b[:aws_started_at] <=> a[:aws_started_at] }.each do |snapshot|
158
+ ec2.describe_snapshots(owner).sort { |a,b| b[:aws_started_at] <=> a[:aws_started_at] }.each do |snapshot|
155
159
  if i >0
156
160
  message = message+"#{snapshot[:aws_id]} #{snapshot[:aws_volume_id]} #{snapshot[:aws_started_at]} #{snapshot[:aws_description]} #{snapshot[:aws_status]}\n"
157
161
  i = i-1
@@ -1,3 +1,3 @@
1
1
  module Awshelper
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-02 00:00:00.000000000 Z
12
+ date: 2015-01-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: right_aws