cloud-mu 2.0.0.pre.alpha9 → 2.0.0.pre.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Berksfile.lock +1 -1
- data/README.md +2 -0
- data/bin/mu-configure +2 -58
- data/bin/mu-gen-docs +29 -4
- data/bin/mu-load-config.rb +0 -1
- data/bin/mu-user-manage +4 -0
- data/cloud-mu.gemspec +2 -2
- data/cookbooks/mu-master/recipes/default.rb +3 -4
- data/cookbooks/mu-master/recipes/init.rb +3 -3
- data/cookbooks/mu-tools/files/default/Mu_CA.pem +15 -15
- data/cookbooks/mu-tools/libraries/helper.rb +1 -1
- data/cookbooks/mu-tools/recipes/eks.rb +3 -3
- data/cookbooks/mu-tools/recipes/set_local_fw.rb +1 -1
- data/cookbooks/mu-utility/recipes/remi.rb +1 -1
- data/cookbooks/nagios/libraries/base.rb +4 -4
- data/cookbooks/nagios/libraries/contact.rb +1 -1
- data/cookbooks/nagios/libraries/contactgroup.rb +1 -1
- data/cookbooks/nagios/libraries/host.rb +2 -2
- data/cookbooks/nagios/libraries/hostdependency.rb +3 -3
- data/cookbooks/nagios/libraries/hostescalation.rb +3 -3
- data/cookbooks/nagios/libraries/hostgroup.rb +2 -2
- data/cookbooks/nagios/libraries/nagios.rb +5 -5
- data/cookbooks/nagios/libraries/service.rb +3 -3
- data/cookbooks/nagios/libraries/servicedependency.rb +2 -2
- data/cookbooks/nagios/libraries/serviceescalation.rb +2 -2
- data/cookbooks/nagios/libraries/servicegroup.rb +2 -2
- data/cookbooks/nagios/libraries/timeperiod.rb +1 -1
- data/install/installer +1 -1
- data/modules/mu/cleanup.rb +1 -1
- data/modules/mu/cloud.rb +43 -1
- data/modules/mu/clouds/aws.rb +55 -35
- data/modules/mu/clouds/aws/bucket.rb +287 -0
- data/modules/mu/clouds/aws/database.rb +65 -11
- data/modules/mu/clouds/aws/endpoint.rb +592 -0
- data/modules/mu/clouds/aws/firewall_rule.rb +4 -0
- data/modules/mu/clouds/aws/function.rb +138 -93
- data/modules/mu/clouds/aws/nosqldb.rb +387 -0
- data/modules/mu/clouds/aws/role.rb +1 -1
- data/modules/mu/clouds/aws/server.rb +5 -5
- data/modules/mu/clouds/aws/server_pool.rb +60 -3
- data/modules/mu/clouds/azure.rb +0 -1
- data/modules/mu/clouds/google.rb +34 -12
- data/modules/mu/clouds/google/bucket.rb +179 -0
- data/modules/mu/config.rb +1 -1
- data/modules/mu/config/bucket.rb +69 -0
- data/modules/mu/config/bucket.yml +10 -0
- data/modules/mu/config/database.rb +1 -1
- data/modules/mu/config/endpoint.rb +71 -0
- data/modules/mu/config/function.rb +6 -0
- data/modules/mu/config/nosqldb.rb +49 -0
- data/modules/mu/config/nosqldb.yml +44 -0
- data/modules/mu/config/notifier.yml +2 -2
- data/modules/mu/config/vpc.rb +0 -1
- data/modules/mu/defaults/amazon_images.yaml +32 -30
- data/modules/mu/groomers/chef.rb +1 -1
- data/modules/mu/kittens.rb +2430 -1511
- data/modules/mu/master/ldap.rb +1 -1
- data/modules/tests/super_complex_bok.yml +7 -0
- data/modules/tests/super_simple_bok.yml +7 -0
- metadata +11 -2
@@ -116,7 +116,7 @@ class Nagios
|
|
116
116
|
@escalation_period = nil if @escalation_period == obj
|
117
117
|
end
|
118
118
|
end
|
119
|
-
|
119
|
+
|
120
120
|
|
121
121
|
def to_s
|
122
122
|
host_description
|
@@ -160,7 +160,7 @@ class Nagios
|
|
160
160
|
'register' => 'register',
|
161
161
|
}
|
162
162
|
end
|
163
|
-
|
163
|
+
|
164
164
|
|
165
165
|
def merge_members(obj)
|
166
166
|
obj.contacts.each { |m| push(m) }
|
@@ -170,4 +170,4 @@ class Nagios
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
end
|
173
|
-
|
173
|
+
|
@@ -83,7 +83,7 @@ class Nagios
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
|
88
88
|
def self.create(name)
|
89
89
|
Nagios.instance.find(Nagios::Hostgroup.new(name))
|
@@ -109,7 +109,7 @@ class Nagios
|
|
109
109
|
'register' => 'register',
|
110
110
|
}
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
|
114
114
|
def merge_members(obj)
|
115
115
|
obj.members.each { |m| push(m) }
|
@@ -64,7 +64,7 @@ class Nagios
|
|
64
64
|
@host_name_attribute = 'hostname'
|
65
65
|
@normalize_hostname = false
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
|
69
69
|
def commands
|
70
70
|
Hash[@commands.sort]
|
@@ -108,7 +108,7 @@ class Nagios
|
|
108
108
|
@resources.delete(key)
|
109
109
|
end
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
112
|
|
113
113
|
def find(obj)
|
114
114
|
case obj
|
@@ -136,7 +136,7 @@ class Nagios
|
|
136
136
|
find_object(obj, @resources)
|
137
137
|
end
|
138
138
|
end
|
139
|
-
|
139
|
+
|
140
140
|
|
141
141
|
def hosts
|
142
142
|
Hash[@hosts.sort]
|
@@ -189,7 +189,7 @@ class Nagios
|
|
189
189
|
raise
|
190
190
|
end
|
191
191
|
end
|
192
|
-
|
192
|
+
|
193
193
|
|
194
194
|
def timeperiods
|
195
195
|
Hash[@timeperiods.sort]
|
@@ -273,7 +273,7 @@ class Nagios
|
|
273
273
|
host.push(hg)
|
274
274
|
end
|
275
275
|
end
|
276
|
-
|
276
|
+
|
277
277
|
|
278
278
|
def push_object(obj)
|
279
279
|
object = find(obj.class.new(obj.to_s))
|
@@ -83,7 +83,7 @@ class Nagios
|
|
83
83
|
@custom_options = {}
|
84
84
|
super()
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
|
88
88
|
def check_command
|
89
89
|
if blank?(@arguments)
|
@@ -236,7 +236,7 @@ class Nagios
|
|
236
236
|
end
|
237
237
|
end
|
238
238
|
end
|
239
|
-
|
239
|
+
|
240
240
|
|
241
241
|
# servicegroups
|
242
242
|
# This directive is used to define the description of the service, which may contain spaces,
|
@@ -441,7 +441,7 @@ class Nagios
|
|
441
441
|
'register' => 'register',
|
442
442
|
}
|
443
443
|
end
|
444
|
-
|
444
|
+
|
445
445
|
|
446
446
|
def merge_members(obj)
|
447
447
|
obj.contacts.each { |m| push(m) }
|
@@ -145,7 +145,7 @@ class Nagios
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
148
|
-
|
148
|
+
|
149
149
|
|
150
150
|
def push_dependency(obj)
|
151
151
|
case obj
|
@@ -201,7 +201,7 @@ class Nagios
|
|
201
201
|
'notification_failure_criteria' => 'notification_failure_criteria',
|
202
202
|
}
|
203
203
|
end
|
204
|
-
|
204
|
+
|
205
205
|
|
206
206
|
def merge_members(obj)
|
207
207
|
obj.host_name.each { |m| push(m) }
|
@@ -135,7 +135,7 @@ class Nagios
|
|
135
135
|
@escalation_period = nil if @escalation_period == obj
|
136
136
|
end
|
137
137
|
end
|
138
|
-
|
138
|
+
|
139
139
|
|
140
140
|
def to_s
|
141
141
|
service_description
|
@@ -182,7 +182,7 @@ class Nagios
|
|
182
182
|
'register' => 'register',
|
183
183
|
}
|
184
184
|
end
|
185
|
-
|
185
|
+
|
186
186
|
|
187
187
|
def merge_members(obj)
|
188
188
|
obj.contacts.each { |m| push(m) }
|
@@ -80,7 +80,7 @@ class Nagios
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
83
|
-
|
83
|
+
|
84
84
|
|
85
85
|
def self.create(name)
|
86
86
|
Nagios.instance.find(Nagios::Servicegroup.new(name))
|
@@ -134,7 +134,7 @@ class Nagios
|
|
134
134
|
end
|
135
135
|
convert_hostgroup_hash(hostgroup_hash)
|
136
136
|
end
|
137
|
-
|
137
|
+
|
138
138
|
|
139
139
|
def merge_members(obj)
|
140
140
|
obj.members.each { |m| push(m) }
|
data/install/installer
CHANGED
@@ -4,7 +4,7 @@ BOLD=`tput bold`
|
|
4
4
|
NORM=`tput sgr0`
|
5
5
|
CHEF_CLIENT_VERSION="14.4.56"
|
6
6
|
if [ "$MU_BRANCH" == "" ];then
|
7
|
-
MU_BRANCH="
|
7
|
+
MU_BRANCH="master"
|
8
8
|
mydir="`dirname $0`"
|
9
9
|
cd $mydir
|
10
10
|
if git rev-parse --abbrev-ref HEAD > /dev/null 2>&1;then
|
data/modules/mu/cleanup.rb
CHANGED
@@ -61,7 +61,7 @@ module MU
|
|
61
61
|
end
|
62
62
|
|
63
63
|
|
64
|
-
types_in_order = ["Collection", "Function", "ServerPool", "ContainerCluster", "SearchDomain", "Server", "MsgQueue", "Database", "CacheCluster", "StoragePool", "LoadBalancer", "FirewallRule", "Alarm", "Notifier", "Log", "VPC", "DNSZone", "Collection", "Habitat"]
|
64
|
+
types_in_order = ["Collection", "Endpoint", "Function", "ServerPool", "ContainerCluster", "SearchDomain", "Server", "MsgQueue", "Database", "CacheCluster", "StoragePool", "LoadBalancer", "NoSQLDB", "FirewallRule", "Alarm", "Notifier", "Log", "VPC", "Role", "Group", "User", "Bucket", "DNSZone", "Collection", "Habitat"]
|
65
65
|
|
66
66
|
# Load up our deployment metadata
|
67
67
|
if !mommacat.nil?
|
data/modules/mu/cloud.rb
CHANGED
@@ -116,6 +116,15 @@ module MU
|
|
116
116
|
# Stub base class; real implementations generated at runtime
|
117
117
|
class Role;
|
118
118
|
end
|
119
|
+
# Stub base class; real implementations generated at runtime
|
120
|
+
class Endpoint;
|
121
|
+
end
|
122
|
+
# Stub base class; real implementations generated at runtime
|
123
|
+
class Bucket;
|
124
|
+
end
|
125
|
+
# Stub base class; real implementations generated at runtime
|
126
|
+
class NoSQLDB;
|
127
|
+
end
|
119
128
|
|
120
129
|
# The types of cloud resources we can create, as class objects. Include
|
121
130
|
# methods a class implementing this resource type must support to be
|
@@ -273,7 +282,18 @@ module MU
|
|
273
282
|
:deps_wait_on_my_creation => true,
|
274
283
|
:waits_on_parent_completion => false,
|
275
284
|
:class => generic_class_methods,
|
276
|
-
:instance => generic_instance_methods
|
285
|
+
:instance => generic_instance_methods + [:groom]
|
286
|
+
},
|
287
|
+
:Endpoint => {
|
288
|
+
:has_multiples => false,
|
289
|
+
:can_live_in_vpc => true,
|
290
|
+
:cfg_name => "endpoint",
|
291
|
+
:cfg_plural => "endpoints",
|
292
|
+
:interface => self.const_get("Endpoint"),
|
293
|
+
:deps_wait_on_my_creation => true,
|
294
|
+
:waits_on_parent_completion => false,
|
295
|
+
:class => generic_class_methods,
|
296
|
+
:instance => generic_instance_methods + [:groom]
|
277
297
|
},
|
278
298
|
:ContainerCluster => {
|
279
299
|
:has_multiples => false,
|
@@ -362,6 +382,28 @@ module MU
|
|
362
382
|
:waits_on_parent_completion => true,
|
363
383
|
:class => generic_class_methods,
|
364
384
|
:instance => generic_instance_methods + [:groom]
|
385
|
+
},
|
386
|
+
:Bucket => {
|
387
|
+
:has_multiples => false,
|
388
|
+
:can_live_in_vpc => false,
|
389
|
+
:cfg_name => "bucket",
|
390
|
+
:cfg_plural => "buckets",
|
391
|
+
:interface => self.const_get("Bucket"),
|
392
|
+
:deps_wait_on_my_creation => true,
|
393
|
+
:waits_on_parent_completion => true,
|
394
|
+
:class => generic_class_methods,
|
395
|
+
:instance => generic_instance_methods + [:groom]
|
396
|
+
},
|
397
|
+
:NoSQLDB => {
|
398
|
+
:has_multiples => false,
|
399
|
+
:can_live_in_vpc => false,
|
400
|
+
:cfg_name => "nosqldb",
|
401
|
+
:cfg_plural => "nosqldbs",
|
402
|
+
:interface => self.const_get("NoSQLDB"),
|
403
|
+
:deps_wait_on_my_creation => true,
|
404
|
+
:waits_on_parent_completion => true,
|
405
|
+
:class => generic_class_methods,
|
406
|
+
:instance => generic_instance_methods + [:groom]
|
365
407
|
}
|
366
408
|
}.freeze
|
367
409
|
|
data/modules/mu/clouds/aws.rb
CHANGED
@@ -151,6 +151,9 @@ module MU
|
|
151
151
|
return nil
|
152
152
|
end
|
153
153
|
|
154
|
+
# Given an AWS region, check the API to make sure it's a valid one
|
155
|
+
# @param r [String]
|
156
|
+
# @return [String]
|
154
157
|
def self.validate_region(r)
|
155
158
|
MU::Cloud::AWS.ec2(region: r).describe_availability_zones.availability_zones.first.region_name
|
156
159
|
end
|
@@ -406,12 +409,20 @@ module MU
|
|
406
409
|
$MU_CFG['aws'].keys
|
407
410
|
end
|
408
411
|
|
412
|
+
# Resolve the administrative S3 bucket for a given credential set, or
|
413
|
+
# return a default.
|
414
|
+
# @param credentials [String]
|
415
|
+
# @return [String]
|
409
416
|
def self.adminBucketName(credentials = nil)
|
410
417
|
#XXX find a default if this particular account doesn't have a log_bucket_name configured
|
411
418
|
cfg = credConfig(credentials)
|
412
419
|
cfg['log_bucket_name']
|
413
420
|
end
|
414
421
|
|
422
|
+
# Resolve the administrative S3 bucket for a given credential set, or
|
423
|
+
# return a default.
|
424
|
+
# @param credentials [String]
|
425
|
+
# @return [String]
|
415
426
|
def self.adminBucketUrl(credentials = nil)
|
416
427
|
"s3://"+adminBucketName+"/"
|
417
428
|
end
|
@@ -716,13 +727,13 @@ module MU
|
|
716
727
|
def self.acm(region: MU.curRegion, credentials: nil)
|
717
728
|
region ||= myRegion
|
718
729
|
@@acm_api[credentials] ||= {}
|
719
|
-
@@acm_api[credentials][region] ||= MU::Cloud::AWS::
|
730
|
+
@@acm_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "ACM", region: region, credentials: credentials)
|
720
731
|
@@acm_api[credentials][region]
|
721
732
|
end
|
722
733
|
|
723
734
|
# Amazon's IAM API
|
724
735
|
def self.iam(credentials: nil)
|
725
|
-
@@iam_api[credentials] ||= MU::Cloud::AWS::
|
736
|
+
@@iam_api[credentials] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "IAM", credentials: credentials)
|
726
737
|
@@iam_api[credentials]
|
727
738
|
end
|
728
739
|
|
@@ -730,7 +741,7 @@ module MU
|
|
730
741
|
def self.ec2(region: MU.curRegion, credentials: nil)
|
731
742
|
region ||= myRegion
|
732
743
|
@@ec2_api[credentials] ||= {}
|
733
|
-
@@ec2_api[credentials][region] ||= MU::Cloud::AWS::
|
744
|
+
@@ec2_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "EC2", region: region, credentials: credentials)
|
734
745
|
@@ec2_api[credentials][region]
|
735
746
|
end
|
736
747
|
|
@@ -738,7 +749,7 @@ module MU
|
|
738
749
|
def self.autoscale(region: MU.curRegion, credentials: nil)
|
739
750
|
region ||= myRegion
|
740
751
|
@@autoscale_api[credentials] ||= {}
|
741
|
-
@@autoscale_api[credentials][region] ||= MU::Cloud::AWS::
|
752
|
+
@@autoscale_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "AutoScaling", region: region, credentials: credentials)
|
742
753
|
@@autoscale_api[credentials][region]
|
743
754
|
end
|
744
755
|
|
@@ -746,7 +757,7 @@ module MU
|
|
746
757
|
def self.elb(region: MU.curRegion, credentials: nil)
|
747
758
|
region ||= myRegion
|
748
759
|
@@elb_api[credentials] ||= {}
|
749
|
-
@@elb_api[credentials][region] ||= MU::Cloud::AWS::
|
760
|
+
@@elb_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "ElasticLoadBalancing", region: region, credentials: credentials)
|
750
761
|
@@elb_api[credentials][region]
|
751
762
|
end
|
752
763
|
|
@@ -754,13 +765,13 @@ module MU
|
|
754
765
|
def self.elb2(region: MU.curRegion, credentials: nil)
|
755
766
|
region ||= myRegion
|
756
767
|
@@elb2_api[credentials] ||= {}
|
757
|
-
@@elb2_api[credentials][region] ||= MU::Cloud::AWS::
|
768
|
+
@@elb2_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "ElasticLoadBalancingV2", region: region, credentials: credentials)
|
758
769
|
@@elb2_api[credentials][region]
|
759
770
|
end
|
760
771
|
|
761
772
|
# Amazon's Route53 API
|
762
773
|
def self.route53(credentials: nil)
|
763
|
-
@@route53_api[credentials] ||= MU::Cloud::AWS::
|
774
|
+
@@route53_api[credentials] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "Route53", credentials: credentials)
|
764
775
|
@@route53_api[credentials]
|
765
776
|
end
|
766
777
|
|
@@ -768,7 +779,7 @@ module MU
|
|
768
779
|
def self.rds(region: MU.curRegion, credentials: nil)
|
769
780
|
region ||= myRegion
|
770
781
|
@@rds_api[credentials] ||= {}
|
771
|
-
@@rds_api[credentials][region] ||= MU::Cloud::AWS::
|
782
|
+
@@rds_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "RDS", region: region, credentials: credentials)
|
772
783
|
@@rds_api[credentials][region]
|
773
784
|
end
|
774
785
|
|
@@ -776,7 +787,7 @@ module MU
|
|
776
787
|
def self.cloudformation(region: MU.curRegion, credentials: nil)
|
777
788
|
region ||= myRegion
|
778
789
|
@@cloudformation_api[credentials] ||= {}
|
779
|
-
@@cloudformation_api[credentials][region] ||= MU::Cloud::AWS::
|
790
|
+
@@cloudformation_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "CloudFormation", region: region, credentials: credentials)
|
780
791
|
@@cloudformation_api[credentials][region]
|
781
792
|
end
|
782
793
|
|
@@ -784,7 +795,7 @@ module MU
|
|
784
795
|
def self.s3(region: MU.curRegion, credentials: nil)
|
785
796
|
region ||= myRegion
|
786
797
|
@@s3_api[credentials] ||= {}
|
787
|
-
@@s3_api[credentials][region] ||= MU::Cloud::AWS::
|
798
|
+
@@s3_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "S3", region: region, credentials: credentials)
|
788
799
|
@@s3_api[credentials][region]
|
789
800
|
end
|
790
801
|
|
@@ -792,7 +803,7 @@ module MU
|
|
792
803
|
def self.cloudtrail(region: MU.curRegion, credentials: nil)
|
793
804
|
region ||= myRegion
|
794
805
|
@@cloudtrail_api[credentials] ||= {}
|
795
|
-
@@cloudtrail_api[credentials][region] ||= MU::Cloud::AWS::
|
806
|
+
@@cloudtrail_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "CloudTrail", region: region, credentials: credentials)
|
796
807
|
@@cloudtrail_api[credentials][region]
|
797
808
|
end
|
798
809
|
|
@@ -800,7 +811,7 @@ module MU
|
|
800
811
|
def self.cloudwatch(region: MU.curRegion, credentials: nil)
|
801
812
|
region ||= myRegion
|
802
813
|
@@cloudwatch_api[credentials] ||= {}
|
803
|
-
@@cloudwatch_api[credentials][region] ||= MU::Cloud::AWS::
|
814
|
+
@@cloudwatch_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "CloudWatch", region: region, credentials: credentials)
|
804
815
|
@@cloudwatch_api[credentials][region]
|
805
816
|
end
|
806
817
|
|
@@ -808,7 +819,7 @@ module MU
|
|
808
819
|
def self.wafglobal(region: MU.curRegion, credentials: nil)
|
809
820
|
region ||= myRegion
|
810
821
|
@@wafglobal_api[credentials] ||= {}
|
811
|
-
@@wafglobal[credentials][region] ||= MU::Cloud::AWS::
|
822
|
+
@@wafglobal[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "WAF", region: region, credentials: credentials)
|
812
823
|
@@wafglobal[credentials][region]
|
813
824
|
end
|
814
825
|
|
@@ -817,7 +828,7 @@ module MU
|
|
817
828
|
def self.waf(region: MU.curRegion, credentials: nil)
|
818
829
|
region ||= myRegion
|
819
830
|
@@waf[credentials] ||= {}
|
820
|
-
@@waf[credentials][region] ||= MU::Cloud::AWS::
|
831
|
+
@@waf[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "WAFRegional", region: region, credentials: credentials)
|
821
832
|
@@waf[credentials][region]
|
822
833
|
end
|
823
834
|
|
@@ -825,7 +836,7 @@ module MU
|
|
825
836
|
def self.cloudwatchlogs(region: MU.curRegion, credentials: nil)
|
826
837
|
region ||= myRegion
|
827
838
|
@@cloudwatchlogs_api[credentials] ||= {}
|
828
|
-
@@cloudwatchlogs_api[credentials][region] ||= MU::Cloud::AWS::
|
839
|
+
@@cloudwatchlogs_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "CloudWatchLogs", region: region, credentials: credentials)
|
829
840
|
@@cloudwatchlogs_api[credentials][region]
|
830
841
|
end
|
831
842
|
|
@@ -833,7 +844,7 @@ module MU
|
|
833
844
|
def self.cloudfront(region: MU.curRegion, credentials: nil)
|
834
845
|
region ||= myRegion
|
835
846
|
@@cloudfront_api[credentials] ||= {}
|
836
|
-
@@cloudfront_api[credentials][region] ||= MU::Cloud::AWS::
|
847
|
+
@@cloudfront_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "CloudFront", region: region, credentials: credentials)
|
837
848
|
@@cloudfront_api[credentials][region]
|
838
849
|
end
|
839
850
|
|
@@ -841,7 +852,7 @@ module MU
|
|
841
852
|
def self.elasticache(region: MU.curRegion, credentials: nil)
|
842
853
|
region ||= myRegion
|
843
854
|
@@elasticache_api[credentials] ||= {}
|
844
|
-
@@elasticache_api[credentials][region] ||= MU::Cloud::AWS::
|
855
|
+
@@elasticache_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "ElastiCache", region: region, credentials: credentials)
|
845
856
|
@@elasticache_api[credentials][region]
|
846
857
|
end
|
847
858
|
|
@@ -849,7 +860,7 @@ module MU
|
|
849
860
|
def self.sns(region: MU.curRegion, credentials: nil)
|
850
861
|
region ||= myRegion
|
851
862
|
@@sns_api[credentials] ||= {}
|
852
|
-
@@sns_api[credentials][region] ||= MU::Cloud::AWS::
|
863
|
+
@@sns_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "SNS", region: region, credentials: credentials)
|
853
864
|
@@sns_api[credentials][region]
|
854
865
|
end
|
855
866
|
|
@@ -857,7 +868,7 @@ module MU
|
|
857
868
|
def self.sqs(region: MU.curRegion, credentials: nil)
|
858
869
|
region ||= myRegion
|
859
870
|
@@sqs_api[credentials] ||= {}
|
860
|
-
@@sqs_api[credentials][region] ||= MU::Cloud::AWS::
|
871
|
+
@@sqs_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "SQS", region: region, credentials: credentials)
|
861
872
|
@@sqs_api[credentials][region]
|
862
873
|
end
|
863
874
|
|
@@ -865,7 +876,7 @@ module MU
|
|
865
876
|
def self.efs(region: MU.curRegion, credentials: nil)
|
866
877
|
region ||= myRegion
|
867
878
|
@@efs_api[credentials] ||= {}
|
868
|
-
@@efs_api[credentials][region] ||= MU::Cloud::AWS::
|
879
|
+
@@efs_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "EFS", region: region, credentials: credentials)
|
869
880
|
@@efs_api[credentials][region]
|
870
881
|
end
|
871
882
|
|
@@ -873,7 +884,7 @@ module MU
|
|
873
884
|
def self.lambda(region: MU.curRegion, credentials: nil)
|
874
885
|
region ||= myRegion
|
875
886
|
@@lambda_api[credentials] ||= {}
|
876
|
-
@@lambda_api[credentials][region] ||= MU::Cloud::AWS::
|
887
|
+
@@lambda_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "Lambda", region: region, credentials: credentials)
|
877
888
|
@@lambda_api[credentials][region]
|
878
889
|
end
|
879
890
|
|
@@ -881,7 +892,7 @@ module MU
|
|
881
892
|
def self.apig(region: MU.curRegion, credentials: nil)
|
882
893
|
region ||= myRegion
|
883
894
|
@@apig_api[credentials] ||= {}
|
884
|
-
@@apig_api[credentials][region] ||= MU::Cloud::AWS::
|
895
|
+
@@apig_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "APIGateway", region: region, credentials: credentials)
|
885
896
|
@@apig_api[credentials][region]
|
886
897
|
end
|
887
898
|
|
@@ -889,7 +900,7 @@ module MU
|
|
889
900
|
def self.cloudwatch_events(region = MU.cureRegion)
|
890
901
|
region ||= myRegion
|
891
902
|
@@cloudwatch_events_api[credentials] ||= {}
|
892
|
-
@@cloudwatch_events_api[credentials][region] ||= MU::Cloud::AWS::
|
903
|
+
@@cloudwatch_events_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "CloudWatchEvents", region: region, credentials: credentials)
|
893
904
|
@@cloudwatch_events_api
|
894
905
|
end
|
895
906
|
|
@@ -897,7 +908,7 @@ module MU
|
|
897
908
|
def self.ecs(region: MU.curRegion, credentials: nil)
|
898
909
|
region ||= myRegion
|
899
910
|
@@ecs_api[credentials] ||= {}
|
900
|
-
@@ecs_api[credentials][region] ||= MU::Cloud::AWS::
|
911
|
+
@@ecs_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "ECS", region: region, credentials: credentials)
|
901
912
|
@@ecs_api[credentials][region]
|
902
913
|
end
|
903
914
|
|
@@ -905,15 +916,23 @@ module MU
|
|
905
916
|
def self.eks(region: MU.curRegion, credentials: nil)
|
906
917
|
region ||= myRegion
|
907
918
|
@@eks_api[credentials] ||= {}
|
908
|
-
@@eks_api[credentials][region] ||= MU::Cloud::AWS::
|
919
|
+
@@eks_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "EKS", region: region, credentials: credentials)
|
909
920
|
@@eks_api[credentials][region]
|
910
921
|
end
|
911
922
|
|
923
|
+
# Amazon's DynamoDB API
|
924
|
+
def self.dynamo(region: MU.curRegion, credentials: nil)
|
925
|
+
region ||= myRegion
|
926
|
+
@@dynamo_api[credentials] ||= {}
|
927
|
+
@@dynamo_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "DynamoDB", region: region, credentials: credentials)
|
928
|
+
@@dynamo_api[credentials][region]
|
929
|
+
end
|
930
|
+
|
912
931
|
# Amazon's Pricing API
|
913
932
|
def self.pricing(region: MU.curRegion, credentials: nil)
|
914
933
|
region ||= myRegion
|
915
934
|
@@pricing_api[credentials] ||= {}
|
916
|
-
@@pricing_api[credentials][region] ||= MU::Cloud::AWS::
|
935
|
+
@@pricing_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "Pricing", region: region, credentials: credentials)
|
917
936
|
@@pricing_api[credentials][region]
|
918
937
|
end
|
919
938
|
|
@@ -921,7 +940,7 @@ module MU
|
|
921
940
|
def self.ssm(region: MU.curRegion, credentials: nil)
|
922
941
|
region ||= myRegion
|
923
942
|
@@ssm_api[credentials] ||= {}
|
924
|
-
@@ssm_api[credentials][region] ||= MU::Cloud::AWS::
|
943
|
+
@@ssm_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "SSM", region: region, credentials: credentials)
|
925
944
|
@@ssm_api[credentials][region]
|
926
945
|
end
|
927
946
|
|
@@ -929,7 +948,7 @@ module MU
|
|
929
948
|
def self.elasticsearch(region: MU.curRegion, credentials: nil)
|
930
949
|
region ||= myRegion
|
931
950
|
@@elasticsearch_api[credentials] ||= {}
|
932
|
-
@@elasticsearch_api[credentials][region] ||= MU::Cloud::AWS::
|
951
|
+
@@elasticsearch_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "ElasticsearchService", region: region, credentials: credentials)
|
933
952
|
@@elasticsearch_api[credentials][region]
|
934
953
|
end
|
935
954
|
|
@@ -937,7 +956,7 @@ module MU
|
|
937
956
|
def self.cognito_ident(region: MU.curRegion, credentials: nil)
|
938
957
|
region ||= myRegion
|
939
958
|
@@cognito_ident_api[credentials] ||= {}
|
940
|
-
@@cognito_ident_api[credentials][region] ||= MU::Cloud::AWS::
|
959
|
+
@@cognito_ident_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "CognitoIdentity", region: region, credentials: credentials)
|
941
960
|
@@cognito_ident_api[credentials][region]
|
942
961
|
end
|
943
962
|
|
@@ -945,7 +964,7 @@ module MU
|
|
945
964
|
def self.cognito_user(region: MU.curRegion, credentials: nil)
|
946
965
|
region ||= myRegion
|
947
966
|
@@cognito_user_api[credentials] ||= {}
|
948
|
-
@@cognito_user_api[credentials][region] ||= MU::Cloud::AWS::
|
967
|
+
@@cognito_user_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "CognitoIdentityProvider", region: region, credentials: credentials)
|
949
968
|
@@cognito_user_api[credentials][region]
|
950
969
|
end
|
951
970
|
|
@@ -953,7 +972,7 @@ module MU
|
|
953
972
|
def self.kms(region: MU.curRegion, credentials: nil)
|
954
973
|
region ||= myRegion
|
955
974
|
@@kms_api[credentials] ||= {}
|
956
|
-
@@kms_api[credentials][region] ||= MU::Cloud::AWS::
|
975
|
+
@@kms_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "KMS", region: region, credentials: credentials)
|
957
976
|
@@kms_api[credentials][region]
|
958
977
|
end
|
959
978
|
|
@@ -961,7 +980,7 @@ module MU
|
|
961
980
|
def self.orgs(credentials: nil)
|
962
981
|
@@organizations_api ||= {}
|
963
982
|
# XXX org api doesn't seem to work in many regions
|
964
|
-
@@organizations_api[credentials] ||= MU::Cloud::AWS::
|
983
|
+
@@organizations_api[credentials] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "Organizations", credentials: credentials, region: "us-east-1")
|
965
984
|
@@organizations_api[credentials]
|
966
985
|
end
|
967
986
|
|
@@ -1154,7 +1173,7 @@ module MU
|
|
1154
1173
|
|
1155
1174
|
# Wrapper class for the EC2 API, so that we can catch some common transient
|
1156
1175
|
# endpoint errors without having to spray rescues all over the codebase.
|
1157
|
-
class
|
1176
|
+
class AmazonEndpoint
|
1158
1177
|
@api = nil
|
1159
1178
|
@region = nil
|
1160
1179
|
@cred_obj = nil
|
@@ -1204,7 +1223,7 @@ module MU
|
|
1204
1223
|
retval = @api.method(method_sym).call
|
1205
1224
|
end
|
1206
1225
|
return retval
|
1207
|
-
rescue Aws::EC2::Errors::InternalError, Aws::EC2::Errors::RequestLimitExceeded, Aws::EC2::Errors::Unavailable, Aws::Route53::Errors::Throttling, Aws::ElasticLoadBalancing::Errors::HttpFailureException, Aws::EC2::Errors::Http503Error, Aws::AutoScaling::Errors::Http503Error, Aws::AutoScaling::Errors::InternalFailure, Aws::AutoScaling::Errors::ServiceUnavailable, Aws::Route53::Errors::ServiceUnavailable, Aws::ElasticLoadBalancing::Errors::Throttling, Aws::RDS::Errors::ClientUnavailable, Aws::Waiters::Errors::UnexpectedError, Aws::ElasticLoadBalancing::Errors::ServiceUnavailable, Aws::ElasticLoadBalancingV2::Errors::Throttling, Seahorse::Client::NetworkingError, Aws::IAM::Errors::Throttling, Aws::EFS::Errors::ThrottlingException, Aws::Pricing::Errors::ThrottlingException => e
|
1226
|
+
rescue Aws::EC2::Errors::InternalError, Aws::EC2::Errors::RequestLimitExceeded, Aws::EC2::Errors::Unavailable, Aws::Route53::Errors::Throttling, Aws::ElasticLoadBalancing::Errors::HttpFailureException, Aws::EC2::Errors::Http503Error, Aws::AutoScaling::Errors::Http503Error, Aws::AutoScaling::Errors::InternalFailure, Aws::AutoScaling::Errors::ServiceUnavailable, Aws::Route53::Errors::ServiceUnavailable, Aws::ElasticLoadBalancing::Errors::Throttling, Aws::RDS::Errors::ClientUnavailable, Aws::Waiters::Errors::UnexpectedError, Aws::ElasticLoadBalancing::Errors::ServiceUnavailable, Aws::ElasticLoadBalancingV2::Errors::Throttling, Seahorse::Client::NetworkingError, Aws::IAM::Errors::Throttling, Aws::EFS::Errors::ThrottlingException, Aws::Pricing::Errors::ThrottlingException, Aws::APIGateway::Errors::TooManyRequestsException => e
|
1208
1227
|
if e.class.name == "Seahorse::Client::NetworkingError" and e.message.match(/Name or service not known/)
|
1209
1228
|
MU.log e.inspect, MU::ERR
|
1210
1229
|
raise e
|
@@ -1262,7 +1281,8 @@ module MU
|
|
1262
1281
|
@@cognito_ident_api ={}
|
1263
1282
|
@@cognito_user_api ={}
|
1264
1283
|
@@kms_api ={}
|
1265
|
-
@@
|
1284
|
+
@@organization_api ={}
|
1285
|
+
@@dynamo_api ={}
|
1266
1286
|
end
|
1267
1287
|
end
|
1268
1288
|
end
|