awshark 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f014eaddd54562cad6064bc0b28a9fde800b7144f3be26e4af11f02a99d1f13
4
- data.tar.gz: 258b5c71b20180623ca66646d4081c38d8c14e590a1b2a2773193523423dc614
3
+ metadata.gz: 944b9d2229c69abfd14fae195f1ba6ffad83e48b1f8a6d8b250ba1958a600330
4
+ data.tar.gz: d1b9886e347b3eb551f765f1788e556751aca04b17ae95e034d9b4ffbd83936b
5
5
  SHA512:
6
- metadata.gz: 42970eec188f9fe6a4f561a2d42b01387b08c98f26ee93e0352d83f1fda165f119ae09909fbbb62c80e5380ca259a8d667bb46cf416e742db333051da4891204
7
- data.tar.gz: ecf2602e7bb5cf37ebd508d3bb95d44eff004214f38bb6fa19475ee38d6b094093c6572c17acb3d48ca59d6b018a39129019d450e80aa7a6db4d84d0cc4b7c17
6
+ metadata.gz: 348b4502d6989094798ad96470f219d2207bbf1acaeef6aeaffde67ae1d25a10efc371f6bf9c7f00a0ba64b5c0fc137bf40379bb49b547792038eee73baec9b5
7
+ data.tar.gz: 3b014bab2c44409f4c1c25f3359f7fc8f4ce6d00e7b1c0fcc9ac286f287e91b3309e0b51b3c29720a32668fdae636fb53e94c618e2507b3086b6e47710afa2cd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## Changelog
2
2
 
3
+ #### 1.4.0
4
+ - [new] add `awshark cf save` to save Cloud Formation templates as file
5
+
3
6
  #### 1.3.0
4
7
  - [new] add `awshark ec2 authorize` and `unauthorize`
5
8
 
data/README.md CHANGED
@@ -18,37 +18,46 @@ Use `AWS_PROFILE=PROFILE` and/or `AWS_REGION=REGION` to configure the internal A
18
18
 
19
19
  #### S3 commands
20
20
 
21
- List all S3 buckets
21
+ List all S3 buckets with number of objects and total size.
22
+ (Data depends on AWS Cloudwatch Metrics so there is a time difference to the actual data.)
22
23
  ```
23
24
  awshark s3 list
24
25
  ```
25
26
 
26
- List all objects in a specific S3 bucket
27
+ List all objects in a specific S3 bucket.
27
28
  ```
28
29
  awshark s3 objects BUCKET_NAME fonts/
29
30
  ```
30
31
 
31
32
  #### EC2 commands
32
33
 
33
- List all EC2 instances in a region
34
+ List all EC2 instances in a region.
34
35
  ```
35
36
  awshark ec2 list
36
37
  ```
37
38
 
38
39
  #### ECS commands
39
40
 
40
- List all EC2 instances in a region
41
+ List all ECS services in a region.
41
42
  ```
42
43
  awshark ecs list
43
44
  ```
44
45
 
45
46
  #### Cloud Formation commands
46
47
 
47
- Update (diff) Cloud Formation stack
48
+ Display changes to AWS Cloud Formation stack.
49
+ ```
50
+ awshark cf diff TEMPLATE_PATH --stage=STAGE --bucket=S3_BUCKET.bundesimmo.de
51
+ ```
52
+
53
+ Update or create AWS Cloud Formation stack.
48
54
  ```
49
55
  awshark cf deploy TEMPLATE_PATH --stage=STAGE --bucket=S3_BUCKET.bundesimmo.de
56
+ ```
50
57
 
51
- awshark cf diff TEMPLATE_PATH --stage=STAGE --bucket=S3_BUCKET.bundesimmo.de
58
+ Save AWS Cloud Formation stack as file `STACK_NAME-STAGE.json`.
59
+ ```
60
+ awshark cf save TEMPLATE_PATH --stage=STAGE
52
61
  ```
53
62
 
54
63
  For a further information visit the [Wiki](https://github.com/jdahlke/awshark/wiki).
@@ -46,6 +46,12 @@ module Awshark
46
46
  raise e
47
47
  end
48
48
 
49
+ def save_stack_template
50
+ filename = "#{stack.name}.json"
51
+ File.open(filename, 'w') { |f| f.write(template.body) }
52
+ filename
53
+ end
54
+
49
55
  def tail_stack_events
50
56
  stack.reload
51
57
  stack_events = StackEvents.new(stack)
@@ -63,6 +63,22 @@ module Awshark
63
63
  puts diff
64
64
  end
65
65
 
66
+ desc 'save', 'Save AWS CloudFormation JSON template as file'
67
+ long_desc <<-LONGDESC
68
+ Save AWS CloudFormation JSON template as file TEMPLATE_PATH/cloudformation-stage.json
69
+
70
+ Example: `awshark cf save TEMPLATE_PATH`
71
+ LONGDESC
72
+ def save(template_path)
73
+ process_class_options
74
+
75
+ manager = create_manager(template_path)
76
+ print_stack_information(manager.stack)
77
+
78
+ filename = manager.save_stack_template
79
+ printf "Written CloudFormation JSON template to: %<name>s\n\n", name: filename
80
+ end
81
+
66
82
  private
67
83
 
68
84
  def create_manager(template_path)
@@ -50,7 +50,7 @@ module Awshark
50
50
  desc: 'Security group to allow access to.'
51
51
  option :username,
52
52
  type: :string,
53
- desc: 'Ports to register. Only uses ports from 1 to 65535.'
53
+ desc: 'Optional user name (defaults to whoami).'
54
54
  def authorize
55
55
  process_class_options
56
56
 
@@ -72,7 +72,7 @@ module Awshark
72
72
  desc: 'Security group to remove access from.'
73
73
  option :username,
74
74
  type: :string,
75
- desc: 'Ports to register. Only uses ports from 1 to 65535.'
75
+ desc: 'Optional user name (defaults to whoami).'
76
76
  def unauthorize
77
77
  process_class_options
78
78
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Awshark
4
- VERSION = '1.3.0'
4
+ VERSION = '1.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awshark
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joergen Dahlke
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-10 00:00:00.000000000 Z
11
+ date: 2022-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport