vzcdn 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/MockHttpResponse +6 -0
- data/lib/common.rb +22 -47
- data/lib/config_handler.rb +14 -3
- data/lib/http_send.rb +110 -0
- data/lib/method.rb +24 -3
- data/lib/mock_http_send.rb +15 -0
- data/lib/print.rb +5 -0
- data/lib/proxy_credentials.rb +5 -13
- data/lib/reporting.rb +105 -89
- data/lib/vzcdn.rb +16 -0
- data/lib/vzcdn/version.rb +1 -1
- data/lib/zone_update.rb +39 -0
- data/test/bad-credentials.mock +9 -0
- data/test/bad-credentials.results +8 -0
- data/test/create_delete.mock +72 -0
- data/test/crud.mock +44 -0
- data/test/crud.results +50 -0
- data/test/initial.mock +58 -0
- data/test/initial.results +308 -0
- data/test/mk_mock.rb +24 -0
- data/test/mk_response.rb +41 -0
- data/test/push.mock +58 -0
- data/test/test_clui.rb +34 -15
- data/test/test_mock.rb +282 -0
- data/test/test_reporting.rb +48 -47
- data/test/unreachable.mock +9 -0
- data/test/unreachable.results +8 -0
- data/vzcdn.gemspec +0 -2
- metadata +31 -19
- data/pkg/vzcdn-0.0.1.gem +0 -0
- data/test/test_all.rb +0 -2
data/test/test_reporting.rb
CHANGED
@@ -26,18 +26,19 @@ class TestRestApi < Test::Unit::TestCase
|
|
26
26
|
|
27
27
|
@units = [{:Name => "units: mbps, ", :id => TrafficUnits::MBPS},
|
28
28
|
{:Name => "units: GB, ", :id => TrafficUnits::GB}]
|
29
|
+
@srv = Reporting.do
|
29
30
|
end
|
30
31
|
|
31
32
|
def test_traffic_usage
|
32
33
|
billing_month = @now - 50*24*60*60
|
33
34
|
puts "traffic usage for billing month in " + billing_month.strftime("%Y-%m-01")
|
34
35
|
@media_fhha.each { |media|
|
35
|
-
get_billing_regions.each { |region|
|
36
|
+
@srv.get_billing_regions.each { |region|
|
36
37
|
region_name = region["Name"]
|
37
38
|
if (region_name != "Global")
|
38
39
|
@units.each { |units|
|
39
40
|
puts media[:Name] + "region: " + region_name + ", " + units[:Name] +
|
40
|
-
|
41
|
+
@srv.get_traffic_usage(media[:id], region["Id"], units[:id], billing_month).to_s
|
41
42
|
}
|
42
43
|
end
|
43
44
|
}
|
@@ -47,96 +48,96 @@ class TestRestApi < Test::Unit::TestCase
|
|
47
48
|
def test_report_codes
|
48
49
|
puts "report codes"
|
49
50
|
@media_afhha.each { |media|
|
50
|
-
puts media[:Name] + get_report_codes(media[:id]).to_s
|
51
|
+
puts media[:Name] + @srv.get_report_codes(media[:id]).to_s
|
51
52
|
}
|
52
53
|
end
|
53
54
|
|
54
55
|
def test_maximum_storage_usage
|
55
56
|
puts "maximum storage usage"
|
56
|
-
puts get_maximum_storage_usage(@now-7*24*60*60, @now)
|
57
|
+
puts @srv.get_maximum_storage_usage(@now-7*24*60*60, @now)
|
57
58
|
end
|
58
59
|
|
59
60
|
def test_download_activity
|
60
61
|
puts "download activity"
|
61
62
|
@media_fha.each { |media|
|
62
|
-
puts media[:Name] + get_download_activity(media[:id], @now-24*60*60, @now).to_s
|
63
|
+
puts media[:Name] + @srv.get_download_activity(media[:id], @now-24*60*60, @now).to_s
|
63
64
|
}
|
64
65
|
end
|
65
66
|
|
66
67
|
def test_directory_activity
|
67
68
|
puts "directory activity"
|
68
69
|
@media_fha.each { |media|
|
69
|
-
puts media[:Name] + get_directory_activity(media[:id], @now-24*60*60, @now).to_s
|
70
|
+
puts media[:Name] + @srv.get_directory_activity(media[:id], @now-24*60*60, @now).to_s
|
70
71
|
}
|
71
72
|
end
|
72
73
|
|
73
74
|
def test_xferred_interval
|
74
|
-
puts "all regions: " + get_data_transferred_by_platform_and_interval(nil, @now-30*60, @now, nil, nil).to_s
|
75
|
-
regions = get_billing_regions
|
75
|
+
puts "all regions: " + @srv.get_data_transferred_by_platform_and_interval(nil, @now-30*60, @now, nil, nil).to_s
|
76
|
+
regions = @srv.get_billing_regions
|
76
77
|
regions.each { |region|
|
77
|
-
puts "region: " + region["Name"] + ", " + get_data_transferred_by_platform_and_interval(nil, @now-30*60, @now, region["Id"], nil).to_s
|
78
|
+
puts "region: " + region["Name"] + ", " + @srv.get_data_transferred_by_platform_and_interval(nil, @now-30*60, @now, region["Id"], nil).to_s
|
78
79
|
}
|
79
|
-
puts "every 5 minutes: " + get_data_transferred_by_platform_and_interval(nil, @now-30*60, @now, nil, Interval::FIVE_MINUTE).to_s
|
80
|
-
puts "every hour: " + get_data_transferred_by_platform_and_interval(nil, @now-10*60*60, @now, nil, Interval::HOURLY).to_s
|
81
|
-
puts "every day: " + get_data_transferred_by_platform_and_interval(nil, @now-5*24*60*60, @now, nil, Interval::DAILY).to_s
|
82
|
-
puts "flash media: " + get_data_transferred_by_platform_and_interval(MediaType::FLASH_MEDIA, @now-30*60, @now, nil, nil).to_s
|
83
|
-
puts "http large: " + get_data_transferred_by_platform_and_interval(MediaType::HTTP_LARGE, @now-30*60, @now, nil, nil).to_s
|
84
|
-
puts "http large ssl only: " + get_data_transferred_by_platform_and_interval(MediaType::HTTP_LARGE_SSL, @now-30*60, @now, nil, nil).to_s
|
85
|
-
puts "http large dfw: " + get_data_transferred_by_platform_and_interval(MediaType::HTTP_LARGE, @now-30*60, @now, nil, nil, "dfw").to_s
|
86
|
-
puts "http large lax, dca, mia, dfw: " + get_data_transferred_by_platform_and_interval(MediaType::HTTP_LARGE, @now-30*60, @now, nil, nil, "lax", "dca", "mia", "dfw").to_s
|
87
|
-
puts "http small: " + get_data_transferred_by_platform_and_interval(MediaType::HTTP_SMALL, @now-30*60, @now, nil, nil).to_s
|
88
|
-
puts "http small ssl only: " + get_data_transferred_by_platform_and_interval(MediaType::HTTP_SMALL_SSL, @now-30*60, @now, nil, nil).to_s
|
89
|
-
puts "adn: " + get_data_transferred_by_platform_and_interval(MediaType::ADN, @now-30*60, @now, nil, nil).to_s
|
90
|
-
puts "adn ssl only: " + get_data_transferred_by_platform_and_interval(MediaType::ADN_SSL, @now-30*60, @now, nil, nil).to_s
|
80
|
+
puts "every 5 minutes: " + @srv.get_data_transferred_by_platform_and_interval(nil, @now-30*60, @now, nil, Interval::FIVE_MINUTE).to_s
|
81
|
+
puts "every hour: " + @srv.get_data_transferred_by_platform_and_interval(nil, @now-10*60*60, @now, nil, Interval::HOURLY).to_s
|
82
|
+
puts "every day: " + @srv.get_data_transferred_by_platform_and_interval(nil, @now-5*24*60*60, @now, nil, Interval::DAILY).to_s
|
83
|
+
puts "flash media: " + @srv.get_data_transferred_by_platform_and_interval(MediaType::FLASH_MEDIA, @now-30*60, @now, nil, nil).to_s
|
84
|
+
puts "http large: " + @srv.get_data_transferred_by_platform_and_interval(MediaType::HTTP_LARGE, @now-30*60, @now, nil, nil).to_s
|
85
|
+
puts "http large ssl only: " + @srv.get_data_transferred_by_platform_and_interval(MediaType::HTTP_LARGE_SSL, @now-30*60, @now, nil, nil).to_s
|
86
|
+
puts "http large dfw: " + @srv.get_data_transferred_by_platform_and_interval(MediaType::HTTP_LARGE, @now-30*60, @now, nil, nil, "dfw").to_s
|
87
|
+
puts "http large lax, dca, mia, dfw: " + @srv.get_data_transferred_by_platform_and_interval(MediaType::HTTP_LARGE, @now-30*60, @now, nil, nil, "lax", "dca", "mia", "dfw").to_s
|
88
|
+
puts "http small: " + @srv.get_data_transferred_by_platform_and_interval(MediaType::HTTP_SMALL, @now-30*60, @now, nil, nil).to_s
|
89
|
+
puts "http small ssl only: " + @srv.get_data_transferred_by_platform_and_interval(MediaType::HTTP_SMALL_SSL, @now-30*60, @now, nil, nil).to_s
|
90
|
+
puts "adn: " + @srv.get_data_transferred_by_platform_and_interval(MediaType::ADN, @now-30*60, @now, nil, nil).to_s
|
91
|
+
puts "adn ssl only: " + @srv.get_data_transferred_by_platform_and_interval(MediaType::ADN_SSL, @now-30*60, @now, nil, nil).to_s
|
91
92
|
end
|
92
93
|
|
93
94
|
def test_xferred
|
94
|
-
puts "flash media: " + get_data_transferred_by_platform(MediaType::FLASH_MEDIA, @now-24*60*60, @now).to_s
|
95
|
-
puts "http large: " + get_data_transferred_by_platform(MediaType::HTTP_LARGE, @now-24*60*60, @now).to_s
|
96
|
-
# puts "http large ssl only: " + get_data_transferred_by_platform(MediaType::HTTP_LARGE_SSL, @now-24*60*60, @now).to_s
|
97
|
-
puts "http large dfw: " + get_data_transferred_by_platform(MediaType::HTTP_LARGE, @now-24*60*60, @now, "dfw").to_s
|
98
|
-
puts "http large lax, dca, mia, dfw: " + get_data_transferred_by_platform(MediaType::HTTP_LARGE, @now-24*60*60, @now, "lax", "dca", "mia", "dfw").to_s
|
99
|
-
puts "http small: " + get_data_transferred_by_platform(MediaType::HTTP_SMALL, @now-24*60*60, @now).to_s
|
100
|
-
# puts "http small ssl only: " + get_data_transferred_by_platform(MediaType::HTTP_SMALL_SSL, @now-24*60*60, @now).to_s
|
101
|
-
puts "adn: " + get_data_transferred_by_platform(MediaType::ADN, @now-24*60*60, @now).to_s
|
102
|
-
# puts "adn ssl only: " + get_data_transferred_by_platform(MediaType::ADN_SSL, @now-24*60*60, @now).to_s
|
95
|
+
puts "flash media: " + @srv.get_data_transferred_by_platform(MediaType::FLASH_MEDIA, @now-24*60*60, @now).to_s
|
96
|
+
puts "http large: " + @srv.get_data_transferred_by_platform(MediaType::HTTP_LARGE, @now-24*60*60, @now).to_s
|
97
|
+
# puts "http large ssl only: " + @srv.get_data_transferred_by_platform(MediaType::HTTP_LARGE_SSL, @now-24*60*60, @now).to_s
|
98
|
+
puts "http large dfw: " + @srv.get_data_transferred_by_platform(MediaType::HTTP_LARGE, @now-24*60*60, @now, "dfw").to_s
|
99
|
+
puts "http large lax, dca, mia, dfw: " + @srv.get_data_transferred_by_platform(MediaType::HTTP_LARGE, @now-24*60*60, @now, "lax", "dca", "mia", "dfw").to_s
|
100
|
+
puts "http small: " + @srv.get_data_transferred_by_platform(MediaType::HTTP_SMALL, @now-24*60*60, @now).to_s
|
101
|
+
# puts "http small ssl only: " + @srv.get_data_transferred_by_platform(MediaType::HTTP_SMALL_SSL, @now-24*60*60, @now).to_s
|
102
|
+
puts "adn: " + @srv.get_data_transferred_by_platform(MediaType::ADN, @now-24*60*60, @now).to_s
|
103
|
+
# puts "adn ssl only: " + @srv.get_data_transferred_by_platform(MediaType::ADN_SSL, @now-24*60*60, @now).to_s
|
103
104
|
end
|
104
105
|
|
105
106
|
def test_xferred_codes
|
106
|
-
puts "flash media: " + get_data_transferred_and_hits_by_custom_report_codes(MediaType::FLASH_MEDIA, @now-24*60*60, @now).to_s
|
107
|
-
puts "http large: " + get_data_transferred_and_hits_by_custom_report_codes(MediaType::HTTP_LARGE, @now-24*60*60, @now).to_s
|
108
|
-
puts "http small: " + get_data_transferred_and_hits_by_custom_report_codes(MediaType::HTTP_SMALL, @now-24*60*60, @now).to_s
|
109
|
-
puts "adn: " + get_data_transferred_and_hits_by_custom_report_codes(MediaType::ADN, @now-24*60*60, @now).to_s
|
107
|
+
puts "flash media: " + @srv.get_data_transferred_and_hits_by_custom_report_codes(MediaType::FLASH_MEDIA, @now-24*60*60, @now).to_s
|
108
|
+
puts "http large: " + @srv.get_data_transferred_and_hits_by_custom_report_codes(MediaType::HTTP_LARGE, @now-24*60*60, @now).to_s
|
109
|
+
puts "http small: " + @srv.get_data_transferred_and_hits_by_custom_report_codes(MediaType::HTTP_SMALL, @now-24*60*60, @now).to_s
|
110
|
+
puts "adn: " + @srv.get_data_transferred_and_hits_by_custom_report_codes(MediaType::ADN, @now-24*60*60, @now).to_s
|
110
111
|
end
|
111
112
|
|
112
113
|
def test_xferred_all
|
113
|
-
puts get_all_data_transferred(@now-24*60*60, @now)
|
114
|
-
puts get_all_data_transferred(@now-4*60*60, @now, "dfw")
|
115
|
-
puts get_all_data_transferred(@now-60*60, @now, "lax", "dca", "mia", "dfw")
|
114
|
+
puts @srv.get_all_data_transferred(@now-24*60*60, @now)
|
115
|
+
puts @srv.get_all_data_transferred(@now-4*60*60, @now, "dfw")
|
116
|
+
puts @srv.get_all_data_transferred(@now-60*60, @now, "lax", "dca", "mia", "dfw")
|
116
117
|
end
|
117
118
|
|
118
119
|
def test_customer_name
|
119
|
-
puts "customer name: " + get_customer_name.to_s
|
120
|
+
puts "customer name: " + @srv.get_customer_name.to_s
|
120
121
|
end
|
121
122
|
|
122
123
|
def test_account_number
|
123
|
-
# puts "account number: " + get_customer_account_number("NMK01").to_s
|
124
|
+
# puts "account number: " + @srv.get_customer_account_number("NMK01").to_s
|
124
125
|
end
|
125
126
|
|
126
127
|
def test_assec_activity
|
127
|
-
puts "flash media: " + get_asset_activity(MediaType::FLASH_MEDIA, @now-24*60*60, @now).to_s
|
128
|
-
puts "http large: " + get_asset_activity(MediaType::HTTP_LARGE, @now-24*60*60, @now).to_s
|
129
|
-
puts "http small: " + get_asset_activity(MediaType::HTTP_SMALL, @now-24*60*60, @now).to_s
|
130
|
-
puts "ADN: " + get_asset_activity(MediaType::ADN, @now-24*60*60, @now).to_s
|
128
|
+
puts "flash media: " + @srv.get_asset_activity(MediaType::FLASH_MEDIA, @now-24*60*60, @now).to_s
|
129
|
+
puts "http large: " + @srv.get_asset_activity(MediaType::HTTP_LARGE, @now-24*60*60, @now).to_s
|
130
|
+
puts "http small: " + @srv.get_asset_activity(MediaType::HTTP_SMALL, @now-24*60*60, @now).to_s
|
131
|
+
puts "ADN: " + @srv.get_asset_activity(MediaType::ADN, @now-24*60*60, @now).to_s
|
131
132
|
end
|
132
133
|
|
133
134
|
def test_status_activity
|
134
|
-
puts "http large: " + get_cache_status_activity(MediaType::HTTP_LARGE, @now-24*60*60, @now).to_s
|
135
|
-
puts "http small: " + get_cache_status_activity(MediaType::HTTP_SMALL, @now-24*60*60, @now).to_s
|
136
|
-
puts "ADN: " + get_cache_status_activity(MediaType::ADN, @now-24*60*60, @now).to_s
|
135
|
+
puts "http large: " + @srv.get_cache_status_activity(MediaType::HTTP_LARGE, @now-24*60*60, @now).to_s
|
136
|
+
puts "http small: " + @srv.get_cache_status_activity(MediaType::HTTP_SMALL, @now-24*60*60, @now).to_s
|
137
|
+
puts "ADN: " + @srv.get_cache_status_activity(MediaType::ADN, @now-24*60*60, @now).to_s
|
137
138
|
end
|
138
139
|
|
139
140
|
def test_storage_usage
|
140
|
-
puts "current_storage_usage: " + get_current_storage_usage.to_s
|
141
|
+
puts "current_storage_usage: " + @srv.get_current_storage_usage.to_s
|
141
142
|
end
|
142
143
|
end
|
data/vzcdn.gemspec
CHANGED
@@ -18,8 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "rest-client", ">= 1.5"
|
22
|
-
|
23
21
|
spec.add_development_dependency "bundler", "~> 1.5"
|
24
22
|
spec.add_development_dependency "rake"
|
25
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vzcdn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Preston
|
@@ -10,22 +10,8 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-05-
|
13
|
+
date: 2014-05-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: rest-client
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
requirements:
|
19
|
-
- - ">="
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '1.5'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: '1.5'
|
29
15
|
- !ruby/object:Gem::Dependency
|
30
16
|
name: bundler
|
31
17
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,6 +57,7 @@ files:
|
|
71
57
|
- Rakefile
|
72
58
|
- bin/ec
|
73
59
|
- bin/vzcdn
|
60
|
+
- lib/MockHttpResponse
|
74
61
|
- lib/args.rb
|
75
62
|
- lib/argtest.rb
|
76
63
|
- lib/bind2zone.sh
|
@@ -81,9 +68,11 @@ files:
|
|
81
68
|
- lib/config_handler.rb
|
82
69
|
- lib/config_reader.rb
|
83
70
|
- lib/diff.rb
|
71
|
+
- lib/http_send.rb
|
84
72
|
- lib/mediaManagment.rb
|
85
73
|
- lib/method.rb
|
86
74
|
- lib/mkbind.sh
|
75
|
+
- lib/mock_http_send.rb
|
87
76
|
- lib/print.rb
|
88
77
|
- lib/proxy_credentials.rb
|
89
78
|
- lib/realTimeStats.rb
|
@@ -102,10 +91,21 @@ files:
|
|
102
91
|
- lib/zone_diff.rb
|
103
92
|
- lib/zone_hc.rb
|
104
93
|
- lib/zone_update.rb
|
105
|
-
-
|
106
|
-
- test/
|
94
|
+
- test/bad-credentials.mock
|
95
|
+
- test/bad-credentials.results
|
96
|
+
- test/create_delete.mock
|
97
|
+
- test/crud.mock
|
98
|
+
- test/crud.results
|
99
|
+
- test/initial.mock
|
100
|
+
- test/initial.results
|
101
|
+
- test/mk_mock.rb
|
102
|
+
- test/mk_response.rb
|
103
|
+
- test/push.mock
|
107
104
|
- test/test_clui.rb
|
105
|
+
- test/test_mock.rb
|
108
106
|
- test/test_reporting.rb
|
107
|
+
- test/unreachable.mock
|
108
|
+
- test/unreachable.results
|
109
109
|
- vzcdn.gemspec
|
110
110
|
homepage: ''
|
111
111
|
licenses:
|
@@ -132,6 +132,18 @@ signing_key:
|
|
132
132
|
specification_version: 4
|
133
133
|
summary: Command line UI for Edgecast api.
|
134
134
|
test_files:
|
135
|
-
- test/
|
135
|
+
- test/bad-credentials.mock
|
136
|
+
- test/bad-credentials.results
|
137
|
+
- test/create_delete.mock
|
138
|
+
- test/crud.mock
|
139
|
+
- test/crud.results
|
140
|
+
- test/initial.mock
|
141
|
+
- test/initial.results
|
142
|
+
- test/mk_mock.rb
|
143
|
+
- test/mk_response.rb
|
144
|
+
- test/push.mock
|
136
145
|
- test/test_clui.rb
|
146
|
+
- test/test_mock.rb
|
137
147
|
- test/test_reporting.rb
|
148
|
+
- test/unreachable.mock
|
149
|
+
- test/unreachable.results
|
data/pkg/vzcdn-0.0.1.gem
DELETED
Binary file
|
data/test/test_all.rb
DELETED