vzcdn 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: cc9334dc074bcd9128b32effd983c0c42a29d101
4
- data.tar.gz: deba51bb01a5d4d5c294fbfc5d16be893f210aa9
3
+ metadata.gz: e2965538e99c8d02405a519aac77f48643637eb5
4
+ data.tar.gz: f2f1ee848a5da8ee3130bd03f152bef9da8032bf
5
5
  SHA512:
6
- metadata.gz: 7d773ea4142e1d5d3707ff3a7564c92a2578ad876e4a49ad32dacc559f8f3b378d74bc97de1dd04199c17921e7875890bd7da3511d4770246242da57ecf83b60
7
- data.tar.gz: d298f784888abb20fb4a1f8f34da2a878b4ed782bf9341cd6e393d349ccf8a3cf6cb38e8e4bcc16023cd734bc46f69c406c60dd8e1917e8bf010ca9f1307a92f
6
+ metadata.gz: 5e731e1f4a076d55d16a450a9bca92cd0c69a1b85ed16d59640e4adf1c57db76702c9f42643f5d42fa01500de4ed7bc7f2db757bb2e0ecc423b88f9f45f04348
7
+ data.tar.gz: 938355fe326c2f9d33c4ab5040141c5adadf6e2a41b8bf0eca6f152f6d4a389defa62b0359ae778b59b0a8789c0c75f471fd0624466a21d129c21b02ded012e8
@@ -0,0 +1,107 @@
1
+ require 'fileutils'
2
+ require_relative 'command_proc'
3
+
4
+ class Configure
5
+ include CommandProc
6
+
7
+ def initialize(name)
8
+ end
9
+
10
+ CONFIG_DIRECTORY = ".vdms.d"
11
+ CONFIG_FILENAME = "config"
12
+
13
+ def get_config_file
14
+ if (! File.directory?(CONFIG_DIRECTORY))
15
+ FileUtils.mkdir(CONFIG_DIRECTORY)
16
+ end
17
+ CONFIG_DIRECTORY + File::SEPARATOR + CONFIG_FILENAME
18
+ end
19
+
20
+ def parse_line(line)
21
+ idx = line.index('=')
22
+ if (idx)
23
+ return line[0...idx], line[idx+1..-1]
24
+ else
25
+ line
26
+ end
27
+ end
28
+
29
+ def replace_nv(name, value, new_file, old_file_contents)
30
+ new_config_line = name + '=' + value
31
+ wrote_line = false
32
+ old_file_contents.each { |line|
33
+ old_name, old_value = parse_line(line)
34
+ if (old_name == name)
35
+ new_file.puts(new_config_line)
36
+ wrote_line = true
37
+ else
38
+ new_file.puts(line)
39
+ end
40
+ }
41
+ if ( ! wrote_line)
42
+ new_file.puts(new_config_line)
43
+ end
44
+ end
45
+
46
+ def file_contents(filename)
47
+ if (File.file? filename)
48
+ File.open(filename, "r")
49
+ else
50
+ []
51
+ end
52
+ end
53
+
54
+ def init(args)
55
+ puts "init called with args: " + args.to_s
56
+ if (args.length != 2)
57
+
58
+ else
59
+ set(["acct-num", args[0]])
60
+ set(["token", args[1]])
61
+ set(["rest_base_url", "https://api.edgecast.com/v2/"])
62
+ end
63
+ end
64
+
65
+ def load_config_values
66
+ if defined? @@config_values
67
+ return
68
+ else
69
+ @@config_values = {}
70
+ File.open(get_config_file).each { |line|
71
+ line = line.strip
72
+ if line[0] == '#'
73
+ continue
74
+ end
75
+ name, value = parse_line(line)
76
+ if value
77
+ @@config_values[name] = value
78
+ end
79
+ }
80
+ end
81
+ end
82
+
83
+ def self.config_parameter(name)
84
+ instance = get_instance(nil)
85
+ instance.load_config_values
86
+ @@config_values[name]
87
+ end
88
+
89
+ def get(args)
90
+
91
+ end
92
+
93
+ def set(args)
94
+ if (args.length != 2)
95
+ puts "usage: set <name> <value>"
96
+ error
97
+ end
98
+ name = args[0]
99
+ value = args[1]
100
+ config_file = get_config_file
101
+ new_config_file = config_file + ".tmp"
102
+ updated_file = File.open(new_config_file, "w")
103
+ replace_nv(name, value, updated_file, file_contents(config_file))
104
+ updated_file.close
105
+ FileUtils.mv(new_config_file, config_file, :force => true)
106
+ end
107
+ end
@@ -0,0 +1,58 @@
1
+ require_relative 'config_reader'
2
+
3
+ module CommandProc
4
+ include ConfigReader
5
+
6
+ def help(args)
7
+ puts "Avalable commands:"
8
+ self.class.instance_methods(false).each{|method|
9
+ puts " " + method.to_s
10
+ }
11
+ end
12
+
13
+ def self.included(base)
14
+ base.extend(ClassMethods)
15
+ base.init_instances
16
+ end
17
+
18
+ module ClassMethods
19
+ def init_instances
20
+ class_eval <<-CODE
21
+ def self.instances
22
+ @@instances ||= nil
23
+ end
24
+ def self.instances=(value)
25
+ @@instances = value
26
+ end
27
+ @@instances = {}
28
+ CODE
29
+ end
30
+
31
+ def get_instance(name)
32
+ if self.instances[name]
33
+ self.instances[name]
34
+ else
35
+ self.instances[name] = self.new(name)
36
+ end
37
+ self.instances[name]
38
+ end
39
+
40
+ def invoke(args)
41
+ instance = get_instance(nil)
42
+ command = args.shift
43
+ if command == nil
44
+ command = "help"
45
+ end
46
+ if instance.respond_to?(command)
47
+ instance.send(command, args)
48
+ else
49
+ name = command
50
+ instance = get_instance(name)
51
+ puts "instance is " + instance.to_s
52
+ end
53
+ end
54
+
55
+ end
56
+
57
+
58
+ end
data/lib/common.rb ADDED
@@ -0,0 +1,59 @@
1
+ require 'rest_client'
2
+ require 'json'
3
+
4
+ class CommonRestUtils
5
+ def callMethod(url_suffix, http_method, body=nil)
6
+ url = @uri_prefix + url_suffix
7
+ if (body)
8
+ json_body = JSON.pretty_generate body
9
+ end
10
+ begin
11
+ response =
12
+ case http_method
13
+ when :put
14
+ RestClient.put(url, json_body, Headers)
15
+ when :get
16
+ RestClient.get(url, Headers)
17
+ when :post
18
+ RestClient.post(url, json_body, Headers)
19
+ when :delete
20
+ RestClient.(url, Headers)
21
+ else
22
+ "unsupported http method:" + http_method
23
+ end
24
+ rescue RestClient::Exception => e
25
+ puts "URL is:" + url
26
+ if (body)
27
+ puts "body is: json_body"
28
+ end
29
+ raise("Exception occurred:" + e.message)
30
+ end
31
+ if (response.code != 200)
32
+ raise "Bad response code:" + response.code.to_s
33
+ end
34
+ if (response.length > 0)
35
+ JSON.parse response
36
+ else
37
+ response
38
+ end
39
+ end
40
+
41
+ def initialize(uri_prefix)
42
+ @uri_prefix = uri_prefix
43
+ end
44
+
45
+ Headers = {:Content_type => "Application/json",
46
+ :Authorization => "TOK:" + Configure.config_parameter("token"),
47
+ :Accept => "Application/json"}
48
+
49
+ end
50
+
51
+ module MediaType
52
+ FLASH_MEDIA = 2
53
+ HTTP_LARGE = 3
54
+ HTTP_LARGE_SSL = 7
55
+ HTTP_SMALL = 8
56
+ HTTP_SMALL_SSL = 9
57
+ ADN = 14
58
+ ADN_SSL = 15
59
+ end
@@ -0,0 +1,5 @@
1
+ module ConfigReader
2
+ def param(name)
3
+ Configure.config_parameter(name)
4
+ end
5
+ end
@@ -0,0 +1,136 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative 'common.rb'
3
+ URI_PREFIX="https://api.edgecast.com/v2/mcc/customers/" + ACCT_NUM + "/"
4
+
5
+ def getPurgeRequest(id)
6
+ callMethod("edge/purge/" + id, :get)
7
+ end
8
+
9
+ def getAllEdgeNodes()
10
+ callMethod("edgenodes", :get)
11
+ end
12
+
13
+ def loadContent(path, type)
14
+ body = {:MediaPath => path, :MediaType => type}
15
+ callMethod("edge/load", :put, body)
16
+ end
17
+
18
+ def purgeContent(path, type)
19
+ body = {:MediaPath => path, :MediaType => type}
20
+ callMethod("edge/purge", :put, body)
21
+ end
22
+
23
+ def get_all_compression_settings
24
+ callMethod("compression", :get)
25
+ end
26
+
27
+ def get_all_query_string_caching_settings
28
+ callMethod("querystringcaching", :get)
29
+ end
30
+
31
+ def get_all_query_string_logging_settings
32
+ callMethod("querystringlogging", :get)
33
+ end
34
+
35
+ def get_compression_setting (media_type)
36
+ callMethod("compression?mediatypeid=" + media_type.to_s, :get)
37
+ end
38
+
39
+ def get_query_string_caching_setting(media_type)
40
+ callMethod("querystringcaching?mediatypeid=" + media_type.to_s, :get)
41
+ end
42
+
43
+ def get_query_string_logging_setting(media_type)
44
+ callMethod("querystringlogging?mediatypeid=" + media_type.to_s, :get)
45
+ end
46
+
47
+ def update_compression_settings(media_type, enable, *content_types)
48
+ body = { :ContentTypes => content_types, :MediaTypeId => media_type, :Status => (enable ? 1 :0) }
49
+ callMethod("compression", :put, body)
50
+ end
51
+
52
+ def update_query_string_caching_setting (query_string_caching, media_type)
53
+ body = { :QueryStringCaching => query_string_caching, :MediaTypeId => media_type}
54
+ callMethod("querystringcaching", :put, body)
55
+ end
56
+
57
+ def update_query_string_logging_status(media_type, logging)
58
+ body = { :QueryStringLogging => logging, :MediaTypeId => media_type}
59
+ callMethod("querystringlogging", :put, body)
60
+ end
61
+
62
+ ##################
63
+ def get_all_customer_origins()
64
+ callMethod("origins/httplarge", :get)
65
+ end
66
+
67
+ def add_origin(media_type, directory, host_header, http_host_names, http_load_balancing, https_host_names, https_load_balancing, shield_pops)
68
+
69
+ body = { :DirectoryName => directory, :HostHeader => host_header, :HttpHostnames => http_host_names, :HttpLoadBalancing => http_load_balancing,
70
+ :HttpsHostnames => https_host_names, :HttpsLoadBalancing => https_load_balancing, :ShieldPOPs => shield_pops }
71
+ media_type_s = case when MediaType::HTTP_LARGE then "httplarge"
72
+ when MediaType::HTTP_SMALL then "httpsmall"
73
+ when MediaType::FLASH_MEDIA then "flash"
74
+ when MediaType::ADN then "adn" end
75
+
76
+ callMethod("origins/" + media_type_s, :post, body)
77
+ end
78
+
79
+ def delete_customer_origin(origin_id)
80
+ callMethod("origins/" + origin_id.to_s, :delete)
81
+ end
82
+
83
+ p delete_customer_origin("171695")
84
+
85
+ http_host_names = []
86
+ http_host_names.push({ :Name => "http://nitintest1.vdmstest.com:80" })
87
+ http_host_names.push({ :Name => "http://nitintest2.vdmstest.com:80" })
88
+ https_host_names = nil
89
+ #https_host_names.push({ :Name => "https://img.xyz.com:443" })
90
+ shieldPops = nil
91
+ #shieldPops.push({ :POPCode => "lax" })
92
+ #new_origin = add_origin(MediaType::HTTP_LARGE, "MyCustomDirectory6", "nitintest.vdmstest.com:80", http_host_names, "RR", https_host_names, "PF", shieldPops)
93
+ #p new_origin
94
+
95
+ origin_list = get_all_customer_origins()
96
+ origin_list.each { |origin|
97
+ puts origin["Id"].to_s + "\t" + origin["DirectoryName"] +"\t" + origin["HttpFullUrl"] + "\t" + origin["HostHeader"]
98
+ }
99
+ exit
100
+
101
+
102
+ exit
103
+ p get_query_string_logging_setting(MediaType::HTTP_LARGE)
104
+ p get_query_string_caching_setting(MediaType::HTTP_LARGE)
105
+
106
+ update_query_string_logging_status( MediaType::HTTP_SMALL, "log")
107
+ update_query_string_logging_status( MediaType::HTTP_LARGE, "log")
108
+ puts get_all_query_string_logging_settings
109
+
110
+ update_query_string_caching_setting("unique-cache", MediaType::HTTP_SMALL)
111
+ puts get_all_query_string_caching_settings
112
+
113
+
114
+ update_compression_settings(MediaType::HTTP_LARGE, true, "text/plain", "text/css")
115
+ puts "for http large: " + get_compression_setting(MediaType::HTTP_LARGE).to_s
116
+
117
+ puts "for http small: " + get_compression_setting(MediaType::HTTP_SMALL).to_s
118
+ puts "for adn: " + get_compression_setting(MediaType::ADN).to_s
119
+
120
+ response = loadContent("http://wac.BED3.edgecastcdn.net/00BED3/marketing/content/images/banner_rightArrow.png", 8)
121
+ puts response
122
+
123
+ purgeReq = getPurgeRequest("5329fefd951d41012e33d403")
124
+ puts "Complete Date: " + purgeReq["CompleteDate"]
125
+ puts "In Date: " + purgeReq["InDate"]
126
+
127
+ purge = purgeContent("http://wac.BED3.edgecastcdn.net/00BED3/marketing/content/images/banner_rightArrow.png", 8)
128
+ puts "purge Id = " + purge["Id"]
129
+
130
+ nodeList = getAllEdgeNodes
131
+ nodeList.each { |node|
132
+ puts "node in " + node["City"] + ", " + node["Continent"]
133
+ }
134
+ puts "there are " + nodeList.count.to_s + " nodes:"
135
+
136
+ exit
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative 'common.rb'
3
+
4
+ URI_PREFIX="https://api.edgecast.com/v2/realtimestats/customers/" + ACCT_NUM + "/media/"
5
+ def get_current_bandwidth(media_type)
6
+ callMethod(media_type.to_s + "/bandwidth", :get)
7
+ end
8
+
9
+ def get_current_cache_status_statistics(media_type)
10
+ callMethod(media_type.to_s + "/cachestatus", :get)
11
+ end
12
+
13
+ def get_current_status_code_statistics(media_type)
14
+ callMethod(media_type.to_s + "/statuscode", :get)
15
+ end
16
+
17
+ def get_current_streams
18
+ callMethod("2/streams", :get)
19
+ end
20
+
21
+ def get_current_total_connections(media_type)
22
+ callMethod(media_type.to_s + "/connections", :get)
23
+ end
24
+
25
+ puts "flash media bandwidth:" + get_current_bandwidth(MediaType::FLASH_MEDIA).to_s
26
+ puts "http small bandwidth:" + get_current_bandwidth(MediaType::HTTP_SMALL).to_s
27
+ puts "http large bandwidth:" + get_current_bandwidth(MediaType::HTTP_LARGE).to_s
28
+ puts "adn bandwidth:" + get_current_bandwidth(MediaType::ADN).to_s
29
+
30
+ puts "http small cache status:" + get_current_cache_status_statistics(MediaType::HTTP_SMALL).to_s
31
+ puts "http large cache status:" + get_current_cache_status_statistics(MediaType::HTTP_LARGE).to_s
32
+ puts "adn cache status:" + get_current_cache_status_statistics(MediaType::ADN).to_s
33
+
34
+ puts "http small status codes:" + get_current_status_code_statistics(MediaType::HTTP_SMALL).to_s
35
+ puts "http large status codes:" + get_current_status_code_statistics(MediaType::HTTP_LARGE).to_s
36
+ puts "adn status codes:" + get_current_status_code_statistics(MediaType::ADN).to_s
37
+
38
+ puts "current streams:" + get_current_streams.to_s
39
+
40
+ puts "flash media total connections:" + get_current_total_connections(MediaType::FLASH_MEDIA).to_s
41
+ puts "http small total connections:" + get_current_total_connections(MediaType::HTTP_SMALL).to_s
42
+ puts "http large total connections:" + get_current_total_connections(MediaType::HTTP_LARGE).to_s
43
+ puts "adn total connections:" + get_current_total_connections(MediaType::ADN).to_s
data/lib/reporting.rb ADDED
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative 'common.rb'
3
+ require 'cgi'
4
+
5
+ URI_PREFIX="https://api.edgecast.com/v2/reporting/"
6
+ URI_CUSTOMERS_SEGMENT = "customers/" + ACCT_NUM + "/"
7
+
8
+ module Interval
9
+ FIVE_MINUTE = 1
10
+ HOURLY = 2
11
+ DAILY = 3
12
+ end
13
+
14
+ module TrafficUnits
15
+ MBPS = 1
16
+ GB = 2
17
+ end
18
+
19
+ def to_csv(prefix, pops_list)
20
+ result = ""
21
+ if (pops_list.count > 0)
22
+ result = prefix + pops_list[0]
23
+ pops_list.shift
24
+ pops_list.each { |pop|
25
+ result = result + "," + pop
26
+ }
27
+ end
28
+ result
29
+ end
30
+
31
+ def time_to_q(time)
32
+ time.strftime("%Y-%m-%dT%H:%M:%S")
33
+ end
34
+
35
+ def interval(begin_time, end_time)
36
+ "?begindate=" + time_to_q(begin_time) + "&enddate=" + time_to_q(end_time)
37
+ end
38
+
39
+ def customer_suffix(word)
40
+ URI_CUSTOMERS_SEGMENT + word
41
+ end
42
+
43
+ def interval_suffix(word, begin_time, end_time)
44
+ URI_CUSTOMERS_SEGMENT + word + interval(begin_time, end_time)
45
+ end
46
+
47
+ def media_suffix(media_type, word, begin_time, end_time)
48
+ URI_CUSTOMERS_SEGMENT + "media/" + media_type.to_s + "/" + word + interval(begin_time, end_time)
49
+ end
50
+
51
+ def get_all_data_transferred(begin_time, end_time, *pops)
52
+ callMethod(interval_suffix("bytestransferred", begin_time, end_time) + to_csv("&pops=", pops), :get)
53
+ end
54
+
55
+ def get_asset_activity(media_type, begin_time, end_time)
56
+ callMethod(media_suffix(media_type, "filestats", begin_time, end_time), :get)
57
+ end
58
+
59
+ def get_billing_regions
60
+ callMethod("billing/regions", :get)
61
+ end
62
+
63
+ def get_cache_status_activity(media_type, begin_time, end_time)
64
+ callMethod(media_suffix(media_type, "cachestats", begin_time, end_time), :get)
65
+ end
66
+
67
+ def get_current_storage_usage
68
+ callMethod(customer_suffix("lateststorageusage"), :get)
69
+ end
70
+
71
+ def get_customer_account_number(custom_id)
72
+ callMethod("customers/accountnumber?customercustomid=" + CGI.escape(custom_id), :get)
73
+ end
74
+
75
+ def get_customer_name
76
+ callMethod(customer_suffix("customername"), :get)
77
+ end
78
+
79
+ def get_data_transferred_and_hits_by_custom_report_codes(media_type, begin_time, end_time)
80
+ callMethod(media_suffix(media_type, "cnamereportcodes", begin_time, end_time), :get)
81
+ end
82
+
83
+ def get_data_transferred_by_platform(media_type, begin_time, end_time, *pops)
84
+ callMethod(media_suffix(media_type, "bytestransferred", begin_time, end_time) + to_csv("&pops=", pops), :get)
85
+ end
86
+
87
+ def get_data_transferred_by_platform_and_interval(media_type, begin_time, end_time, region_id, interval_id, *pops)
88
+ suffix = interval_suffix("bytestransferred/interval", begin_time, end_time);
89
+ if (media_type)
90
+ suffix = suffix + "&mediatypeid=" + media_type.to_s
91
+ end
92
+ if (interval_id)
93
+ suffix = suffix + "&intervalid=" + interval_id.to_s
94
+ end
95
+ suffix = suffix + to_csv("&pops=", pops)
96
+ if (region_id)
97
+ suffix = suffix + "&regionid=" + region_id.to_s
98
+ end
99
+ puts "suffix: " + suffix
100
+ callMethod(suffix, :get)
101
+ end
102
+
103
+ def get_directory_activity(media_type, begin_time, end_time)
104
+ callMethod(media_suffix(media_type, "directorystats", begin_time, end_time), :get)
105
+ end
106
+
107
+ def get_download_activity(media_type, begin_time, end_time)
108
+ callMethod(media_suffix(media_type, "completedownloads", begin_time, end_time), :get)
109
+ end
110
+
111
+ def get_maximum_storage_usage(begin_time, end_time)
112
+ callMethod(interval_suffix("maxstorageusage", begin_time, end_time), :get)
113
+ end
114
+
115
+ def get_report_codes(media_type)
116
+ suffix = customer_suffix("reportcodes")
117
+ if (media_type)
118
+ suffix = suffix + "?mediatypeid=" + media_type.to_s
119
+ end
120
+ callMethod(suffix, :get)
121
+ end
122
+
123
+ def get_traffic_usage(media_type, region_id, units, billing_month)
124
+ suffix = URI_CUSTOMERS_SEGMENT +
125
+ "media/" + media_type.to_s + "/region/" + region_id.to_s + "/units/" + units.to_s + "/trafficusage" +
126
+ "?begindate=" + billing_month.strftime("%Y-%m-01")
127
+ callMethod(suffix, :get)
128
+ end
data/lib/route.rb ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative 'common.rb'
3
+ require 'pp'
4
+
5
+ class Route
6
+ include ConfigReader
7
+
8
+ def initialize
9
+ @common = CommonRestUtils.new(param("rest_base_url") + "mcc/")
10
+ end
11
+
12
+ def customer_suffix(suffix)
13
+ "customers/" + param("acct-num") + "/" + suffix
14
+ end
15
+
16
+ def non_customer_suffix(suffix)
17
+ "/dns/" + suffix
18
+ end
19
+
20
+ def get_all_zones(status=nil, zone_type=nil)
21
+ suffix = "dns/routezones"
22
+ if status != nil && zone_type != nil
23
+ suffix = suffix + "?status=" + status + "&zonetype=" + zone_type
24
+ elsif status != nil
25
+ suffix = suffix + "?status=" + status
26
+ elsif zone_type != nil
27
+ suffix = suffix + "?zonetype=" + zone_type
28
+ end
29
+ @common.callMethod(customer_suffix(suffix), :get)
30
+ end
31
+
32
+ def get_zone(id, name)
33
+ suffix = "dns/routezone?id=" + id + "&name=" + name
34
+ callMethod(customer_suffix(suffix), :get)
35
+ end
36
+
37
+ def copy_zone(from, to)
38
+ suffix = customer_suffix("dns/routezone/copy")
39
+ body = {:FromDomainName => from, :ToDomainName => to}
40
+ callMethod(suffix, :post, body)
41
+ end
42
+
43
+ def delete_zone(id)
44
+ suffix = customer_suffix("dns/routezone/" + id)
45
+ callMethod(suffix, :delete)
46
+ end
47
+
48
+ def add_zone()
49
+ end
50
+
51
+ def get_available_zone_types()
52
+ callMethod(non_customer_suffix("routezonetypes"), :get)
53
+ end
54
+
55
+ def get_available_record_types()
56
+ callMethod(non_customer_suffix("routezonerecordtypes"), :get)
57
+ end
58
+
59
+ def get_available_zone_statuses()
60
+ callMethod(non_customer_suffix("routezonestatus"), :get)
61
+ end
62
+
63
+ def get_available_route_groups()
64
+ callMethod(non_customer_suffix("routegrouptypes"), :get)
65
+ end
66
+
67
+ def get_available_http_methods()
68
+ callMethod(non_customer_suffix("routehttpmethodtypes"), :get)
69
+ end
70
+
71
+ def get_available_ip_versions()
72
+ callMethod(non_customer_suffix("routehealthcheckipversion"), :get)
73
+ end
74
+
75
+ def get_available_health_check_types()
76
+ callMethod(non_customer_suffix("routehealthchecktypes"), :get)
77
+ end
78
+
79
+ def get_available_health_check_reintegration_methods()
80
+ callMethod(non_customer_suffix("routereintegrationmethodtypes"), :get)
81
+ end
82
+ end
data/lib/t.rb ADDED
@@ -0,0 +1,3 @@
1
+ require_relative 'clui_config'
2
+
3
+ puts CluiConfig.get_config("acct-num")
data/lib/upload.rb ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ require 'net/ftp'
3
+ require_relative 'common.rb'
4
+
5
+ remoteDir = ARGV[0]
6
+ ARGV.shift
7
+
8
+ ftp=Net::FTP.new
9
+ ftp.connect(HOST,21)
10
+ ftp.login(USER,PWD)
11
+ ftp.chdir(remoteDir)
12
+ ARGV.each do |file|
13
+ puts("uploading " + file)
14
+ ftp.putbinaryfile(file)
15
+ end
16
+
17
+ ftp.close
18
+
data/lib/userInfo.rb ADDED
@@ -0,0 +1,6 @@
1
+ # Move this file to ~/.vdms.d/userInfo.rb
2
+ HOST="ftp.cpm.BED3.edgecastcdn.net"
3
+ USER="Nitin.khanna@verizon.com"
4
+ PWD="kevin123"
5
+ API_TOKEN="e22db149-7369-4d7b-9c53-38d38746ccea"
6
+ ACCT_NUM="BED3"
data/lib/vzcdn/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vzcdn
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/vzcdn.rb CHANGED
@@ -1,11 +1,26 @@
1
- require "vzcdn/version"
1
+ #!/usr/bin/env ruby
2
+ require_relative 'command_proc'
3
+ require_relative 'clui_config'
4
+ require_relative 'zone'
2
5
 
