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 +4 -4
- data/README.md +2 -2
- data/lib/aws_account_number/cli.rb +41 -3
- data/lib/aws_account_number/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 08d5121334ece06fd427d6182ad73b48b782669c
|
|
4
|
+
data.tar.gz: 3c8249f1e23b17a3d5b362e75e2a375d96f19030
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
8
|
+
gem install aws_account_number
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```
|
|
14
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
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.
|
|
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-
|
|
11
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|