aws_status 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/AwsStatus.rb +20 -0
- data/lib/src/DataCenter.rb +26 -0
- data/lib/src/DataCenters.rb +25 -0
- data/lib/src/OperatingNormallySpecification.rb +7 -0
- data/lib/src/ServiceStatusResponse.rb +39 -0
- data/lib/src/Services.rb +30 -0
- metadata +83 -0
data/lib/AwsStatus.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require_relative './src/DataCenters'
|
3
|
+
|
4
|
+
class AwsStatus
|
5
|
+
attr_reader :status
|
6
|
+
|
7
|
+
def initialize(rest_client)
|
8
|
+
@status = DataCenters.new(rest_client)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.create
|
12
|
+
AwsStatus.new(RestClient)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class RestClient
|
17
|
+
def self.get(uri)
|
18
|
+
HTTParty.get(uri).to_s
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative 'ServiceStatusResponse'
|
2
|
+
|
3
|
+
class DataCenter
|
4
|
+
require_relative 'Services'
|
5
|
+
|
6
|
+
AWS_STATUS_RSS_ROOT = 'http://status.aws.amazon.com/rss'
|
7
|
+
|
8
|
+
def initialize(rest_client, location)
|
9
|
+
@location = location
|
10
|
+
@rest_client = rest_client
|
11
|
+
end
|
12
|
+
|
13
|
+
SERVICES.each do |service_name, rss_name|
|
14
|
+
define_method service_name do
|
15
|
+
status_for rss_name
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def status_for(component)
|
22
|
+
feedHtml = @rest_client.get("#{AWS_STATUS_RSS_ROOT}/#{component}-#{@location}.rss")
|
23
|
+
ServiceStatusResponse.create(feedHtml)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative 'DataCenter'
|
2
|
+
|
3
|
+
class DataCenters
|
4
|
+
DATA_CENTERS = {
|
5
|
+
:eu_west_1 => 'eu-west-1',
|
6
|
+
:eu_central_1 => 'eu-central-1',
|
7
|
+
:us_east_1 => 'us-east-1',
|
8
|
+
:us_west_1 => 'us-west-1',
|
9
|
+
:us_west_2 => 'us-west-2',
|
10
|
+
:sa_east_1 => 'sa-east-1',
|
11
|
+
:ap_northeast_1 => 'ap-northeast-1',
|
12
|
+
:ap_southeast_1 => 'ap-southeast-1',
|
13
|
+
:ap_southeast_2 => 'ap-southeast-2'
|
14
|
+
}
|
15
|
+
|
16
|
+
def initialize(rest_client)
|
17
|
+
@rest_client = rest_client
|
18
|
+
end
|
19
|
+
|
20
|
+
DATA_CENTERS.each do |data_center_name, rss_name|
|
21
|
+
define_method data_center_name do
|
22
|
+
DataCenter.new(@rest_client, rss_name)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'simple-rss'
|
2
|
+
require_relative './OperatingNormallySpecification'
|
3
|
+
|
4
|
+
class ServiceStatusResponse
|
5
|
+
attr_reader :message, :state
|
6
|
+
|
7
|
+
def initialize(message, state)
|
8
|
+
@message = message
|
9
|
+
@state = state
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.create(feedHtml)
|
13
|
+
return NoServiceStatusResponse.new if feedHtml.nil?
|
14
|
+
rssFeed = SimpleRSS.parse(feedHtml)
|
15
|
+
if OperatingNormallySpecification.is_satisified_by? rssFeed.items
|
16
|
+
ServiceOkayResponse.new
|
17
|
+
else
|
18
|
+
ServiceErrorResponse.new(rssFeed.items.first[:title])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class ServiceOkayResponse < ServiceStatusResponse
|
24
|
+
def initialize
|
25
|
+
super(message='Service Operating Normally', state=:okay)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class ServiceErrorResponse < ServiceStatusResponse
|
30
|
+
def initialize(message)
|
31
|
+
super(message, state=:error)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class NoServiceStatusResponse < ServiceStatusResponse
|
36
|
+
def initialize
|
37
|
+
super(message='Cannot retrieve service status', state=:warning)
|
38
|
+
end
|
39
|
+
end
|
data/lib/src/Services.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
SERVICES = {
|
2
|
+
:cloudsearch => 'cloudsearch',
|
3
|
+
:cloudwatch => 'cloudwatch',
|
4
|
+
:dynamodb => 'dynamodb',
|
5
|
+
:elastic_compute_cloud => 'ec2',
|
6
|
+
:elastic_load_balancer => 'elb',
|
7
|
+
:elastic_map_reduce => 'emr',
|
8
|
+
:elasticache => 'elasticache',
|
9
|
+
:glacier => 'glacier',
|
10
|
+
:kinesis => 'kinesis',
|
11
|
+
:redshift => 'redshift',
|
12
|
+
:relational_database_service => 'rds',
|
13
|
+
:simple_email_service => 'ses',
|
14
|
+
:simple_queue_service => 'sqs',
|
15
|
+
:simple_notification_service => 'sns',
|
16
|
+
:simple_storage_service => 's3',
|
17
|
+
:simple_workflow_service => 'swf',
|
18
|
+
:simpledb => 'simpledb',
|
19
|
+
:virtual_private_cloud =>'vpc',
|
20
|
+
:auto_scaling => 'autoscaling',
|
21
|
+
:cloudformation => 'cloudformation',
|
22
|
+
:cloudhsm => 'cloudhsm',
|
23
|
+
:cloudtrail => 'cloudtrail',
|
24
|
+
:config => 'config',
|
25
|
+
:direct_connect => 'directconnect',
|
26
|
+
:elastic_beanstalk => 'elasticbeanstalk',
|
27
|
+
:identity_and_access => 'iam',
|
28
|
+
:key_management_service => 'kms',
|
29
|
+
:storage_gateway => 'storagegateway'
|
30
|
+
}
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aws_status
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- iainjmitchell
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-05-12 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: httparty
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: simple-rss
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description:
|
47
|
+
email: iainjmitchell@gmail.com
|
48
|
+
executables: []
|
49
|
+
extensions: []
|
50
|
+
extra_rdoc_files: []
|
51
|
+
files:
|
52
|
+
- lib/AwsStatus.rb
|
53
|
+
- lib/src/DataCenter.rb
|
54
|
+
- lib/src/DataCenters.rb
|
55
|
+
- lib/src/OperatingNormallySpecification.rb
|
56
|
+
- lib/src/Services.rb
|
57
|
+
- lib/src/ServiceStatusResponse.rb
|
58
|
+
homepage: https://github.com/iainjmitchell/aws_status
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 1.8.23
|
80
|
+
signing_key:
|
81
|
+
specification_version: 3
|
82
|
+
summary: Retrieve status of aws services
|
83
|
+
test_files: []
|