3
- module Vzcdn
4
- Class Test
5
- def test
6
- puts "Welcome to Verizon CDN"
6
+ class Vzcdn
7
+ include CommandProc
8
+
9
+ def initialize(name)
10
+ end
11
+
12
+ def zone(args)
13
+ Zone.invoke(args)
14
+ end
15
+
16
+ def config(args)
17
+ Configure.invoke(args)
7
18
  end
8
19
  end
9
- end
10
20
 
11
- git clone
21
+ args = []
22
+ ARGV.each { |arg|
23
+ args << arg
24
+ }
25
+
26
+ Vzcdn.invoke(args)
data/lib/zone.rb ADDED
@@ -0,0 +1,19 @@
1
+ require_relative 'route'
2
+
3
+ class Zone
4
+ include CommandProc
5
+
6
+ def initialize(name)
7
+ @zname = name
8
+ end
9
+
10
+ def list(args)
11
+ if @zname
12
+ puts "unimplemented"
13
+ else
14
+ puts Route.new.get_all_zones
15
+ end
16
+ end
17
+
18
+
19
+ end
Binary file
data/test/test_clui.rb ADDED
@@ -0,0 +1,8 @@
1
+ require 'clui_config'
2
+ require 'test/unit'
3
+
4
+ class TestClui < Test::Unit::TestCase
5
+ def test_config
6
+ CluiConfig.set("aname", "anothervalue")
7
+ end
8
+ end
data/vzcdn.gemspec CHANGED
@@ -5,11 +5,11 @@ require 'vzcdn/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "vzcdn"
8
- spec.version = "0.0.4" #Vzcdn::VERSION
8
+ spec.version = Vzcdn::VERSION
9
9
  spec.authors = ["Steve Preston", "Thomas Goes", "Nitin Khanna"]
