vzcdn 0.2.2 → 0.2.3

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.
@@ -4,18 +4,34 @@ require_relative 'args'
4
4
  require_relative 'clui_config'
5
5
  require_relative 'zone'
6
6
  require_relative 'vzcdn/version'
7
+ require_relative 'config_reader'
7
8
 
8
9
  class VzcdnApp < Command
10
+ include ConfigReader
11
+
9
12
  def add_options
10
13
  add_option({ short_name: 'v', long_name: 'version', method: :print_version, takes_value: false})
11
14
  add_option({ short_name: 'd', long_name: 'debug', method: :set_debug, takes_value: false})
12
15
  end
13
16
 
17
+ def init
18
+ if param("http-save-file") != ""
19
+ $http_save_file = param("http-save-file")
20
+ end
21
+ if param("mock-env") != ""
22
+ $mock_env = param("mock-env")
23
+ end
24
+ end
25
+
14
26
  def print_version
15
27
  puts "vzcdn Version:" + Vzcdn::VERSION
16
28
  exit
17
29
  end
18
30
 
31
+ def set_http_file(file)
32
+ $http_save_file = file
33
+ end
34
+
19
35
  def set_debug
20
36
  $debug += 1
21
37
  end
@@ -1,3 +1,3 @@
1
1
  module Vzcdn
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -19,6 +19,37 @@ class ZoneUpdate < Command
19
19
  end
20
20
  end
21
21
 
22
+ def empty_binding
23
+ binding()
24
+ end
25
+
26
+ # def guess_cast_value(value)
27
+ # b = empty_binding
28
+ # result = nil
29
+ # begin
30
+ # result = eval(value, b)
31
+ # rescue
32
+ # raise "Unable to parse expression #{value}"
33
+ # end
34
+ # result
35
+ # end
36
+
37
+ def guess_cast_value(value)
38
+ result = nil
39
+ if result.to_i.to_s == result
40
+ result = value.to_i
41
+ elsif value == 'null'
42
+ result = nil
43
+ elsif value == 'true'
44
+ result = true
45
+ elsif value == 'false'
46
+ result = false
47
+ else
48
+ result = value
49
+ end
50
+ result
51
+ end
52
+
22
53
  def update_struct(struct, key, value)
23
54
  name = Util.match_key(key, struct)
24
55
  if name.nil?
@@ -33,6 +64,14 @@ class ZoneUpdate < Command
33
64
  when [FalseClass]
34
65
  value = boolean_value_of(value)
35
66
  when [String]
67
+ when [NilClass]
68
+ value = guess_cast_value(value)
69
+ when [Hash]
70
+ if value == 'null'
71
+ value = nil
72
+ else
73
+ raise "cannot change entire object to a scaler value"
74
+ end
36
75
  else
37
76
  raise "cannot change item of type #{target_type}"
38
77
  end
