aws_account_number 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f44637d256f1c82d925c341dd9756c7324b76a15
4
- data.tar.gz: 6a76675e8aed93417f2329b66e78840bd80bc20a
3
+ metadata.gz: 08d5121334ece06fd427d6182ad73b48b782669c
4
+ data.tar.gz: 3c8249f1e23b17a3d5b362e75e2a375d96f19030
5
5
  SHA512:
6
- metadata.gz: 7cbf468ab3b8cbfad90672af9e0595178741fb776ca2c3f44bb7677167b865397904353cf07ca508c333e66b250a03408e36ec3975cee4ff9c83725fd11c30df
7
- data.tar.gz: a5aab7044ddff7e812cf43d7c1dbc9e75cf2cbb84b9fec30d16bf6cf638a4656bd58f3d8449a7305062a56efb7d258e33bcbe1d489f77bab7e16a637d6a25915
6
+ metadata.gz: b7212b5bb556609e475195e094b33bd7c6b8063a7ea6d7fab87753571b3ccaf35fab6c6e9a3f88f1c7333c3953429cad1ae105eacd254498dcd9584533aa903b
7
+ data.tar.gz: f4994b48d172e69625d69baa785ba5821bff27d56f3f8bde64500a45e4c3153789781040198d85bb90a19da1080c365006a3e4c8e5dabf501162d1012c622f5b
data/README.md CHANGED
@@ -5,13 +5,13 @@ You can get your Amazon Web Services (AWS) account number.
5
5
  ## Installation
6
6
 
7
7
  ```ruby
8
- gem install aws-account-number
8
+ gem install aws_account_number
9
9
  ```
10
10
 
11
11
  ## Usage
12
12
 
13
13
  ```
14
- aws-account-number get
14
+ aws_account_number get
15
15
  ```
16
16
 
17
17
  ## Development
@@ -7,9 +7,47 @@ module AwsAccountNumber
7
7
  class CLI < Thor
8
8
  include Thor::Aws
9
9
 
10
- desc :get, "get AWS Account Number"
11
- def get
12
- puts ec2.client.describe_security_groups(group_names: ['default']).security_groups.first.owner_id
10
+ default_command :security_group
11
+
12
+ desc :security_group, "get AWS Account Number from security group", alias: :s
13
+ def security_group
14
+ begin
15
+ puts ec2.client.describe_security_groups(group_names: ['default']).security_groups.first.owner_id
16
+ rescue RuntimeError => e
17
+ $stderr.puts e
18
+ exit 1
19
+ end
20
+ end
21
+
22
+ desc :cfn, "get AWS Account Number from CloudFormation stack", alias: :f
23
+ def cfn
24
+ template = <<-EOT
25
+ {
26
+ "Resources":{
27
+ "WaitHandle":{
28
+ "Type":"AWS::CloudFormation::WaitConditionHandle"
29
+ },
30
+ "Wait":{
31
+ "Type":"AWS::CloudFormation::WaitCondition",
32
+ "Properties":{
33
+ "Handle":{ "Ref":"WaitHandle" },
34
+ "Timeout":"1"
35
+ }
36
+ }
37
+ }
38
+ }
39
+ EOT
40
+ begin
41
+ result = cloudformation.client.create_stack(
42
+ stack_name: "accountnumber#{Time.now.to_i}",
43
+ template_body: template,
44
+ on_failure: "DELETE"
45
+ )
46
+ puts result.stack_id.split(':')[4]
47
+ rescue RuntimeError => e
48
+ $stderr.puts e
49
+ exit 1
50
+ end
13
51
  end
14
52
  end
15
53
  end
@@ -1,3 +1,3 @@
1
1
  module AwsAccountNumber
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_account_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ISOBE Kazuhiko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-04-01 00:00:00.000000000 Z
11
+ date: 2015-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler