github.com/akamai/AkamaiOPEN-edgegrid-golang@v1.2.2/configgtm-v1_5/domain_test.go (about) 1 package configgtm 2 3 import ( 4 "testing" 5 6 "github.com/akamai/AkamaiOPEN-edgegrid-golang/jsonhooks-v1" 7 8 "github.com/stretchr/testify/assert" 9 "github.com/stretchr/testify/require" 10 "gopkg.in/h2non/gock.v1" 11 ) 12 13 func instantiateDomain() *Domain { 14 15 domain := NewDomain(gtmTestDomain, "basic") 16 domainData := []byte(`{ 17 "cnameCoalescingEnabled" : false, 18 "defaultErrorPenalty" : 75, 19 "defaultHealthMax" : null, 20 "defaultHealthMultiplier" : null, 21 "defaultHealthThreshold" : null, 22 "defaultMaxUnreachablePenalty" : null, 23 "defaultSslClientCertificate" : null, 24 "defaultSslClientPrivateKey" : null, 25 "defaultTimeoutPenalty" : 25, 26 "defaultUnreachableThreshold" : null, 27 "emailNotificationList" : [ ], 28 "endUserMappingEnabled" : false, 29 "lastModified" : "2019-06-14T19:36:13.174+00:00", 30 "lastModifiedBy" : "operator", 31 "loadFeedback" : false, 32 "mapUpdateInterval" : 600, 33 "maxProperties" : 100, 34 "maxResources" : 9999, 35 "maxTestTimeout" : 60.0, 36 "maxTTL" : 3600, 37 "minPingableRegionFraction" : null, 38 "minTestInterval" : 0, 39 "minTTL" : 0, 40 "modificationComments" : "Add Property testproperty", 41 "name" : "gtmdomtest.akadns.net", 42 "pingInterval" : null, 43 "pingPacketSize" : null, 44 "roundRobinPrefix" : null, 45 "servermonitorLivenessCount" : null, 46 "servermonitorLoadCount" : null, 47 "servermonitorPool" : null, 48 "type" : "basic", 49 "status" : { 50 "message" : "Change Pending", 51 "changeId" : "df6c04e4-6327-4e0f-8872-bfe9fb2693d2", 52 "propagationStatus" : "PENDING", 53 "propagationStatusDate" : "2019-06-14T19:36:13.174+00:00", 54 "passingValidation" : true, 55 "links" : [ { 56 "rel" : "self", 57 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/status/current" 58 } ] 59 }, 60 "loadImbalancePercentage" : null, 61 "domainVersionId" : null, 62 "resources" : [ ], 63 "properties" : [ { 64 "backupCName" : null, 65 "backupIp" : null, 66 "balanceByDownloadScore" : false, 67 "cname" : null, 68 "comments" : null, 69 "dynamicTTL" : 300, 70 "failoverDelay" : null, 71 "failbackDelay" : null, 72 "ghostDemandReporting" : false, 73 "handoutMode" : "normal", 74 "handoutLimit" : 1, 75 "healthMax" : null, 76 "healthMultiplier" : null, 77 "healthThreshold" : null, 78 "lastModified" : "2019-06-14T19:36:13.174+00:00", 79 "livenessTests" : [ ], 80 "loadImbalancePercentage" : null, 81 "mapName" : null, 82 "maxUnreachablePenalty" : null, 83 "minLiveFraction" : null, 84 "mxRecords" : [ ], 85 "name" : "testproperty", 86 "scoreAggregationType" : "median", 87 "stickinessBonusConstant" : null, 88 "stickinessBonusPercentage" : null, 89 "staticTTL" : null, 90 "trafficTargets" : [ { 91 "datacenterId" : 3131, 92 "enabled" : true, 93 "weight" : 100.0, 94 "handoutCName" : null, 95 "name" : null, 96 "servers" : [ "1.2.3.4" ] 97 } ], 98 "type" : "performance", 99 "unreachableThreshold" : null, 100 "useComputedTargets" : false, 101 "weightedHashBitsForIPv4" : null, 102 "weightedHashBitsForIPv6" : null, 103 "ipv6" : false, 104 "links" : [ { 105 "rel" : "self", 106 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/properties/testproperty" 107 } ] 108 } ], 109 "datacenters" : [ { 110 "datacenterId" : 3131, 111 "nickname" : "testDC1", 112 "scorePenalty" : 0, 113 "city" : null, 114 "stateOrProvince" : null, 115 "country" : null, 116 "latitude" : null, 117 "longitude" : null, 118 "cloneOf" : null, 119 "virtual" : true, 120 "defaultLoadObject" : null, 121 "continent" : null, 122 "servermonitorPool" : null, 123 "servermonitorLivenessCount" : null, 124 "servermonitorLoadCount" : null, 125 "pingInterval" : null, 126 "pingPacketSize" : null, 127 "cloudServerTargeting" : false, 128 "cloudServerHostHeaderOverride" : false, 129 "links" : [ { 130 "rel" : "self", 131 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/datacenters/3131" 132 } ] 133 } ], 134 "geographicMaps" : [ ], 135 "cidrMaps" : [ ], 136 "asMaps" : [ ], 137 "links" : [ { 138 "rel" : "self", 139 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net" 140 }, { 141 "rel" : "datacenters", 142 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/datacenters" 143 }, { 144 "rel" : "properties", 145 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/properties" 146 }, { 147 "rel" : "geographic-maps", 148 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/geographic-maps" 149 }, { 150 "rel" : "cidr-maps", 151 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/cidr-maps" 152 }, { 153 "rel" : "resources", 154 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/resources" 155 }, { 156 "rel" : "as-maps", 157 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/as-maps" 158 } ] 159 }`) 160 jsonhooks.Unmarshal(domainData, domain) 161 162 return domain 163 164 } 165 166 // Verify GetListDomains. Sould pass, e.g. no API errors and non nil list. 167 func TestListDomains(t *testing.T) { 168 169 defer gock.Off() 170 171 mock := gock.New("https://akaa-baseurl-xxxxxxxxxxx-xxxxxxxxxxxxx.luna.akamaiapis.net/config-gtm/v1/domains") 172 mock. 173 Get("/config-gtm/v1/domains"). 174 HeaderPresent("Authorization"). 175 Reply(200). 176 SetHeader("Content-Type", "application/vnd.config-gtm.v1.5+json;charset=UTF-8"). 177 BodyString(`{ 178 "items" : [ { 179 "name" : "gtmdomtest.akadns.net", 180 "status" : "Change Pending", 181 "acgId" : "1-3CV382", 182 "lastModified" : "2019-06-06T19:07:20.000+00:00", 183 "lastModifiedBy" : "operator", 184 "changeId" : "c3e1b771-2500-40c9-a7da-6c3cdbce1936", 185 "activationState" : "PENDING", 186 "modificationComments" : "mock test", 187 "links" : [ { 188 "rel" : "self", 189 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net" 190 } ] 191 } ] 192 }`) 193 194 Init(config) 195 196 domainsList, err := ListDomains() 197 assert.NoError(t, err) 198 assert.NotEqual(t, domainsList, nil) 199 assert.Equal(t, "gtmdomtest.akadns.net", domainsList[0].Name) 200 201 } 202 203 // Verify GetDomain. Name hardcoded. Should pass, e.g. no API errors and domain returned 204 func TestGetDomain(t *testing.T) { 205 206 defer gock.Off() 207 208 mock := gock.New("https://akaa-baseurl-xxxxxxxxxxx-xxxxxxxxxxxxx.luna.akamaiapis.net/config-gtm/v1/domains/" + gtmTestDomain) 209 mock. 210 Get("/config-gtm/v1/domains/"+gtmTestDomain). 211 HeaderPresent("Authorization"). 212 Reply(200). 213 SetHeader("Content-Type", "application/vnd.config-gtm.v1.5+json;charset=UTF-8"). 214 BodyString(`{ 215 "cidrMaps": [], 216 "datacenters": [ 217 { 218 "city": "Snæfellsjökull", 219 "cloneOf": null, 220 "cloudServerTargeting": false, 221 "continent": "EU", 222 "country": "IS", 223 "datacenterId": 3132, 224 "defaultLoadObject": { 225 "loadObject": null, 226 "loadObjectPort": 0, 227 "loadServers": null 228 }, 229 "latitude": 64.808, 230 "links": [ 231 { 232 "href": "https://akab-ymtebc45gco3ypzj-apz4yxpek55y7fyv.luna.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/datacenters/3132", 233 "rel": "self" 234 } 235 ], 236 "longitude": -23.776, 237 "nickname": "property_test_dc2", 238 "stateOrProvince": null, 239 "virtual": true 240 }, 241 { 242 "city": "Philadelphia", 243 "cloneOf": null, 244 "cloudServerTargeting": true, 245 "continent": "NA", 246 "country": "US", 247 "datacenterId": 3133, 248 "defaultLoadObject": { 249 "loadObject": null, 250 "loadObjectPort": 0, 251 "loadServers": null 252 }, 253 "latitude": 39.95, 254 "links": [ 255 { 256 "href": "https://akab-ymtebc45gco3ypzj-apz4yxpek55y7fyv.luna.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/datacenters/3133", 257 "rel": "self" 258 } 259 ], 260 "longitude": -75.167, 261 "nickname": "property_test_dc3", 262 "stateOrProvince": null, 263 "virtual": true 264 }, 265 { 266 "city": "Downpat", 267 "cloneOf": null, 268 "cloudServerTargeting": false, 269 "continent": "EU", 270 "country": "GB", 271 "datacenterId": 3131, 272 "defaultLoadObject": { 273 "loadObject": null, 274 "loadObjectPort": 0, 275 "loadServers": null 276 }, 277 "latitude": 54.367, 278 "links": [ 279 { 280 "href": "https://akab-ymtebc45gco3ypzj-apz4yxpek55y7fyv.luna.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/datacenters/3131", 281 "rel": "self" 282 } 283 ], 284 "longitude": -5.582, 285 "nickname": "property_test_dc1", 286 "stateOrProvince": "ha", 287 "virtual": true 288 } 289 ], 290 "defaultErrorPenalty": 75, 291 "defaultSslClientCertificate": null, 292 "defaultSslClientPrivateKey": null, 293 "defaultTimeoutPenalty": 25, 294 "emailNotificationList": [], 295 "geographicMaps": [], 296 "lastModified": "2019-04-25T14:53:12.000+00:00", 297 "lastModifiedBy": "operator", 298 "links": [ 299 { 300 "href": "https://akab-ymtebc45gco3ypzj-apz4yxpek55y7fyv.luna.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net", 301 "rel": "self" 302 }, 303 { 304 "href": "https://akab-ymtebc45gco3ypzj-apz4yxpek55y7fyv.luna.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/datacenters", 305 "rel": "datacenters" 306 }, 307 { 308 "href": "https://akab-ymtebc45gco3ypzj-apz4yxpek55y7fyv.luna.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/properties", 309 "rel": "properties" 310 }, 311 { 312 "href": "https://akab-ymtebc45gco3ypzj-apz4yxpek55y7fyv.luna.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/geographic-maps", 313 "rel": "geographic-maps" 314 }, 315 { 316 "href": "https://akab-ymtebc45gco3ypzj-apz4yxpek55y7fyv.luna.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/cidr-maps", 317 "rel": "cidr-maps" 318 }, 319 { 320 "href": "https://akab-ymtebc45gco3ypzj-apz4yxpek55y7fyv.luna.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/resources", 321 "rel": "resources" 322 } 323 ], 324 "loadFeedback": false, 325 "loadImbalancePercentage": 10.0, 326 "modificationComments": "Edit Property test_property", 327 "name": "gtmdomtest.akadns.net", 328 "properties": [ 329 { 330 "backupCName": null, 331 "backupIp": null, 332 "balanceByDownloadScore": false, 333 "cname": "www.boo.wow", 334 "comments": null, 335 "dynamicTTL": 300, 336 "failbackDelay": 0, 337 "failoverDelay": 0, 338 "handoutMode": "normal", 339 "healthMax": null, 340 "healthMultiplier": null, 341 "healthThreshold": null, 342 "ipv6": false, 343 "lastModified": "2019-04-25T14:53:12.000+00:00", 344 "links": [ 345 { 346 "href": "https://akab-ymtebc45gco3ypzj-apz4yxpek55y7fyv.luna.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/properties/test_property", 347 "rel": "self" 348 } 349 ], 350 "livenessTests": [ 351 { 352 "disableNonstandardPortWarning": false, 353 "hostHeader": null, 354 "httpError3xx": true, 355 "httpError4xx": true, 356 "httpError5xx": true, 357 "name": "health check", 358 "requestString": null, 359 "responseString": null, 360 "sslClientCertificate": null, 361 "sslClientPrivateKey": null, 362 "testInterval": 60, 363 "testObject": "/status", 364 "testObjectPassword": null, 365 "testObjectPort": 80, 366 "testObjectProtocol": "HTTP", 367 "testObjectUsername": null, 368 "testTimeout": 25.0 369 } 370 ], 371 "loadImbalancePercentage": 10.0, 372 "mapName": null, 373 "maxUnreachablePenalty": null, 374 "mxRecords": [], 375 "name": "test_property", 376 "scoreAggregationType": "mean", 377 "staticTTL": 600, 378 "stickinessBonusConstant": null, 379 "stickinessBonusPercentage": 50, 380 "trafficTargets": [ 381 { 382 "datacenterId": 3131, 383 "enabled": true, 384 "handoutCName": null, 385 "name": null, 386 "servers": [ 387 "1.2.3.4", 388 "1.2.3.5" 389 ], 390 "weight": 50.0 391 }, 392 { 393 "datacenterId": 3132, 394 "enabled": true, 395 "handoutCName": "www.google.com", 396 "name": null, 397 "servers": [], 398 "weight": 25.0 399 }, 400 { 401 "datacenterId": 3133, 402 "enabled": true, 403 "handoutCName": "www.comcast.com", 404 "name": null, 405 "servers": [ 406 "www.comcast.com" 407 ], 408 "weight": 25.0 409 } 410 ], 411 "type": "weighted-round-robin", 412 "unreachableThreshold": null, 413 "useComputedTargets": false 414 } 415 ], 416 "resources": [], 417 "status": { 418 "changeId": "40e36abd-bfb2-4635-9fca-62175cf17007", 419 "links": [ 420 { 421 "href": "https://akab-ymtebc45gco3ypzj-apz4yxpek55y7fyv.luna.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/status/current", 422 "rel": "self" 423 } 424 ], 425 "message": "Current configuration has been propagated to all GTM nameservers", 426 "passingValidation": true, 427 "propagationStatus": "COMPLETE", 428 "propagationStatusDate": "2019-04-25T14:54:00.000+00:00" 429 }, 430 "type": "weighted" 431 }`) 432 433 Init(config) 434 435 testDomain, err := GetDomain(gtmTestDomain) 436 437 assert.NoError(t, err) 438 assert.Equal(t, gtmTestDomain, testDomain.Name) 439 440 } 441 442 // Verify failed case for GetDomain. Should pass, e.g. no API errors and domain not found 443 func TestGetBadDomain(t *testing.T) { 444 445 baddomainname := "baddomainname.me" 446 defer gock.Off() 447 448 mock := gock.New("https://akaa-baseurl-xxxxxxxxxxx-xxxxxxxxxxxxx.luna.akamaiapis.net/config-gtm/v1/domains/" + baddomainname) 449 mock. 450 Get("/config-gtm/v1/domains/"+baddomainname). 451 HeaderPresent("Authorization"). 452 Reply(404). 453 SetHeader("Content-Type", "application/vnd.config-gtm.v1.5+json;charset=UTF-8"). 454 BodyString(`{ 455 }`) 456 457 Init(config) 458 459 _, err := GetDomain(baddomainname) 460 assert.Error(t, err) 461 462 } 463 464 // Test Create domain. Name is hardcoded so this will effectively be an update. What happens to existing? 465 func TestCreateDomain(t *testing.T) { 466 467 defer gock.Off() 468 469 mock := gock.New("https://akaa-baseurl-xxxxxxxxxxx-xxxxxxxxxxxxx.luna.akamaiapis.net/config-gtm/v1/domains") 470 mock. 471 Post("/config-gtm/v1/domains/"). 472 HeaderPresent("Authorization"). 473 Reply(201). 474 SetHeader("Content-Type", "application/vnd.config-gtm.v1.5+json;charset=UTF-8"). 475 BodyString(`{ 476 "resource" : { 477 "cnameCoalescingEnabled" : false, 478 "defaultErrorPenalty" : 75, 479 "defaultHealthMax" : null, 480 "defaultHealthMultiplier" : null, 481 "defaultHealthThreshold" : null, 482 "defaultMaxUnreachablePenalty" : null, 483 "defaultSslClientCertificate" : null, 484 "defaultSslClientPrivateKey" : null, 485 "defaultTimeoutPenalty" : 25, 486 "defaultUnreachableThreshold" : null, 487 "emailNotificationList" : [ ], 488 "endUserMappingEnabled" : false, 489 "lastModified" : "2019-06-24T18:48:57.787+00:00", 490 "lastModifiedBy" : "operator", 491 "loadFeedback" : false, 492 "mapUpdateInterval" : 0, 493 "maxProperties" : 0, 494 "maxResources" : 512, 495 "maxTestTimeout" : 0.0, 496 "maxTTL" : 0, 497 "minPingableRegionFraction" : null, 498 "minTestInterval" : 0, 499 "minTTL" : 0, 500 "modificationComments" : null, 501 "name" : "gtmdomtest.akadns.net", 502 "pingInterval" : null, 503 "pingPacketSize" : null, 504 "roundRobinPrefix" : null, 505 "servermonitorLivenessCount" : null, 506 "servermonitorLoadCount" : null, 507 "servermonitorPool" : null, 508 "type" : "basic", 509 "status" : { 510 "message" : "Change Pending", 511 "changeId" : "539872cc-6ba6-4429-acd5-90bab7fb5e9d", 512 "propagationStatus" : "PENDING", 513 "propagationStatusDate" : "2019-06-24T18:48:57.787+00:00", 514 "passingValidation" : true, 515 "links" : [ { 516 "rel" : "self", 517 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/status/current" 518 } ] 519 }, 520 "loadImbalancePercentage" : null, 521 "domainVersionId" : null, 522 "resources" : [ ], 523 "properties" : [ ], 524 "datacenters" : [ ], 525 "geographicMaps" : [ ], 526 "cidrMaps" : [ ], 527 "asMaps" : [ ], 528 "links" : [ { 529 "rel" : "self", 530 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net" 531 }, { 532 "rel" : "datacenters", 533 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/datacenters" 534 }, { 535 "rel" : "properties", 536 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/properties" 537 }, { 538 "rel" : "geographic-maps", 539 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/geographic-maps" 540 }, { 541 "rel" : "cidr-maps", 542 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/cidr-maps" 543 }, { 544 "rel" : "resources", 545 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/resources" 546 }, { 547 "rel" : "as-maps", 548 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/as-maps" 549 } ] 550 }, 551 "status" : { 552 "message" : "Change Pending", 553 "changeId" : "539872cc-6ba6-4429-acd5-90bab7fb5e9d", 554 "propagationStatus" : "PENDING", 555 "propagationStatusDate" : "2019-06-24T18:48:57.787+00:00", 556 "passingValidation" : true, 557 "links" : [ { 558 "rel" : "self", 559 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/status/current" 560 } ] 561 } 562 }`) 563 564 Init(config) 565 566 testDomain := NewDomain(gtmTestDomain, "basic") 567 qArgs := make(map[string]string) 568 569 statResponse, err := testDomain.Create(qArgs) 570 require.NoError(t, err) 571 assert.Equal(t, gtmTestDomain, statResponse.Resource.Name) 572 573 } 574 575 func TestUpdateDomain(t *testing.T) { 576 577 defer gock.Off() 578 579 mock := gock.New("https://akaa-baseurl-xxxxxxxxxxx-xxxxxxxxxxxxx.luna.akamaiapis.net/config-gtm/v1/domains/" + gtmTestDomain) 580 mock. 581 Put("/config-gtm/v1/domains/"+gtmTestDomain). 582 HeaderPresent("Authorization"). 583 Reply(200). 584 SetHeader("Content-Type", "application/vnd.config-gtm.v1.5+json;charset=UTF-8"). 585 BodyString(`{ 586 "resource" : { 587 "cnameCoalescingEnabled" : false, 588 "defaultErrorPenalty" : 75, 589 "defaultHealthMax" : null, 590 "defaultHealthMultiplier" : null, 591 "defaultHealthThreshold" : null, 592 "defaultMaxUnreachablePenalty" : null, 593 "defaultSslClientCertificate" : null, 594 "defaultSslClientPrivateKey" : null, 595 "defaultTimeoutPenalty" : 25, 596 "defaultUnreachableThreshold" : null, 597 "emailNotificationList" : [ ], 598 "endUserMappingEnabled" : false, 599 "lastModified" : "2019-06-14T19:36:13.174+00:00", 600 "lastModifiedBy" : "operator", 601 "loadFeedback" : false, 602 "mapUpdateInterval" : 600, 603 "maxProperties" : 100, 604 "maxResources" : 9999, 605 "maxTestTimeout" : 60.0, 606 "maxTTL" : 3600, 607 "minPingableRegionFraction" : null, 608 "minTestInterval" : 0, 609 "minTTL" : 0, 610 "modificationComments" : "Add Property testproperty", 611 "name" : "gtmdomtest.akadns.net", 612 "pingInterval" : null, 613 "pingPacketSize" : null, 614 "roundRobinPrefix" : null, 615 "servermonitorLivenessCount" : null, 616 "servermonitorLoadCount" : null, 617 "servermonitorPool" : null, 618 "type" : "basic", 619 "status" : { 620 "message" : "Change Pending", 621 "changeId" : "df6c04e4-6327-4e0f-8872-bfe9fb2693d2", 622 "propagationStatus" : "PENDING", 623 "propagationStatusDate" : "2019-06-14T19:36:13.174+00:00", 624 "passingValidation" : true, 625 "links" : [ { 626 "rel" : "self", 627 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/status/current" 628 } ] 629 }, 630 "loadImbalancePercentage" : null, 631 "domainVersionId" : null, 632 "resources" : [ ], 633 "properties" : [ { 634 "backupCName" : null, 635 "backupIp" : null, 636 "balanceByDownloadScore" : false, 637 "cname" : null, 638 "comments" : null, 639 "dynamicTTL" : 300, 640 "failoverDelay" : null, 641 "failbackDelay" : null, 642 "ghostDemandReporting" : false, 643 "handoutMode" : "normal", 644 "handoutLimit" : 1, 645 "healthMax" : null, 646 "healthMultiplier" : null, 647 "healthThreshold" : null, 648 "lastModified" : "2019-06-14T19:36:13.174+00:00", 649 "livenessTests" : [ ], 650 "loadImbalancePercentage" : null, 651 "mapName" : null, 652 "maxUnreachablePenalty" : null, 653 "minLiveFraction" : null, 654 "mxRecords" : [ ], 655 "name" : "testproperty", 656 "scoreAggregationType" : "median", 657 "stickinessBonusConstant" : null, 658 "stickinessBonusPercentage" : null, 659 "staticTTL" : null, 660 "trafficTargets" : [ { 661 "datacenterId" : 3131, 662 "enabled" : true, 663 "weight" : 100.0, 664 "handoutCName" : null, 665 "name" : null, 666 "servers" : [ "1.2.3.4" ] 667 } ], 668 "type" : "performance", 669 "unreachableThreshold" : null, 670 "useComputedTargets" : false, 671 "weightedHashBitsForIPv4" : null, 672 "weightedHashBitsForIPv6" : null, 673 "ipv6" : false, 674 "links" : [ { 675 "rel" : "self", 676 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/properties/testproperty" 677 } ] 678 } ], 679 "datacenters" : [ { 680 "datacenterId" : 3131, 681 "nickname" : "testDC1", 682 "scorePenalty" : 0, 683 "city" : null, 684 "stateOrProvince" : null, 685 "country" : null, 686 "latitude" : null, 687 "longitude" : null, 688 "cloneOf" : null, 689 "virtual" : true, 690 "defaultLoadObject" : null, 691 "continent" : null, 692 "servermonitorPool" : null, 693 "servermonitorLivenessCount" : null, 694 "servermonitorLoadCount" : null, 695 "pingInterval" : null, 696 "pingPacketSize" : null, 697 "cloudServerTargeting" : false, 698 "cloudServerHostHeaderOverride" : false, 699 "links" : [ { 700 "rel" : "self", 701 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/datacenters/3131" 702 } ] 703 } ], 704 "geographicMaps" : [ ], 705 "cidrMaps" : [ ], 706 "asMaps" : [ ], 707 "links" : [ { 708 "rel" : "self", 709 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net" 710 }, { 711 "rel" : "datacenters", 712 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/datacenters" 713 }, { 714 "rel" : "properties", 715 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/properties" 716 }, { 717 "rel" : "geographic-maps", 718 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/geographic-maps" 719 }, { 720 "rel" : "cidr-maps", 721 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/cidr-maps" 722 }, { 723 "rel" : "resources", 724 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/resources" 725 }, { 726 "rel" : "as-maps", 727 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/as-maps" 728 } ] 729 }, 730 "status" : { 731 "message" : "Change Pending", 732 "changeId" : "df6c04e4-6327-4e0f-8872-bfe9fb2693d2", 733 "propagationStatus" : "PENDING", 734 "propagationStatusDate" : "2019-06-14T19:36:13.174+00:00", 735 "passingValidation" : true, 736 "links" : [ { 737 "rel" : "self", 738 "href" : "https://akaa-32qkzqewderdchot-d3uwbyqc4pqi2c5l.luna-dev.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/status/current" 739 } ] 740 } 741 }`) 742 743 Init(config) 744 745 testDomain := instantiateDomain() 746 //testDomain.MaxResources = 9999 747 qArgs := make(map[string]string) 748 statResp, err := testDomain.Update(qArgs) 749 require.NoError(t, err) 750 assert.Equal(t, statResp.ChangeId, "df6c04e4-6327-4e0f-8872-bfe9fb2693d2") 751 752 } 753 754 /* Future. Presently no domain Delete endpoint. 755 func TestDeleteDomain(t *testing.T) { 756 757 defer gock.Off() 758 759 mock := gock.New("https://akaa-baseurl-xxxxxxxxxxx-xxxxxxxxxxxxx.luna.akamaiapis.net/config-gtm/v1/domains/"+gtmTestDomain) 760 mock. 761 Delete("/config-gtm/v1/domains/"+gtmTestDomain). 762 HeaderPresent("Authorization"). 763 Reply(200). 764 SetHeader("Content-Type", "application/vnd.config-gtm.v1.5+json;charset=UTF-8"). 765 BodyString(`{ 766 "resource" : null, 767 "status" : { 768 "changeId": "40e36abd-bfb2-4635-9fca-62175cf17007", 769 "links": [ 770 { 771 "href": "https://akab-ymtebc45gco3ypzj-apz4yxpek55y7fyv.luna.akamaiapis.net/config-gtm/v1/domains/gtmdomtest.akadns.net/status/current", 772 "rel": "self" 773 } 774 ], 775 "message": "Change Pending", 776 "passingValidation": true, 777 "propagationStatus": "PENDING", 778 "propagationStatusDate": "2019-04-25T14:54:00.000+00:00" 779 }, 780 }`) 781 782 Init(config) 783 784 getDomain := instantiateDomain() 785 786 _, err := getDomain.Delete() 787 assert.NoError(t, err) 788 789 } 790 */