10
10
  spec.email = ["steven.c.preston@verizon.com", "thomas.goes@verizon.com", "nitin.khanna@verizon.com"]
11
- spec.summary = %q{Commandline UI for Edgecast APIs}
12
- spec.description = %q{Commandline UI for Edgecast APIs}
11
+ spec.summary = %q{Command line UI for Edgecast api.}
12
+ spec.description = %q{Command line UI for Edgecast api.}
13
13
  spec.homepage = ""
14
14
  spec.license = "MIT"
15
15
 
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.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Preston
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-03-26 00:00:00.000000000 Z
13
+ date: 2014-03-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -40,7 +40,7 @@ dependencies:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
- description: Commandline UI for Edgecast APIs
43
+ description: Command line UI for Edgecast api.
44
44
  email:
45
45
  - steven.c.preston@verizon.com
46
46
  - thomas.goes@verizon.com
@@ -49,14 +49,26 @@ executables: []
49
49
  extensions: []
50
50
  extra_rdoc_files: []
51
51
  files:
52
- - ".gitignore"
53
52
  - Gemfile
54
53
  - LICENSE.txt
55
54
  - README.md
56
55
  - Rakefile
56
+ - lib/clui_config.rb
57
+ - lib/command_proc.rb
58
+ - lib/common.rb
59
+ - lib/config_reader.rb
60
+ - lib/mediaManagment.rb
61
+ - lib/realTimeStats.rb
62
+ - lib/reporting.rb
63
+ - lib/route.rb
64
+ - lib/t.rb
65
+ - lib/upload.rb
66
+ - lib/userInfo.rb
57
67
  - lib/vzcdn.rb
58
68
  - lib/vzcdn/version.rb
59
- - version.rb
69
+ - lib/zone.rb
70
+ - pkg/vzcdn-0.0.1.gem
71
+ - test/test_clui.rb
60
72
  - vzcdn.gemspec
61
73
  homepage: ''
62
74
  licenses:
@@ -81,5 +93,6 @@ rubyforge_project:
81
93
  rubygems_version: 2.2.2
82
94
  signing_key:
83
95
  specification_version: 4
84
- summary: Commandline UI for Edgecast APIs
85
- test_files: []
96
+ summary: Command line UI for Edgecast api.
97
+ test_files:
98
+ - test/test_clui.rb
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/version.rb DELETED
@@ -1,3 +0,0 @@
1
- module Vzcdn
2
- VERSION = "0.0.3"
3
- end