@@ -0,0 +1,9 @@
1
+ [
2
+ {
3
+ "url": "https://api.edgecast.com/v2/mcc/customers/BED3/dns/routezones",
4
+ "method": "get",
5
+ "body": null,
6
+ "response_code": 403,
7
+ "response_body": "{\"Message\":\"Access Denied\"}"
8
+ }
9
+ ]
@@ -0,0 +1,8 @@
1
+ [
2
+ {
3
+ "cmd": "ec zone list",
4
+ "stdout": "Problem invoking REST method at server https://api.edgecast.com/v2/\nERROR:Bad http response code: 403 --- response:{\"Message\":\"Access Denied\"}\n",
5
+ "stderr": "",
6
+ "diff": ""
7
+ },
8
+ {} ]
@@ -0,0 +1,72 @@
1
+ [
2
+ {
3
+ "url": "https://api.edgecast.com/v2/mcc//dns/routezonestatus",
4
+ "method": "get",
5
+ "body": null,
6
+ "response_code": 200,
7
+ "response_body": "[{\"Id\":1,\"Name\":\"Active\"},{\"Id\":2,\"Name\":\"Inactive\"}]"
8
+ },
9
+ {
10
+ "url": "https://api.edgecast.com/v2/mcc//dns/routezonetypes",
11
+ "method": "get",
12
+ "body": null,
13
+ "response_code": 200,
14
+ "response_body": "[{\"Id\":1,\"Name\":\"Primary\"},{\"Id\":2,\"Name\":\"Secondary\"}]"
15
+ },
16
+ {
17
+ "url": "https://api.edgecast.com/v2/mcc/customers/BED3/dns/routezone",
18
+ "method": "post",
19
+ "body": "{\n \"Comment\": \"\",\n \"DomainName\": \"deleteme.\",\n \"Status\": 1,\n \"ZoneType\": 1\n}",
20
+ "response_code": 200,
21
+ "response_body": "{\"Comment\":\"\",\"DomainName\":\"deleteme.\",\"FailoverGroups\":[],\"LoadBalancingGroups\":[],\"Records\":null,\"Status\":1,\"Version\":1400600999,\"ZoneId\":5395,\"ZoneType\":1}"
22
+ },
23
+ {
24
+ "url": "https://api.edgecast.com/v2/mcc/customers/BED3/dns/routezones",
25
+ "method": "get",
26
+ "body": null,
27
+ "response_code": 200,
28
+ "response_body": "[{\"DomainName\":\"Daniel.Test.\",\"Status\":1,\"Version\":1400255085,\"ZoneId\":5389,\"ZoneType\":1},{\"DomainName\":\"deleteme.\",\"Status\":1,\"Version\":1400600999,\"ZoneId\":5395,\"ZoneType\":1},{\"DomainName\":\"mockzone.\",\"Status\":1,\"Version\":1400600830,\"ZoneId\":5385,\"ZoneType\":1},{\"DomainName\":\"nitin.\",\"Status\":1,\"Version\":1400096702,\"ZoneId\":5284,\"ZoneType\":1},{\"DomainName\":\"pythonzone.\",\"Status\":1,\"Version\":1400169998,\"ZoneId\":5366,\"ZoneType\":1},{\"DomainName\":\"vdmstest.com.\",\"Status\":1,\"Version\":1398108874,\"ZoneId\":4980,\"ZoneType\":1},{\"DomainName\":\"vzdms.com.\",\"Status\":1,\"Version\":1400510393,\"ZoneId\":5391,\"ZoneType\":2}]"
29
+ },
30
+ {
31
+ "url": "https://api.edgecast.com/v2/mcc//dns/routehttpmethodtypes",
32
+ "method": "get",
33
+ "body": null,
34
+ "response_code": 200,
35
+ "response_body": "[{\"Id\":1,\"Name\":\"GET\"},{\"Id\":2,\"Name\":\"POST\"}]"
36
+ },
37
+ {
38
+ "url": "https://api.edgecast.com/v2/mcc//dns/routereintegrationmethodtypes",
39
+ "method": "get",
40
+ "body": null,
41
+ "response_code": 200,
42
+ "response_body": "[{\"Id\":1,\"Name\":\"Automatic\"},{\"Id\":2,\"Name\":\"Manual\"}]"
43
+ },
44
+ {
45
+ "url": "https://api.edgecast.com/v2/mcc//dns/routehealthcheckipversion",
46
+ "method": "get",
47
+ "body": null,
48
+ "response_code": 200,
49
+ "response_body": "[{\"Id\":1,\"Name\":\"IPv4\"},{\"Id\":2,\"Name\":\"IPv6\"}]"
50
+ },
51
+ {
52
+ "url": "https://api.edgecast.com/v2/mcc//dns/routehealthchecktypes",
53
+ "method": "get",
54
+ "body": null,
55
+ "response_code": 200,
56
+ "response_body": "[{\"Id\":1,\"Name\":\"HTTP\"},{\"Id\":2,\"Name\":\"HTTPs\"},{\"Id\":3,\"Name\":\"TCP Open\"},{\"Id\":4,\"Name\":\"TCP SSL\"}]"
57
+ },
58
+ {
59
+ "url": "https://api.edgecast.com/v2/mcc/customers/BED3/dns/routezone",
60
+ "method": "put",
61
+ "body": "{\n \"Comment\": \"\",\n \"DomainName\": \"deleteme\",\n \"FailoverGroups\": [\n {\n \"Group\": {\n \"A\": [\n\n ],\n \"AAAA\": [\n {\n \"HealthCheck\": {\n \"CheckInterval\": 50,\n \"CheckTypeId\": 1,\n \"ContentVerification\": \"\",\n \"EmailNotificationAddress\": \"s.c@v.com\",\n \"FailedCheckThreshold\": 2,\n \"HTTPMethodId\": 1,\n \"IPAddress\": \"\",\n \"IPVersion\": 1,\n \"PortNumber\": null,\n \"ReintegrationMethodId\": 1,\n \"Status\": 4,\n \"StatusName\": \"Unknown\",\n \"Uri\": \"www.google.com\"\n },\n \"IsPrimary\": true,\n \"Record\": {\n \"Name\": \"fo1\",\n \"Rdata\": \"1:2:3::\",\n \"TTL\": \"600\"\n }\n },\n {\n \"HealthCheck\": null,\n \"IsPrimary\": false,\n \"Record\": {\n \"Name\": \"fo1\",\n \"Rdata\": \"1:2:4::\",\n \"TTL\": \"600\"\n }\n }\n ],\n \"CNAME\": [\n\n ]\n },\n \"GroupTypeId\": 3,\n \"Name\": \"fo1\"\n }\n ],\n \"LoadBalancingGroups\": [\n\n ],\n \"Records\": {\n \"A\": [\n {\n \"Name\": \"files\",\n \"Rdata\": \"196.245.5.1\",\n \"TTL\": 3600\n },\n {\n \"Name\": \"images\",\n \"Rdata\": \"196.245.5.2\",\n \"TTL\": 3600\n },\n {\n \"Name\": \"videos\",\n \"Rdata\": \"196.245.5.3\",\n \"TTL\": 3600\n }\n ],\n \"AAAA\": [\n\n ],\n \"CNAME\": [\n\n ],\n \"MX\": [\n\n ],\n \"NS\": [\n\n ],\n \"SPF\": [\n\n ],\n \"SRV\": [\n\n ],\n \"TXT\": [\n\n ]\n },\n \"Status\": 1,\n \"Version\": 1400600999,\n \"ZoneId\": 5395,\n \"ZoneType\": 1\n}",
62
+ "response_code": 200,
63
+ "response_body": "{\"Comment\":\"\",\"DomainName\":\"deleteme.\",\"FailoverGroups\":[{\"Group\":{\"A\":[],\"AAAA\":[{\"HealthCheck\":{\"CheckInterval\":50,\"CheckTypeId\":1,\"ContentVerification\":\"\",\"EmailNotificationAddress\":\"s.c@v.com\",\"FailedCheckThreshold\":2,\"HTTPMethodId\":null,\"IPAddress\":\"\",\"IPVersion\":1,\"PortNumber\":null,\"ReintegrationMethodId\":1,\"Status\":4,\"StatusName\":\"Unknown\",\"Uri\":\"www.google.com\"},\"IsPrimary\":true,\"Record\":{\"Name\":\"fo1\",\"Rdata\":\"1:2:3::\",\"TTL\":600}},{\"HealthCheck\":null,\"IsPrimary\":false,\"Record\":{\"Name\":\"fo1\",\"Rdata\":\"1:2:4::\",\"TTL\":600}}],\"CNAME\":[]},\"GroupTypeId\":3,\"Name\":\"fo1\"}],\"LoadBalancingGroups\":[],\"Records\":{\"A\":[{\"Name\":\"files\",\"Rdata\":\"196.245.5.1\",\"TTL\":3600},{\"Name\":\"images\",\"Rdata\":\"196.245.5.2\",\"TTL\":3600},{\"Name\":\"videos\",\"Rdata\":\"196.245.5.3\",\"TTL\":3600}],\"AAAA\":[],\"CNAME\":[],\"MX\":[],\"NS\":[],\"SPF\":[],\"SRV\":[],\"TXT\":[]},\"Status\":1,\"Version\":1400601759,\"ZoneId\":5395,\"ZoneType\":1}"
64
+ },
65
+ {
66
+ "url": "https://api.edgecast.com/v2/mcc/customers/BED3/dns/routezone/5395",
67
+ "method": "delete",
68
+ "body": null,
69
+ "response_code": 200,
70
+ "response_body": ""
71
+ }
72
+ ]
@@ -0,0 +1,44 @@
1
+ [
2
+ {
3
+ "url": "https://api.edgecast.com/v2/mcc//dns/routezonestatus",
4
+ "method": "get",
5
+ "body": null,
6
+ "response_code": 200,
7
+ "response_body": "[{\"Id\":1,\"Name\":\"Active\"},{\"Id\":2,\"Name\":\"Inactive\"}]"
8
+ },
9
+ {
10
+ "url": "https://api.edgecast.com/v2/mcc//dns/routezonetypes",
11
+ "method": "get",
12
+ "body": null,
13
+ "response_code": 200,
14
+ "response_body": "[{\"Id\":1,\"Name\":\"Primary\"},{\"Id\":2,\"Name\":\"Secondary\"}]"
15
+ },
16
+ {
17
+ "url": "https://api.edgecast.com/v2/mcc/customers/BED3/dns/routezone",
18
+ "method": "post",
19
+ "body": "{\n \"Comment\": \"\",\n \"DomainName\": \"deleteme.\",\n \"Status\": 1,\n \"ZoneType\": 1\n}",
20
+ "response_code": 200,
21
+ "response_body": "{\"Comment\":\"\",\"DomainName\":\"deleteme.\",\"FailoverGroups\":[],\"LoadBalancingGroups\":[],\"Records\":null,\"Status\":1,\"Version\":1400623544,\"ZoneId\":5398,\"ZoneType\":1}"
22
+ },
23
+ {
24
+ "url": "https://api.edgecast.com/v2/mcc/customers/BED3/dns/routezones",
25
+ "method": "get",
26
+ "body": null,
27
+ "response_code": 200,
28
+ "response_body": "[{\"DomainName\":\"Daniel.Test.\",\"Status\":1,\"Version\":1400255085,\"ZoneId\":5389,\"ZoneType\":1},{\"DomainName\":\"deleteme.\",\"Status\":1,\"Version\":1400623544,\"ZoneId\":5398,\"ZoneType\":1},{\"DomainName\":\"mockzone.\",\"Status\":1,\"Version\":1400600830,\"ZoneId\":5385,\"ZoneType\":1},{\"DomainName\":\"nitin.\",\"Status\":1,\"Version\":1400096702,\"ZoneId\":5284,\"ZoneType\":1},{\"DomainName\":\"pythonzone.\",\"Status\":1,\"Version\":1400169998,\"ZoneId\":5366,\"ZoneType\":1},{\"DomainName\":\"vdmstest.com.\",\"Status\":1,\"Version\":1398108874,\"ZoneId\":4980,\"ZoneType\":1},{\"DomainName\":\"vzdms.com.\",\"Status\":1,\"Version\":1400510393,\"ZoneId\":5391,\"ZoneType\":2}]"
29
+ },
30
+ {
31
+ "url": "https://api.edgecast.com/v2/mcc/customers/BED3/dns/routezone",
32
+ "method": "put",
33
+ "body": "{\n \"Comment\": \"\",\n \"DomainName\": \"deleteme\",\n \"FailoverGroups\": [\n\n ],\n \"LoadBalancingGroups\": [\n\n ],\n \"Records\": {\n \"A\": [\n {\n \"Name\": \"images\",\n \"Rdata\": \"196.145.5.1\",\n \"TTL\": 2600\n },\n {\n \"Name\": \"videos\",\n \"Rdata\": \"196.145.5.2\",\n \"TTL\": 2600\n },\n {\n \"Name\": \"@\",\n \"Rdata\": \"196.145.5.3\",\n \"TTL\": 2600\n }\n ],\n \"AAAA\": [\n\n ],\n \"CNAME\": [\n\n ],\n \"MX\": [\n\n ],\n \"NS\": [\n\n ],\n \"SPF\": [\n\n ],\n \"SRV\": [\n\n ],\n \"TXT\": [\n\n ]\n },\n \"Status\": 1,\n \"Version\": 1400623544,\n \"ZoneId\": 5398,\n \"ZoneType\": 1\n}",
34
+ "response_code": 200,
35
+ "response_body": "{\"Comment\":\"\",\"DomainName\":\"deleteme.\",\"FailoverGroups\":[],\"LoadBalancingGroups\":[],\"Records\":{\"A\":[{\"Name\":\"images\",\"Rdata\":\"196.145.5.1\",\"TTL\":2600},{\"Name\":\"videos\",\"Rdata\":\"196.145.5.2\",\"TTL\":2600},{\"Name\":\"@\",\"Rdata\":\"196.145.5.3\",\"TTL\":2600}],\"AAAA\":[],\"CNAME\":[],\"MX\":[],\"NS\":[],\"SPF\":[],\"SRV\":[],\"TXT\":[]},\"Status\":1,\"Version\":1400623630,\"ZoneId\":5398,\"ZoneType\":1}"
36
+ },
37
+ {
38
+ "url": "https://api.edgecast.com/v2/mcc/customers/BED3/dns/routezone/5398",
39
+ "method": "delete",
40
+ "body": null,
41
+ "response_code": 200,
42
+ "response_body": ""
43
+ }
44
+ ]
@@ -0,0 +1,50 @@
1
+ [
2
+ {
3
+ "cmd": "ec zone",
4
+ "stdout": "zone - dns zone command\nUsage:\n zone list\n zone create\n zone <zname> pull\n zone <zname> push\n zone <zname> delete\n zone <zname> audit\n zone <zname> diff\n zone <zname> [<drill-down-param>...] add\n zone <zname> [<drill-down-param>...] update\n zone <zname> <drill-down-param>... delete\n zone <zname> [<drill-down-param>...] [print]\n zone <zname> <drill-down-param>... sethc\nWhere:\n zname : name or id of zone\n drill-down-param : names of fields, or indexes of items, for drilling down\nOptions:\n -h or --help\n",
5
+ "stderr": "",
6
+ "diff": ""
7
+ },
8
+ {
9
+ "cmd": "ec zone create -h",
10
+ "stdout": "create - create new zone\nUsage:\n create <name> <status> [<comment>] [<type>='Primary']\nWhere:\n name : name of zone\n status : zone status - value from [\"Active\", \"Inactive\"]\n comment : zone comment\n type : zone type - value from [\"Primary\", \"Secondary\"]\nOptions:\n -h or --help\n",
11
+ "stderr": "",
12
+ "diff": ""
13
+ },
14
+ {
15
+ "cmd": "ec zone create deleteme Active",
16
+ "stdout": "creating zone on server\nitem DomainName ZoneId Status\n~~~~ ~~~~~~~~~~~~~~~ ~~~~~~ ~~~~~~\n1 Daniel.Test 5389 Active\n2 - deleteme 5398 Active\n3 - mockzone 5385 Active\n4 nitin 5284 Active\n5 pythonzone 5366 Active\n6 vdmstest.com 4980 Active\n7 vzdms.com 5391 Active\n",
17
+ "stderr": "",
18
+ "diff": ""
19
+ },
20
+ {
21
+ "cmd": "ec zone deleteme ",
22
+ "stdout": "ZoneId DomainName ZoneType Status Version Records FailoverGroups LoadBalancingGroups\n------ ---------- -------- ------ ---------- ------- -------------- -------------------\n5398 deleteme Primary Active 1400623544 ... [0] [0] \n",
23
+ "stderr": "",
24
+ "diff": ""
25
+ },
26
+ {
27
+ "cmd": "ec zone deleteme rec",
28
+ "stdout": "A AAAA CNAME MX NS SPF SRV TXT\n--- ---- ----- --- --- --- --- ---\n[0] [0] [0] [0] [0] [0] [0] [0]\n",
29
+ "stderr": "",
30
+ "diff": ""
31
+ },
32
+ {
33
+ "cmd": "ec zone deleteme rec a add images 196.244.5.1 3500",
34
+ "stdout": "Name Rdata TTL \n------ ----------- ----\nimages 196.244.5.1 3500\n",
35
+ "stderr": "",
36
+ "diff": ""
37
+ },
38
+ {
39
+ "cmd": "ec zone deleteme push",
40
+ "stdout": "pushing zone to server\n",
41
+ "stderr": "",
42
+ "diff": ""
43
+ },
44
+ {
45
+ "cmd": "ec zone deleteme delete",
46
+ "stdout": "deleting zone with id 5398\n",
47
+ "stderr": "",
48
+ "diff": ""
49
+ },
50
+ {} ]
@@ -0,0 +1,58 @@
1
+ [
2
+ {
3
+ "url": "https://api.edgecast.com/v2/mcc/customers/BED3/dns/routezones",
4
+ "method": "get",
5
+ "body": null,
6
+ "response_code": 200,
7
+ "response_body": "[{\"DomainName\":\"Daniel.Test.\",\"Status\":1,\"Version\":1400255085,\"ZoneId\":5389,\"ZoneType\":1},{\"DomainName\":\"mockzone.\",\"Status\":1,\"Version\":1400600830,\"ZoneId\":5385,\"ZoneType\":1},{\"DomainName\":\"nitin.\",\"Status\":1,\"Version\":1400096702,\"ZoneId\":5284,\"ZoneType\":1},{\"DomainName\":\"pythonzone.\",\"Status\":1,\"Version\":1400169998,\"ZoneId\":5366,\"ZoneType\":1},{\"DomainName\":\"vdmstest.com.\",\"Status\":1,\"Version\":1398108874,\"ZoneId\":4980,\"ZoneType\":1},{\"DomainName\":\"vzdms.com.\",\"Status\":1,\"Version\":1400510393,\"ZoneId\":5391,\"ZoneType\":2}]"
8
+ },
9
+ {
10
+ "url": "https://api.edgecast.com/v2/mcc//dns/routezonestatus",
11
+ "method": "get",
12
+ "body": null,
13
+ "response_code": 200,
14
+ "response_body": "[{\"Id\":1,\"Name\":\"Active\"},{\"Id\":2,\"Name\":\"Inactive\"}]"
15
+ },
16
+ {
17
+ "url": "https://api.edgecast.com/v2/mcc//dns/routezonetypes",
18
+ "method": "get",
19
+ "body": null,
20
+ "response_code": 200,
21
+ "response_body": "[{\"Id\":1,\"Name\":\"Primary\"},{\"Id\":2,\"Name\":\"Secondary\"}]"
22
+ },
23
+ {
24
+ "url": "https://api.edgecast.com/v2/mcc/customers/BED3/dns/routezone?id=5385",
25
+ "method": "get",
26
+ "body": null,
27
+ "response_code": 200,
28
+ "response_body": "{\"Comment\":\"\",\"DomainName\":\"mockzone.\",\"FailoverGroups\":[{\"Group\":{\"A\":[],\"AAAA\":[],\"CNAME\":[{\"HealthCheck\":null,\"IsPrimary\":true,\"Record\":{\"Name\":\"fo1\",\"Rdata\":\"www.google.com.mockzone.\",\"TTL\":300}},{\"HealthCheck\":null,\"IsPrimary\":false,\"Record\":{\"Name\":\"fo1\",\"Rdata\":\"www.yahoo.com.mockzone.\",\"TTL\":300}}]},\"GroupTypeId\":3,\"Name\":\"fo1\"}],\"LoadBalancingGroups\":[{\"Group\":{\"A\":[{\"HealthCheck\":null,\"Record\":{\"Name\":\"lb1\",\"Rdata\":\"192.186.1.1\",\"TTL\":300},\"Weight\":50},{\"HealthCheck\":null,\"Record\":{\"Name\":\"lb1\",\"Rdata\":\"192.186.2.2\",\"TTL\":300},\"Weight\":50}],\"AAAA\":[{\"HealthCheck\":{\"CheckInterval\":60,\"CheckTypeId\":1,\"ContentVerification\":\"\",\"EmailNotificationAddress\":\"a@b.c\",\"FailedCheckThreshold\":4,\"HTTPMethodId\":null,\"IPAddress\":\"\",\"IPVersion\":1,\"PortNumber\":null,\"ReintegrationMethodId\":1,\"Status\":2,\"StatusName\":\"Failed\",\"Uri\":\"www.google.com\"},\"Record\":{\"Name\":\"lb1\",\"Rdata\":\"2:2::\",\"TTL\":300},\"Weight\":50},{\"HealthCheck\":{\"CheckInterval\":60,\"CheckTypeId\":1,\"ContentVerification\":\"\",\"EmailNotificationAddress\":\"a@b.c\",\"FailedCheckThreshold\":4,\"HTTPMethodId\":null,\"IPAddress\":\"\",\"IPVersion\":1,\"PortNumber\":null,\"ReintegrationMethodId\":1,\"Status\":2,\"StatusName\":\"Failed\",\"Uri\":\"www.yahoo.com\"},\"Record\":{\"Name\":\"lb1\",\"Rdata\":\"1:1::\",\"TTL\":300},\"Weight\":50}],\"CNAME\":[]},\"GroupTypeId\":3,\"Name\":\"lb1\"},{\"Group\":{\"A\":[{\"HealthCheck\":null,\"Record\":{\"Name\":\"lb2\",\"Rdata\":\"192.186.3.3\",\"TTL\":300},\"Weight\":33},{\"HealthCheck\":null,\"Record\":{\"Name\":\"lb2\",\"Rdata\":\"192.186.4.4\",\"TTL\":300},\"Weight\":33},{\"HealthCheck\":null,\"Record\":{\"Name\":\"lb2\",\"Rdata\":\"192.186.5.5\",\"TTL\":300},\"Weight\":33}],\"AAAA\":[],\"CNAME\":[]},\"GroupTypeId\":3,\"Name\":\"lb2\"}],\"Records\":{\"A\":[{\"Name\":\"portal\",\"Rdata\":\"65.196.119.145\",\"TTL\":3600},{\"Name\":\"ops\",\"Rdata\":\"65.196.119.146\",\"TTL\":3600},{\"Name\":\"sso\",\"Rdata\":\"65.196.119.147\",\"TTL\":3600},{\"Name\":\"@\",\"Rdata\":\"23.96.96.142\",\"TTL\":4500}],\"AAAA\":[],\"CNAME\":[{\"Name\":\"mockasia\",\"Rdata\":\"wpc.BED3.edgecastcdn.net.mockzone.\",\"TTL\":3600},{\"Name\":\"mockeurope\",\"Rdata\":\"wpc.BED3.edgecastcdn.net.mockzone.\",\"TTL\":3600},{\"Name\":\"www\",\"Rdata\":\"VZ-CDN-Learn-75038-site1.azurewebsites.net.mockzone.\",\"TTL\":3600}],\"MX\":[],\"NS\":[],\"SPF\":[],\"SRV\":[],\"TXT\":[]},\"Status\":1,\"Version\":1400600830,\"ZoneId\":5385,\"ZoneType\":1}"
29
+ },
30
+ {
31
+ "url": "https://api.edgecast.com/v2/mcc//dns/routehealthchecktypes",
32
+ "method": "get",
33
+ "body": null,
34
+ "response_code": 200,
35
+ "response_body": "[{\"Id\":1,\"Name\":\"HTTP\"},{\"Id\":2,\"Name\":\"HTTPs\"},{\"Id\":3,\"Name\":\"TCP Open\"},{\"Id\":4,\"Name\":\"TCP SSL\"}]"
36
+ },
37
+ {
38
+ "url": "https://api.edgecast.com/v2/mcc//dns/routehttpmethodtypes",
39
+ "method": "get",
40
+ "body": null,
41
+ "response_code": 200,
42
+ "response_body": "[{\"Id\":1,\"Name\":\"GET\"},{\"Id\":2,\"Name\":\"POST\"}]"
43
+ },
44
+ {
45
+ "url": "https://api.edgecast.com/v2/mcc//dns/routehealthcheckipversion",
46
+ "method": "get",
47
+ "body": null,
48
+ "response_code": 200,
49
+ "response_body": "[{\"Id\":1,\"Name\":\"IPv4\"},{\"Id\":2,\"Name\":\"IPv6\"}]"
50
+ },
51
+ {
52
+ "url": "https://api.edgecast.com/v2/mcc//dns/routereintegrationmethodtypes",
53
+ "method": "get",
54
+ "body": null,
55
+ "response_code": 200,
56
+ "response_body": "[{\"Id\":1,\"Name\":\"Automatic\"},{\"Id\":2,\"Name\":\"Manual\"}]"
57
+ }
58
+ ]
@@ -0,0 +1,308 @@
1
+ [
2
+ {
3
+ "cmd": "ec zone list",
4
+ "stdout": "item DomainName ZoneId Status\n~~~~ ~~~~~~~~~~~~~~~ ~~~~~~ ~~~~~~\n1 Daniel.Test 5389 Active\n2 - mockzone 5385 Active\n3 nitin 5284 Active\n4 pythonzone 5366 Active\n5 vdmstest.com 4980 Active\n6 vzdms.com 5391 Active\n",
5
+ "stderr": "",
6
+ "diff": ""
7
+ },
8
+ {
9
+ "cmd": "ec zone mockzone pull",
10
+ "stdout": "'zones/mockzone.5385' saved locally\n",
11
+ "stderr": "",
12
+ "diff": ""
13
+ },
14
+ {
15
+ "cmd": "ec zone 5385 pull",
16
+ "stdout": "'zones/mockzone.5385' saved locally\n",
17
+ "stderr": "",
18
+ "diff": ""
19
+ },
20
+ {
21
+ "cmd": "ec zone mockzone",
22
+ "stdout": "ZoneId DomainName ZoneType Status Version Records FailoverGroups LoadBalancingGroups\n------ ---------- -------- ------ ---------- ------- -------------- -------------------\n5385 mockzone. Primary Active 1400600830 ... [1] [2] \n",
23
+ "stderr": "",
24
+ "diff": ""
25
+ },
26
+ {
27
+ "cmd": "ec zone 5385",
28
+ "stdout": "ZoneId DomainName ZoneType Status Version Records FailoverGroups LoadBalancingGroups\n------ ---------- -------- ------ ---------- ------- -------------- -------------------\n5385 mockzone. Primary Active 1400600830 ... [1] [2] \n",
29
+ "stderr": "",
30
+ "diff": ""
31
+ },
32
+ {
33
+ "cmd": "ec zone mockzone rec",
34
+ "stdout": "A AAAA CNAME MX NS SPF SRV TXT\n--- ---- ----- --- --- --- --- ---\n[4] [0] [3] [0] [0] [0] [0] [0]\n",
35
+ "stderr": "",
36
+ "diff": ""
37
+ },
38
+ {
39
+ "cmd": "ec zone mockzone rec a",
40
+ "stdout": "item Name Rdata TTL \n---- ------ -------------- ----\n1 portal 65.196.119.145 3600\n2 ops 65.196.119.146 3600\n3 sso 65.196.119.147 3600\n4 @ 23.96.96.142 4500\n",
41
+ "stderr": "",
42
+ "diff": ""
43
+ },
44
+ {
45
+ "cmd": "ec zone mockzone rec a cn",
46
+ "stdout": "ERROR:no (unique) key matches cn\n",
47
+ "stderr": "",
48
+ "diff": ""
49
+ },
50
+ {
51
+ "cmd": "ec zone mockzone rec cn",
52
+ "stdout": "item Name Rdata TTL \n---- ---------- ---------------------------------------------------- ----\n1 mockasia wpc.BED3.edgecastcdn.net.mockzone. 3600\n2 mockeurope wpc.BED3.edgecastcdn.net.mockzone. 3600\n3 www VZ-CDN-Learn-75038-site1.azurewebsites.net.mockzone. 3600\n",
53
+ "stderr": "",
54
+ "diff": ""
55
+ },
56
+ {
57
+ "cmd": "ec zone mockzone rec cn print -h",
58
+ "stdout": "print - print zone data. ~~~~ online, ---- local copy\nUsage:\n print \nOptions:\n -h or --help\n -j or --json\n -t or --type=<one of [\"csv\", \"json\"]>\n -n or --no-header\n -c or --columns=<comma separated column names, or * for all columns>\n",
59
+ "stderr": "",
60
+ "diff": ""
61
+ },
62
+ {
63
+ "cmd": "ec zone mockzone rec cn print --columns=Name,Rdata",
64
+ "stdout": "Name Rdata \n---------- ----------------------------------------------------\nmockasia wpc.BED3.edgecastcdn.net.mockzone. \nmockeurope wpc.BED3.edgecastcdn.net.mockzone. \nwww VZ-CDN-Learn-75038-site1.azurewebsites.net.mockzone.\n",
65
+ "stderr": "",
66
+ "diff": ""
67
+ },
68
+ {
69
+ "cmd": "ec zone mockzone ",
70
+ "stdout": "ZoneId DomainName ZoneType Status Version Records FailoverGroups LoadBalancingGroups\n------ ---------- -------- ------ ---------- ------- -------------- -------------------\n5385 mockzone. Primary Active 1400600830 ... [1] [2] \n",
71
+ "stderr": "",
72
+ "diff": ""
73
+ },
74
+ {
75
+ "cmd": "ec zone mockzone fail",
76
+ "stdout": "Group GroupTypeId Name TTL\n----- ----------- ---- ---\n... 3 fo1 300\n",
77
+ "stderr": "",
78
+ "diff": ""
79
+ },
80
+ {
81
+ "cmd": "ec zone mockzone fail 1 group",
82
+ "stdout": "A AAAA CNAME\n--- ---- -----\n[0] [0] [2] \n",
83
+ "stderr": "",
84
+ "diff": ""
85
+ },
86
+ {
87
+ "cmd": "ec zone mockzone fail 1 group cn",
88
+ "stdout": "item HealthCheck IsPrimary Rdata \n---- ----------- --------- ------------------------\n1 null true www.google.com.mockzone.\n2 null false www.yahoo.com.mockzone. \n",
89
+ "stderr": "",
90
+ "diff": ""
91
+ },
92
+ {
93
+ "cmd": "ec zone mockzone load",
94
+ "stdout": "item Group GroupTypeId Name TTL\n---- ----- ----------- ---- ---\n1 ... 3 lb1 300\n2 ... 3 lb2 300\n",
95
+ "stderr": "",
96
+ "diff": ""
97
+ },
98
+ {
99
+ "cmd": "ec zone mockzone load 1",
100
+ "stdout": "Group GroupTypeId Name TTL\n----- ----------- ---- ---\n... 3 lb1 300\n",
101
+ "stderr": "",
102
+ "diff": ""
103
+ },
104
+ {
105
+ "cmd": "ec zone mockzone load 1 group",
106
+ "stdout": "A AAAA CNAME\n--- ---- -----\n[2] [2] [0] \n",
107
+ "stderr": "",
108
+ "diff": ""
109
+ },
110
+ {
111
+ "cmd": "ec zone mockzone load 1 group a",
112
+ "stdout": "item HealthCheck Weight Rdata \n---- ----------- ------ -----------\n1 null 50 192.186.1.1\n2 null 50 192.186.2.2\n",
113
+ "stderr": "",
114
+ "diff": ""
115
+ },
116
+ {
117
+ "cmd": "ec zone mockzone load 1 group aaaa",
118
+ "stdout": "item HealthCheck Weight Rdata\n---- ----------- ------ -----\n1 ... 50 2:2::\n2 ... 50 1:1::\n",
119
+ "stderr": "",
120
+ "diff": ""
121
+ },
122
+ {
123
+ "cmd": "ec zone mockzone load 1 group aaaa",
124
+ "stdout": "item HealthCheck Weight Rdata\n---- ----------- ------ -----\n1 ... 50 2:2::\n2 ... 50 1:1::\n",
125
+ "stderr": "",
126
+ "diff": ""
127
+ },
128
+ {
129
+ "cmd": "ec zone mockzone load 1 group aaaa h",
130
+ "stdout": "item CheckInterval CheckTypeId ContentVerification EmailNotificationAddress FailedCheckThreshold HTTPMethodId IPAddress IPVersion PortNumber ReintegrationMethodId Status StatusName Uri \n---- ------------- ----------- ------------------- ------------------------ -------------------- ------------ --------- --------- ---------- --------------------- ------ ---------- --------------\n1 60 HTTP a@b.c 4 null IPv4 null Automatic 2 Failed www.google.com\n2 60 HTTP a@b.c 4 null IPv4 null Automatic 2 Failed www.yahoo.com \n",
131
+ "stderr": "",
132
+ "diff": ""
133
+ },
134
+ {
135
+ "cmd": "ec zone mockzone load 2",
136
+ "stdout": "Group GroupTypeId Name TTL\n----- ----------- ---- ---\n... 3 lb2 300\n",
137
+ "stderr": "",
138
+ "diff": ""
139
+ },
140
+ {
141
+ "cmd": "ec zone mockzone load 2 group",
142
+ "stdout": "A AAAA CNAME\n--- ---- -----\n[3] [0] [0] \n",
143
+ "stderr": "",
144
+ "diff": ""
145
+ },
146
+ {
147
+ "cmd": "ec zone mockzone load 2 group a",
148
+ "stdout": "item HealthCheck Weight Rdata \n---- ----------- ------ -----------\n1 null 33 192.186.3.3\n2 null 33 192.186.4.4\n3 null 33 192.186.5.5\n",
149
+ "stderr": "",
150
+ "diff": ""
151
+ },
152
+ {
153
+ "cmd": "ec zone mockzone load 2 group a print -j",
154
+ "stdout": "[\n {\n \"HealthCheck\": null,\n \"Weight\": 33,\n \"Rdata\": \"192.186.3.3\"\n },\n {\n \"HealthCheck\": null,\n \"Weight\": 33,\n \"Rdata\": \"192.186.4.4\"\n },\n {\n \"HealthCheck\": null,\n \"Weight\": 33,\n \"Rdata\": \"192.186.5.5\"\n }\n]\n",
155
+ "stderr": "",
156
+ "diff": ""
157
+ },
158
+ {
159
+ "cmd": "ec zone mockzone load 2 group a print -h",
160
+ "stdout": "print - print zone data. ~~~~ online, ---- local copy\nUsage:\n print \nOptions:\n -h or --help\n -j or --json\n -t or --type=<one of [\"csv\", \"json\"]>\n -n or --no-header\n -c or --columns=<comma separated column names, or * for all columns>\n",
161
+ "stderr": "",
162
+ "diff": ""
163
+ },
164
+ {
165
+ "cmd": "ec zone mockzone load 2 group a print -tcsv",
166
+ "stdout": "item,HealthCheck,Weight,Rdata\n1,null,33,192.186.3.3\n2,null,33,192.186.4.4\n3,null,33,192.186.5.5\n",
167
+ "stderr": "",
168
+ "diff": ""
169
+ },
170
+ {
171
+ "cmd": "ec zone mockzone load 2 group a print -tcsv --no-header",
172
+ "stdout": "1,null,33,192.186.3.3\n2,null,33,192.186.4.4\n3,null,33,192.186.5.5\n",
173
+ "stderr": "",
174
+ "diff": ""
175
+ },
176
+ {
177
+ "cmd": "ec zone mockzone",
178
+ "stdout": "ZoneId DomainName ZoneType Status Version Records FailoverGroups LoadBalancingGroups\n------ ---------- -------- ------ ---------- ------- -------------- -------------------\n5385 mockzone. Primary Active 1400600830 ... [1] [2] \n",
179
+ "stderr": "",
180
+ "diff": ""
181
+ },
182
+ {
183
+ "cmd": "ec zone 5385",
184
+ "stdout": "ZoneId DomainName ZoneType Status Version Records FailoverGroups LoadBalancingGroups\n------ ---------- -------- ------ ---------- ------- -------------- -------------------\n5385 mockzone. Primary Active 1400600830 ... [1] [2] \n",
185
+ "stderr": "",
186
+ "diff": ""
187
+ },
188
+ {
189
+ "cmd": "ec zone 5385 rec",
190
+ "stdout": "A AAAA CNAME MX NS SPF SRV TXT\n--- ---- ----- --- --- --- --- ---\n[4] [0] [3] [0] [0] [0] [0] [0]\n",
191
+ "stderr": "",
192
+ "diff": ""
193
+ },
194
+ {
195
+ "cmd": "ec zone 5385 rec a",
196
+ "stdout": "item Name Rdata TTL \n---- ------ -------------- ----\n1 portal 65.196.119.145 3600\n2 ops 65.196.119.146 3600\n3 sso 65.196.119.147 3600\n4 @ 23.96.96.142 4500\n",
197
+ "stderr": "",
198
+ "diff": ""
199
+ },
200
+ {
201
+ "cmd": "ec zone 5385 rec a add",
202
+ "stdout": "add - add record/group/healthcheck\nUsage:\n add <name> <rdata> <ttl>\nWhere:\n name : Name of the node to which this record pertains\n rdata : Additional resource record data, such as IP Address\n ttl : Time to live, in seconds\nOptions:\n -h or --help\n",
203
+ "stderr": "",
204
+ "diff": ""
205
+ },
206
+ {
207
+ "cmd": "ec zone 5385 rec a add figs 66.196.119.148 4500",
208
+ "stdout": "item Name Rdata TTL \n---- ------ -------------- ----\n1 portal 65.196.119.145 3600\n2 ops 65.196.119.146 3600\n3 sso 65.196.119.147 3600\n4 @ 23.96.96.142 4500\n5 figs 66.196.119.148 4500\n",
209
+ "stderr": "",
210
+ "diff": "145a146,150\n> },\n> {\n> \"Name\": \"figs\",\n> \"Rdata\": \"66.196.119.148\",\n> \"TTL\": 4500\n"
211
+ },
212
+ {
213
+ "cmd": "ec zone mockzone",
214
+ "stdout": "ZoneId DomainName ZoneType Status Version Records FailoverGroups LoadBalancingGroups\n------ ---------- -------- ------ ---------- ------- -------------- -------------------\n5385 mockzone. Primary Active 1400600830 ... [1] [2] \n",
215
+ "stderr": "",
216
+ "diff": ""
217
+ },
218
+ {
219
+ "cmd": "ec zone mockzone fail",
220
+ "stdout": "Group GroupTypeId Name TTL\n----- ----------- ---- ---\n... 3 fo1 300\n",
221
+ "stderr": "",
222
+ "diff": ""
223
+ },
224
+ {
225
+ "cmd": "ec zone mockzone fail add",
226
+ "stdout": "add - add record/group/healthcheck\nUsage:\n add <gname> [<ttl>='300']\nWhere:\n gname : Name of load balancing or failover group\n ttl : Time to live, in seconds\nOptions:\n -h or --help\n",
227
+ "stderr": "",
228
+ "diff": ""
229
+ },
230
+ {
231
+ "cmd": "ec zone mockzone fail add fo2 450",
232
+ "stdout": "item Group GroupTypeId Name TTL\n---- ----- ----------- ---- ---\n1 ... 3 fo1 300\n2 ... 3 fo2 450\n",
233
+ "stderr": "",
234
+ "diff": "28a29,44\n> },\n> {\n> \"Group\": {\n> \"A\": [\n> \n> ],\n> \"AAAA\": [\n> \n> ],\n> \"CNAME\": [\n> \n> ]\n> },\n> \"GroupTypeId\": 3,\n> \"Name\": \"fo2\",\n> \"TTL\": \"450\"\n"
235
+ },
236
+ {
237
+ "cmd": "ec zone mockzone fail 2 group",
238
+ "stdout": "ERROR:index 2 out of bounds\n",
239
+ "stderr": "",
240
+ "diff": ""
241
+ },
242
+ {
243
+ "cmd": "ec zone mockzone fail 2 ",
244
+ "stdout": "ERROR:index 2 out of bounds\n",
245
+ "stderr": "",
246
+ "diff": ""
247
+ },
248
+ {
249
+ "cmd": "ec zone mockzone fail ",
250
+ "stdout": "Group GroupTypeId Name TTL\n----- ----------- ---- ---\n... 3 fo1 300\n",
251
+ "stderr": "",
252
+ "diff": ""
253
+ },
254
+ {
255
+ "cmd": "ec zone mockzone load",
256
+ "stdout": "item Group GroupTypeId Name TTL\n---- ----- ----------- ---- ---\n1 ... 3 lb1 300\n2 ... 3 lb2 300\n",
257
+ "stderr": "",
258
+ "diff": ""
259
+ },
260
+ {
261
+ "cmd": "ec zone mockzone load 2",
262
+ "stdout": "Group GroupTypeId Name TTL\n----- ----------- ---- ---\n... 3 lb2 300\n",
263
+ "stderr": "",
264
+ "diff": ""
265
+ },
266
+ {
267
+ "cmd": "ec zone mockzone load 2 group",
268
+ "stdout": "A AAAA CNAME\n--- ---- -----\n[3] [0] [0] \n",
269
+ "stderr": "",
270
+ "diff": ""
271
+ },
272
+ {
273
+ "cmd": "ec zone mockzone load 2 group a",
274
+ "stdout": "item HealthCheck Weight Rdata \n---- ----------- ------ -----------\n1 null 33 192.186.3.3\n2 null 33 192.186.4.4\n3 null 33 192.186.5.5\n",
275
+ "stderr": "",
276
+ "diff": ""
277
+ },
278
+ {
279
+ "cmd": "ec zone mockzone load 2 group a add",
280
+ "stdout": "add - add record/group/healthcheck\nUsage:\n add <weight> <rdata>\nWhere:\n weight : Load balancing weight assigned to the record\n rdata : Additional resource record data, such as IP Address\nOptions:\n -h or --help\n",
281
+ "stderr": "",
282
+ "diff": ""
283
+ },
284
+ {
285
+ "cmd": "ec zone mockzone load 2 group a add 44 192.186.5.6",
286
+ "stdout": "level = zone.LoadBalancingGroups[2].Group.A\nitem HealthCheck Weight Rdata \n---- ----------- ------ -----------\n1 null 33 192.186.3.3\n2 null 33 192.186.4.4\n3 null 33 192.186.5.5\n4 null 44 192.186.5.6\n",
287
+ "stderr": "",
288
+ "diff": "110a111,115\n> },\n> {\n> \"HealthCheck\": null,\n> \"Weight\": 44,\n> \"Rdata\": \"192.186.5.6\"\n"
289
+ },
290
+ {
291
+ "cmd": "ec zone mockzone load 2 group a 1",
292
+ "stdout": "HealthCheck Weight Rdata \n----------- ------ -----------\nnull 33 192.186.3.3\n",
293
+ "stderr": "",
294
+ "diff": ""
295
+ },
296
+ {
297
+ "cmd": "ec zone mockzone load 2 group a 1 sethc",
298
+ "stdout": "sethc - set health check for group member\nUsage:\n sethc <http-type> <uri> <ip-version> <check-interval> <fail-threshold> <email-address> [<http-method>='GET'] [<content-verification>] [<reintegration-method>='Automatic']\n sethc <tcp-type> <ip-address> <port> <check-interval> <fail-threshold> <email-address> [<content-verification>] [<reintegration-method>='Automatic']\nWhere:\n http-type : for HTTP or secure HTTP health checks - value from [\"HTTP\", \"HTTPs\"]\n uri : URI to which health checks will be directed\n ip-version : IP version - value from [\"IPv4\", \"IPv6\"]\n check-interval : number of seconds between health checks\n fail-threshold : number of consecutive succeeds/fails for status change (1-10)\n email-address : email address to which notifications will be sent\n http-method : HTTP method for health check - value from [\"GET\", \"POST\"]\n content-verification : text that will be used to verify health check\n reintegration-method : how and unhealthy server/domain will be integrated back - value from [\"Automatic\", \"Manual\"]\n tcp-type : for TCP or TCP SSL health checks - value from [\"TCP Open\", \"TCP SSL\"]\n ip-address : ip address to which TCP health checks will be directed (IPv4 or IPv6)\n port : ip port to which TCP health checks will be directed (1-65535)\nOptions:\n -h or --help\n",
299
+ "stderr": "",
300
+ "diff": ""
301
+ },
302
+ {
303
+ "cmd": "ec zone mockzone load 2 group a 1 sethc HTTPs www.google.com IPv6 300 2 s.c@v.com",
304
+ "stdout": "CheckInterval CheckTypeId ContentVerification EmailNotificationAddress FailedCheckThreshold HTTPMethodId IPAddress IPVersion PortNumber ReintegrationMethodId Status StatusName Uri \n------------- ----------- ------------------- ------------------------ -------------------- ------------ --------- --------- ---------- --------------------- ------ ---------- --------------\n300 HTTPs s.c@v.com 2 GET IPv6 null Automatic 4 Unknown www.google.com\n",
305
+ "stderr": "",
306
+ "diff": "98c98,112\n< \"HealthCheck\": null,\n---\n> \"HealthCheck\": {\n> \"CheckInterval\": 300,\n> \"CheckTypeId\": \"HTTPs\",\n> \"ContentVerification\": \"\",\n> \"EmailNotificationAddress\": \"s.c@v.com\",\n> \"FailedCheckThreshold\": 2,\n> \"HTTPMethodId\": \"GET\",\n> \"IPAddress\": \"\",\n> \"IPVersion\": \"IPv6\",\n> \"PortNumber\": null,\n> \"ReintegrationMethodId\": \"Automatic\",\n> \"Status\": 4,\n> \"StatusName\": \"Unknown\",\n> \"Uri\": \"www.google.com\"\n> },\n"
307
+ },
308
+ {} ]