stax 0.1.10 → 0.1.13
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/lib/stax/base.rb +8 -0
- data/lib/stax/mixin/cloudfront.rb +26 -0
- data/lib/stax/version.rb +1 -1
- data/lib/stax.rb +0 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e85e25cdb3b00cb3d721fecd9cfb4c75585da85ee85a43c1710aa1f3a28fe1f
|
4
|
+
data.tar.gz: 3642dc662dbf882a379947896c8eb4aca35f4cfa79cc6d6ce6f36aedc79a84f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bbd391ce012ac900777653d5e55b5fd4b8df8b1af5d5c1832362c8cebb5fc2d9cf9859199703b53530ba68be72feebfab1c1c2baf2fd06f0f6b76b337714e99
|
7
|
+
data.tar.gz: f90ae2c2a413c868991d93909c88d6eb92b28b1bc985238c99b80b4ce11a28aaa30f0367ed0f9d8486ff3d8d9c115504752f6a0ff22c3ee19858cdbb8d625b7e
|
data/lib/stax/base.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'stax/aws/sts'
|
3
|
+
require 'aws-sdk-ssm'
|
3
4
|
|
4
5
|
## clean exit on ctrl-c for all methods
|
5
6
|
trap('SIGINT', 'EXIT')
|
@@ -28,6 +29,13 @@ module Stax
|
|
28
29
|
@_aws_region ||= ENV['AWS_REGION']
|
29
30
|
end
|
30
31
|
|
32
|
+
## we commonly want to lookup SSM parameters to use as stack parameters
|
33
|
+
def aws_ssm_get(name, region: nil)
|
34
|
+
::Aws::SSM::Client.new({region: region}.compact).get_parameter(name: name)&.parameter&.value
|
35
|
+
rescue ::Aws::SSM::Errors::ParameterNotFound
|
36
|
+
fail_task("#{name} not found in #{region||aws_region}")
|
37
|
+
end
|
38
|
+
|
31
39
|
## find or create a stack object
|
32
40
|
def stack(id)
|
33
41
|
c = id.to_s.split(/[_-]/).map(&:capitalize).join # convert symbol to class string
|
@@ -62,6 +62,32 @@ module Stax
|
|
62
62
|
}
|
63
63
|
end
|
64
64
|
end
|
65
|
+
|
66
|
+
## https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/viewing-cloudfront-metrics.html#monitoring-console.distributions-additional
|
67
|
+
## this is not supported by cfn, see:
|
68
|
+
## https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues/545
|
69
|
+
desc 'monitoring', 'control monitoring subscriptions'
|
70
|
+
method_option :enable, aliases: '-e', type: :boolean, description: 'enable additional metrics'
|
71
|
+
method_option :disable, aliases: '-d', type: :boolean, description: 'disable additional metrics'
|
72
|
+
def monitoring
|
73
|
+
client = Aws::Cloudfront.client
|
74
|
+
stack_cloudfront_ids.each do |id|
|
75
|
+
debug("Cloudfront monitoring for distribution #{id}")
|
76
|
+
if options[:enable]
|
77
|
+
sub = { realtime_metrics_subscription_config: { realtime_metrics_subscription_status: :Enabled } }
|
78
|
+
resp = client.create_monitoring_subscription(distribution_id: id, monitoring_subscription: sub)
|
79
|
+
puts resp.monitoring_subscription.realtime_metrics_subscription_config&.realtime_metrics_subscription_status
|
80
|
+
elsif options[:disable]
|
81
|
+
puts 'deleting subscription'
|
82
|
+
client.delete_monitoring_subscription(distribution_id: id)
|
83
|
+
else
|
84
|
+
cfg = client.get_monitoring_subscription(distribution_id: id)&.monitoring_subscription&.realtime_metrics_subscription_config
|
85
|
+
puts "current status: #{cfg&.realtime_metrics_subscription_status}"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
65
90
|
end
|
91
|
+
|
66
92
|
end
|
67
93
|
end
|
data/lib/stax/version.rb
CHANGED
data/lib/stax.rb
CHANGED
@@ -19,27 +19,3 @@ require 'stax/stack/outputs'
|
|
19
19
|
require 'stax/stack/exports'
|
20
20
|
require 'stax/stack/resources'
|
21
21
|
require 'stax/stack/drift'
|
22
|
-
|
23
|
-
require 'stax/mixin/ec2'
|
24
|
-
require 'stax/mixin/alb'
|
25
|
-
require 'stax/mixin/elb'
|
26
|
-
require 'stax/mixin/sg'
|
27
|
-
require 'stax/mixin/s3'
|
28
|
-
require 'stax/mixin/asg'
|
29
|
-
require 'stax/mixin/ecs'
|
30
|
-
require 'stax/mixin/ecr'
|
31
|
-
require 'stax/mixin/sqs'
|
32
|
-
require 'stax/mixin/kms'
|
33
|
-
require 'stax/mixin/ssm'
|
34
|
-
require 'stax/mixin/keypair'
|
35
|
-
require 'stax/mixin/emr'
|
36
|
-
require 'stax/mixin/ssh'
|
37
|
-
require 'stax/mixin/lambda'
|
38
|
-
require 'stax/mixin/dynamodb'
|
39
|
-
require 'stax/mixin/logs'
|
40
|
-
require 'stax/mixin/apigw'
|
41
|
-
require 'stax/mixin/firehose'
|
42
|
-
require 'stax/mixin/codebuild'
|
43
|
-
require 'stax/mixin/codepipeline'
|
44
|
-
require 'stax/mixin/rds'
|
45
|
-
require 'stax/mixin/cloudfront'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Lister
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|