diff --git a/nodebalancer.go b/nodebalancer.go index da6c5274b..f7ec8e275 100644 --- a/nodebalancer.go +++ b/nodebalancer.go @@ -53,6 +53,7 @@ type NodeBalancerCreateOptions struct { ClientConnThrottle *int `json:"client_conn_throttle,omitempty"` Configs []*NodeBalancerConfigCreateOptions `json:"configs,omitempty"` Tags []string `json:"tags"` + FirewallID int `json:"firewall_id,omitempty"` } // NodeBalancerUpdateOptions are the options permitted for UpdateNodeBalancer diff --git a/test/integration/fixtures/TestNodeBalancer_Create.yaml b/test/integration/fixtures/TestNodeBalancer_Create.yaml index 1f8eb743c..144f70683 100644 --- a/test/integration/fixtures/TestNodeBalancer_Create.yaml +++ b/test/integration/fixtures/TestNodeBalancer_Create.yaml @@ -1,6 +1,66 @@ --- version: 1 interactions: +- request: + body: '{"label":"linodego-fw-test","rules":{"inbound":[{"action":"ACCEPT","label":"go-fwrule-test","ports":"22","protocol":"TCP","addresses":{"ipv4":["0.0.0.0/0"],"ipv6":["1234::5678/0"]}}],"inbound_policy":"ACCEPT","outbound":[{"action":"ACCEPT","label":"go-fwrule-test","ports":"22","protocol":"TCP","addresses":{"ipv4":["0.0.0.0/0"],"ipv6":["1234::5678/0"]}}],"outbound_policy":"ACCEPT"},"tags":["testing"],"devices":{}}' + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/networking/firewalls + method: POST + response: + body: '{"id": 7592, "label": "linodego-fw-test", "created": "2018-01-02T03:04:05", + "updated": "2018-01-02T03:04:05", "status": "enabled", "rules": {"inbound": + [{"action": "ACCEPT", "label": "go-fwrule-test", "ports": "22", "protocol": + "TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["1234::5678/0"]}}], "inbound_policy": + "ACCEPT", "outbound": [{"action": "ACCEPT", "label": "go-fwrule-test", "ports": + "22", "protocol": "TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["1234::5678/0"]}}], + "outbound_policy": "ACCEPT"}, "tags": ["testing"]}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Server: + - nginx + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Accept-Encoding + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - firewall:read_write + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "1200" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" - request: body: "" form: {} @@ -14,54 +74,47 @@ interactions: url: https://api.linode.com/v4beta/regions method: GET response: - body: '{"data": [{"id": "ap-west", "country": "in", "capabilities": ["Linodes", - "NodeBalancers", "Block Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Vlans", "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": - {"ipv4": "172.105.34.5,172.105.35.5,172.105.36.5,172.105.37.5,172.105.38.5,172.105.39.5,172.105.40.5,172.105.41.5,172.105.42.5,172.105.43.5", + body: '{"data": [{"id": "ap-west", "label": "Mumbai, India", "country": "in", + "capabilities": ["Linodes", "NodeBalancers", "Vlans", "VPCs"], "status": "ok", + "resolvers": {"ipv4": "172.105.34.5,172.105.35.5,172.105.36.5,172.105.37.5,172.105.38.5,172.105.39.5,172.105.40.5,172.105.41.5,172.105.42.5,172.105.43.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ca-central", "country": "ca", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "172.105.0.5,172.105.3.5,172.105.4.5,172.105.5.5,172.105.6.5,172.105.7.5,172.105.8.5,172.105.9.5,172.105.10.5,172.105.11.5", + {"id": "ca-central", "label": "Toronto, Ontario, CAN", "country": "ca", "capabilities": + ["Linodes", "NodeBalancers", "Vlans", "VPCs"], "status": "ok", "resolvers": + {"ipv4": "172.105.0.5,172.105.3.5,172.105.4.5,172.105.5.5,172.105.6.5,172.105.7.5,172.105.8.5,172.105.9.5,172.105.10.5,172.105.11.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ap-southeast", "country": "au", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "172.105.166.5,172.105.169.5,172.105.168.5,172.105.172.5,172.105.162.5,172.105.170.5,172.105.167.5,172.105.171.5,172.105.181.5,172.105.161.5", + {"id": "ap-southeast", "label": "Sydney, NSW, Australia", "country": "au", "capabilities": + ["Linodes", "NodeBalancers", "Vlans", "VPCs"], "status": "ok", "resolvers": + {"ipv4": "172.105.166.5,172.105.169.5,172.105.168.5,172.105.172.5,172.105.162.5,172.105.170.5,172.105.167.5,172.105.171.5,172.105.181.5,172.105.161.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-central", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "72.14.179.5,72.14.188.5,173.255.199.5,66.228.53.5,96.126.122.5,96.126.124.5,96.126.127.5,198.58.107.5,198.58.111.5,23.239.24.5", + {"id": "us-central", "label": "Dallas, TX, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "72.14.179.5,72.14.188.5,173.255.199.5,66.228.53.5,96.126.122.5,96.126.124.5,96.126.127.5,198.58.107.5,198.58.111.5,23.239.24.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-west", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "173.230.145.5,173.230.147.5,173.230.155.5,173.255.212.5,173.255.219.5,173.255.241.5,173.255.243.5,173.255.244.5,74.207.241.5,74.207.242.5", + {"id": "us-west", "label": "Fremont, CA, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "173.230.145.5,173.230.147.5,173.230.155.5,173.255.212.5,173.255.219.5,173.255.241.5,173.255.243.5,173.255.244.5,74.207.241.5,74.207.242.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-southeast", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Vlans", "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": - {"ipv4": "74.207.231.5,173.230.128.5,173.230.129.5,173.230.136.5,173.230.140.5,66.228.59.5,66.228.62.5,50.116.35.5,50.116.41.5,23.239.18.5", + {"id": "us-southeast", "label": "Atlanta, GA, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "74.207.231.5,173.230.128.5,173.230.129.5,173.230.136.5,173.230.140.5,66.228.59.5,66.228.62.5,50.116.35.5,50.116.41.5,23.239.18.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-east", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Bare Metal", "Block Storage Migrations", "Managed Databases"], "status": "ok", - "resolvers": {"ipv4": "66.228.42.5,96.126.106.5,50.116.53.5,50.116.58.5,50.116.61.5,50.116.62.5,66.175.211.5,97.107.133.4,207.192.69.4,207.192.69.5", + {"id": "us-east", "label": "Newark, NJ, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers", "Block Storage", "Object Storage", "GPU Linodes", + "Kubernetes", "Cloud Firewall", "Bare Metal", "Vlans", "VPCs", "Block Storage + Migrations", "Managed Databases", "Metadata"], "status": "ok", "resolvers": + {"ipv4": "66.228.42.5,96.126.106.5,50.116.53.5,50.116.58.5,50.116.61.5,50.116.62.5,66.175.211.5,97.107.133.4,207.192.69.4,207.192.69.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "eu-west", "country": "uk", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "178.79.182.5,176.58.107.5,176.58.116.5,176.58.121.5,151.236.220.5,212.71.252.5,212.71.253.5,109.74.192.20,109.74.193.20,109.74.194.20", + {"id": "eu-west", "label": "London, England, UK", "country": "uk", "capabilities": + ["Linodes", "NodeBalancers", "Cloud Firewall", "Vlans", "VPCs", "Metadata"], + "status": "ok", "resolvers": {"ipv4": "178.79.182.5,176.58.107.5,176.58.116.5,176.58.121.5,151.236.220.5,212.71.252.5,212.71.253.5,109.74.192.20,109.74.193.20,109.74.194.20", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ap-south", "country": "sg", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": + {"id": "ap-south", "label": "Singapore, SG", "country": "sg", "capabilities": + ["Linodes", "NodeBalancers", "Object Storage"], "status": "ok", "resolvers": {"ipv4": "139.162.11.5,139.162.13.5,139.162.14.5,139.162.15.5,139.162.16.5,139.162.21.5,139.162.27.5,103.3.60.18,103.3.60.19,103.3.60.20", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "eu-central", "country": "de", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Vlans", "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": + {"id": "eu-central", "label": "Frankfurt, DE", "country": "de", "capabilities": + ["Linodes", "NodeBalancers", "Object Storage"], "status": "ok", "resolvers": {"ipv4": "139.162.130.5,139.162.131.5,139.162.132.5,139.162.133.5,139.162.134.5,139.162.135.5,139.162.136.5,139.162.137.5,139.162.138.5,139.162.139.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ap-northeast", "country": "jp", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "139.162.66.5,139.162.67.5,139.162.68.5,139.162.69.5,139.162.70.5,139.162.71.5,139.162.72.5,139.162.73.5,139.162.74.5,139.162.75.5", + {"id": "ap-northeast", "label": "Tokyo 2, JP", "country": "jp", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "139.162.66.5,139.162.67.5,139.162.68.5,139.162.69.5,139.162.70.5,139.162.71.5,139.162.72.5,139.162.73.5,139.162.74.5,139.162.75.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}], "page": 1, "pages": 1, "results": 11}' headers: @@ -87,6 +140,7 @@ interactions: Strict-Transport-Security: - max-age=31536000 Vary: + - Accept-Encoding - Authorization, X-Filter - Authorization, X-Filter X-Accepted-Oauth-Scopes: @@ -99,14 +153,14 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK code: 200 duration: "" - request: - body: '{"label":"go-test-def","region":"ap-west","client_conn_throttle":20,"tags":null}' + body: '{"label":"go-test-def","region":"us-east","client_conn_throttle":20,"tags":null,"firewall_id":7592}' form: {} headers: Accept: @@ -118,11 +172,10 @@ interactions: url: https://api.linode.com/v4beta/nodebalancers method: POST response: - body: '{"id": 259559, "label": "go-test-def", "region": "ap-west", "hostname": - "172-105-46-192.ip.linodeusercontent.com", "ipv4": "172.105.46.192", "ipv6": - "1234::5678", "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", - "client_conn_throttle": 20, "tags": [], "transfer": {"in": null, "out": null, - "total": null}}' + body: '{"id": 178669, "label": "go-test-def", "region": "us-east", "hostname": + "207-192-68-73.ip.linodeusercontent.com", "ipv4": "207.192.68.73", "ipv6": null, + "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "client_conn_throttle": + 20, "tags": [], "transfer": {"in": null, "out": null, "total": null}}' headers: Access-Control-Allow-Credentials: - "true" @@ -136,8 +189,6 @@ interactions: - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status Cache-Control: - private, max-age=60, s-maxage=60 - Content-Length: - - "336" Content-Security-Policy: - default-src 'none' Content-Type: @@ -147,6 +198,7 @@ interactions: Strict-Transport-Security: - max-age=31536000 Vary: + - Accept-Encoding - Authorization, X-Filter X-Accepted-Oauth-Scopes: - nodebalancers:read_write @@ -158,7 +210,62 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/networking/firewalls/7592 + method: DELETE + response: + body: '{}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Length: + - "2" + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Server: + - nginx + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - firewall:read_write + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK @@ -174,7 +281,7 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/nodebalancers/259559 + url: https://api.linode.com/v4beta/nodebalancers/178669 method: DELETE response: body: '{}' @@ -213,7 +320,7 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK diff --git a/test/integration/fixtures/TestNodeBalancer_Get.yaml b/test/integration/fixtures/TestNodeBalancer_Get.yaml index 16cf346d4..9d9c695c9 100644 --- a/test/integration/fixtures/TestNodeBalancer_Get.yaml +++ b/test/integration/fixtures/TestNodeBalancer_Get.yaml @@ -1,6 +1,66 @@ --- version: 1 interactions: +- request: + body: '{"label":"linodego-fw-test","rules":{"inbound":[{"action":"ACCEPT","label":"go-fwrule-test","ports":"22","protocol":"TCP","addresses":{"ipv4":["0.0.0.0/0"],"ipv6":["1234::5678/0"]}}],"inbound_policy":"ACCEPT","outbound":[{"action":"ACCEPT","label":"go-fwrule-test","ports":"22","protocol":"TCP","addresses":{"ipv4":["0.0.0.0/0"],"ipv6":["1234::5678/0"]}}],"outbound_policy":"ACCEPT"},"tags":["testing"],"devices":{}}' + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/networking/firewalls + method: POST + response: + body: '{"id": 7595, "label": "linodego-fw-test", "created": "2018-01-02T03:04:05", + "updated": "2018-01-02T03:04:05", "status": "enabled", "rules": {"inbound": + [{"action": "ACCEPT", "label": "go-fwrule-test", "ports": "22", "protocol": + "TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["1234::5678/0"]}}], "inbound_policy": + "ACCEPT", "outbound": [{"action": "ACCEPT", "label": "go-fwrule-test", "ports": + "22", "protocol": "TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["1234::5678/0"]}}], + "outbound_policy": "ACCEPT"}, "tags": ["testing"]}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Server: + - nginx + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Accept-Encoding + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - firewall:read_write + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "1200" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" - request: body: "" form: {} @@ -14,54 +74,47 @@ interactions: url: https://api.linode.com/v4beta/regions method: GET response: - body: '{"data": [{"id": "ap-west", "country": "in", "capabilities": ["Linodes", - "NodeBalancers", "Block Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Vlans", "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": - {"ipv4": "172.105.34.5,172.105.35.5,172.105.36.5,172.105.37.5,172.105.38.5,172.105.39.5,172.105.40.5,172.105.41.5,172.105.42.5,172.105.43.5", + body: '{"data": [{"id": "ap-west", "label": "Mumbai, India", "country": "in", + "capabilities": ["Linodes", "NodeBalancers", "Vlans", "VPCs"], "status": "ok", + "resolvers": {"ipv4": "172.105.34.5,172.105.35.5,172.105.36.5,172.105.37.5,172.105.38.5,172.105.39.5,172.105.40.5,172.105.41.5,172.105.42.5,172.105.43.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ca-central", "country": "ca", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "172.105.0.5,172.105.3.5,172.105.4.5,172.105.5.5,172.105.6.5,172.105.7.5,172.105.8.5,172.105.9.5,172.105.10.5,172.105.11.5", + {"id": "ca-central", "label": "Toronto, Ontario, CAN", "country": "ca", "capabilities": + ["Linodes", "NodeBalancers", "Vlans", "VPCs"], "status": "ok", "resolvers": + {"ipv4": "172.105.0.5,172.105.3.5,172.105.4.5,172.105.5.5,172.105.6.5,172.105.7.5,172.105.8.5,172.105.9.5,172.105.10.5,172.105.11.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ap-southeast", "country": "au", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "172.105.166.5,172.105.169.5,172.105.168.5,172.105.172.5,172.105.162.5,172.105.170.5,172.105.167.5,172.105.171.5,172.105.181.5,172.105.161.5", + {"id": "ap-southeast", "label": "Sydney, NSW, Australia", "country": "au", "capabilities": + ["Linodes", "NodeBalancers", "Vlans", "VPCs"], "status": "ok", "resolvers": + {"ipv4": "172.105.166.5,172.105.169.5,172.105.168.5,172.105.172.5,172.105.162.5,172.105.170.5,172.105.167.5,172.105.171.5,172.105.181.5,172.105.161.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-central", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "72.14.179.5,72.14.188.5,173.255.199.5,66.228.53.5,96.126.122.5,96.126.124.5,96.126.127.5,198.58.107.5,198.58.111.5,23.239.24.5", + {"id": "us-central", "label": "Dallas, TX, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "72.14.179.5,72.14.188.5,173.255.199.5,66.228.53.5,96.126.122.5,96.126.124.5,96.126.127.5,198.58.107.5,198.58.111.5,23.239.24.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-west", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "173.230.145.5,173.230.147.5,173.230.155.5,173.255.212.5,173.255.219.5,173.255.241.5,173.255.243.5,173.255.244.5,74.207.241.5,74.207.242.5", + {"id": "us-west", "label": "Fremont, CA, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "173.230.145.5,173.230.147.5,173.230.155.5,173.255.212.5,173.255.219.5,173.255.241.5,173.255.243.5,173.255.244.5,74.207.241.5,74.207.242.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-southeast", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Vlans", "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": - {"ipv4": "74.207.231.5,173.230.128.5,173.230.129.5,173.230.136.5,173.230.140.5,66.228.59.5,66.228.62.5,50.116.35.5,50.116.41.5,23.239.18.5", + {"id": "us-southeast", "label": "Atlanta, GA, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "74.207.231.5,173.230.128.5,173.230.129.5,173.230.136.5,173.230.140.5,66.228.59.5,66.228.62.5,50.116.35.5,50.116.41.5,23.239.18.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-east", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Bare Metal", "Block Storage Migrations", "Managed Databases"], "status": "ok", - "resolvers": {"ipv4": "66.228.42.5,96.126.106.5,50.116.53.5,50.116.58.5,50.116.61.5,50.116.62.5,66.175.211.5,97.107.133.4,207.192.69.4,207.192.69.5", + {"id": "us-east", "label": "Newark, NJ, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers", "Block Storage", "Object Storage", "GPU Linodes", + "Kubernetes", "Cloud Firewall", "Bare Metal", "Vlans", "VPCs", "Block Storage + Migrations", "Managed Databases", "Metadata"], "status": "ok", "resolvers": + {"ipv4": "66.228.42.5,96.126.106.5,50.116.53.5,50.116.58.5,50.116.61.5,50.116.62.5,66.175.211.5,97.107.133.4,207.192.69.4,207.192.69.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "eu-west", "country": "uk", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "178.79.182.5,176.58.107.5,176.58.116.5,176.58.121.5,151.236.220.5,212.71.252.5,212.71.253.5,109.74.192.20,109.74.193.20,109.74.194.20", + {"id": "eu-west", "label": "London, England, UK", "country": "uk", "capabilities": + ["Linodes", "NodeBalancers", "Cloud Firewall", "Vlans", "VPCs", "Metadata"], + "status": "ok", "resolvers": {"ipv4": "178.79.182.5,176.58.107.5,176.58.116.5,176.58.121.5,151.236.220.5,212.71.252.5,212.71.253.5,109.74.192.20,109.74.193.20,109.74.194.20", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ap-south", "country": "sg", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": + {"id": "ap-south", "label": "Singapore, SG", "country": "sg", "capabilities": + ["Linodes", "NodeBalancers", "Object Storage"], "status": "ok", "resolvers": {"ipv4": "139.162.11.5,139.162.13.5,139.162.14.5,139.162.15.5,139.162.16.5,139.162.21.5,139.162.27.5,103.3.60.18,103.3.60.19,103.3.60.20", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "eu-central", "country": "de", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Vlans", "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": + {"id": "eu-central", "label": "Frankfurt, DE", "country": "de", "capabilities": + ["Linodes", "NodeBalancers", "Object Storage"], "status": "ok", "resolvers": {"ipv4": "139.162.130.5,139.162.131.5,139.162.132.5,139.162.133.5,139.162.134.5,139.162.135.5,139.162.136.5,139.162.137.5,139.162.138.5,139.162.139.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ap-northeast", "country": "jp", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "139.162.66.5,139.162.67.5,139.162.68.5,139.162.69.5,139.162.70.5,139.162.71.5,139.162.72.5,139.162.73.5,139.162.74.5,139.162.75.5", + {"id": "ap-northeast", "label": "Tokyo 2, JP", "country": "jp", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "139.162.66.5,139.162.67.5,139.162.68.5,139.162.69.5,139.162.70.5,139.162.71.5,139.162.72.5,139.162.73.5,139.162.74.5,139.162.75.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}], "page": 1, "pages": 1, "results": 11}' headers: @@ -87,6 +140,7 @@ interactions: Strict-Transport-Security: - max-age=31536000 Vary: + - Accept-Encoding - Authorization, X-Filter - Authorization, X-Filter X-Accepted-Oauth-Scopes: @@ -99,14 +153,14 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK code: 200 duration: "" - request: - body: '{"label":"go-test-def","region":"ap-west","client_conn_throttle":20,"tags":null}' + body: '{"label":"go-test-def","region":"us-east","client_conn_throttle":20,"tags":null,"firewall_id":7595}' form: {} headers: Accept: @@ -118,11 +172,10 @@ interactions: url: https://api.linode.com/v4beta/nodebalancers method: POST response: - body: '{"id": 259562, "label": "go-test-def", "region": "ap-west", "hostname": - "172-105-45-232.ip.linodeusercontent.com", "ipv4": "172.105.45.232", "ipv6": - "1234::5678", "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", - "client_conn_throttle": 20, "tags": [], "transfer": {"in": null, "out": null, - "total": null}}' + body: '{"id": 178673, "label": "go-test-def", "region": "us-east", "hostname": + "207-192-68-122.ip.linodeusercontent.com", "ipv4": "207.192.68.122", "ipv6": + null, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "client_conn_throttle": + 20, "tags": [], "transfer": {"in": null, "out": null, "total": null}}' headers: Access-Control-Allow-Credentials: - "true" @@ -136,8 +189,6 @@ interactions: - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status Cache-Control: - private, max-age=60, s-maxage=60 - Content-Length: - - "336" Content-Security-Policy: - default-src 'none' Content-Type: @@ -147,6 +198,7 @@ interactions: Strict-Transport-Security: - max-age=31536000 Vary: + - Accept-Encoding - Authorization, X-Filter X-Accepted-Oauth-Scopes: - nodebalancers:read_write @@ -158,7 +210,62 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/networking/firewalls/7595 + method: DELETE + response: + body: '{}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Length: + - "2" + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Server: + - nginx + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - firewall:read_write + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK @@ -174,14 +281,13 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/nodebalancers/259562 + url: https://api.linode.com/v4beta/nodebalancers/178673 method: GET response: - body: '{"id": 259562, "label": "go-test-def", "region": "ap-west", "hostname": - "172-105-45-232.ip.linodeusercontent.com", "ipv4": "172.105.45.232", "ipv6": - "1234::5678", "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", - "client_conn_throttle": 20, "tags": [], "transfer": {"in": null, "out": null, - "total": null}}' + body: '{"id": 178673, "label": "go-test-def", "region": "us-east", "hostname": + "207-192-68-122.ip.linodeusercontent.com", "ipv4": "207.192.68.122", "ipv6": + null, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "client_conn_throttle": + 20, "tags": [], "transfer": {"in": null, "out": null, "total": null}}' headers: Access-Control-Allow-Credentials: - "true" @@ -196,8 +302,6 @@ interactions: Cache-Control: - private, max-age=0, s-maxage=0, no-cache, no-store - private, max-age=60, s-maxage=60 - Content-Length: - - "336" Content-Security-Policy: - default-src 'none' Content-Type: @@ -207,6 +311,7 @@ interactions: Strict-Transport-Security: - max-age=31536000 Vary: + - Accept-Encoding - Authorization, X-Filter - Authorization, X-Filter X-Accepted-Oauth-Scopes: @@ -219,7 +324,7 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK @@ -235,7 +340,7 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/nodebalancers/259562 + url: https://api.linode.com/v4beta/nodebalancers/178673 method: DELETE response: body: '{}' @@ -274,7 +379,7 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK diff --git a/test/integration/fixtures/TestNodeBalancer_Update.yaml b/test/integration/fixtures/TestNodeBalancer_Update.yaml index 7554d1223..c23ef2ac7 100644 --- a/test/integration/fixtures/TestNodeBalancer_Update.yaml +++ b/test/integration/fixtures/TestNodeBalancer_Update.yaml @@ -1,6 +1,66 @@ --- version: 1 interactions: +- request: + body: '{"label":"linodego-fw-test","rules":{"inbound":[{"action":"ACCEPT","label":"go-fwrule-test","ports":"22","protocol":"TCP","addresses":{"ipv4":["0.0.0.0/0"],"ipv6":["1234::5678/0"]}}],"inbound_policy":"ACCEPT","outbound":[{"action":"ACCEPT","label":"go-fwrule-test","ports":"22","protocol":"TCP","addresses":{"ipv4":["0.0.0.0/0"],"ipv6":["1234::5678/0"]}}],"outbound_policy":"ACCEPT"},"tags":["testing"],"devices":{}}' + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/networking/firewalls + method: POST + response: + body: '{"id": 7593, "label": "linodego-fw-test", "created": "2018-01-02T03:04:05", + "updated": "2018-01-02T03:04:05", "status": "enabled", "rules": {"inbound": + [{"action": "ACCEPT", "label": "go-fwrule-test", "ports": "22", "protocol": + "TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["1234::5678/0"]}}], "inbound_policy": + "ACCEPT", "outbound": [{"action": "ACCEPT", "label": "go-fwrule-test", "ports": + "22", "protocol": "TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["1234::5678/0"]}}], + "outbound_policy": "ACCEPT"}, "tags": ["testing"]}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Server: + - nginx + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Accept-Encoding + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - firewall:read_write + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "1200" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" - request: body: "" form: {} @@ -14,54 +74,47 @@ interactions: url: https://api.linode.com/v4beta/regions method: GET response: - body: '{"data": [{"id": "ap-west", "country": "in", "capabilities": ["Linodes", - "NodeBalancers", "Block Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Vlans", "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": - {"ipv4": "172.105.34.5,172.105.35.5,172.105.36.5,172.105.37.5,172.105.38.5,172.105.39.5,172.105.40.5,172.105.41.5,172.105.42.5,172.105.43.5", + body: '{"data": [{"id": "ap-west", "label": "Mumbai, India", "country": "in", + "capabilities": ["Linodes", "NodeBalancers", "Vlans", "VPCs"], "status": "ok", + "resolvers": {"ipv4": "172.105.34.5,172.105.35.5,172.105.36.5,172.105.37.5,172.105.38.5,172.105.39.5,172.105.40.5,172.105.41.5,172.105.42.5,172.105.43.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ca-central", "country": "ca", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "172.105.0.5,172.105.3.5,172.105.4.5,172.105.5.5,172.105.6.5,172.105.7.5,172.105.8.5,172.105.9.5,172.105.10.5,172.105.11.5", + {"id": "ca-central", "label": "Toronto, Ontario, CAN", "country": "ca", "capabilities": + ["Linodes", "NodeBalancers", "Vlans", "VPCs"], "status": "ok", "resolvers": + {"ipv4": "172.105.0.5,172.105.3.5,172.105.4.5,172.105.5.5,172.105.6.5,172.105.7.5,172.105.8.5,172.105.9.5,172.105.10.5,172.105.11.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ap-southeast", "country": "au", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "172.105.166.5,172.105.169.5,172.105.168.5,172.105.172.5,172.105.162.5,172.105.170.5,172.105.167.5,172.105.171.5,172.105.181.5,172.105.161.5", + {"id": "ap-southeast", "label": "Sydney, NSW, Australia", "country": "au", "capabilities": + ["Linodes", "NodeBalancers", "Vlans", "VPCs"], "status": "ok", "resolvers": + {"ipv4": "172.105.166.5,172.105.169.5,172.105.168.5,172.105.172.5,172.105.162.5,172.105.170.5,172.105.167.5,172.105.171.5,172.105.181.5,172.105.161.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-central", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "72.14.179.5,72.14.188.5,173.255.199.5,66.228.53.5,96.126.122.5,96.126.124.5,96.126.127.5,198.58.107.5,198.58.111.5,23.239.24.5", + {"id": "us-central", "label": "Dallas, TX, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "72.14.179.5,72.14.188.5,173.255.199.5,66.228.53.5,96.126.122.5,96.126.124.5,96.126.127.5,198.58.107.5,198.58.111.5,23.239.24.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-west", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "173.230.145.5,173.230.147.5,173.230.155.5,173.255.212.5,173.255.219.5,173.255.241.5,173.255.243.5,173.255.244.5,74.207.241.5,74.207.242.5", + {"id": "us-west", "label": "Fremont, CA, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "173.230.145.5,173.230.147.5,173.230.155.5,173.255.212.5,173.255.219.5,173.255.241.5,173.255.243.5,173.255.244.5,74.207.241.5,74.207.242.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-southeast", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Vlans", "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": - {"ipv4": "74.207.231.5,173.230.128.5,173.230.129.5,173.230.136.5,173.230.140.5,66.228.59.5,66.228.62.5,50.116.35.5,50.116.41.5,23.239.18.5", + {"id": "us-southeast", "label": "Atlanta, GA, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "74.207.231.5,173.230.128.5,173.230.129.5,173.230.136.5,173.230.140.5,66.228.59.5,66.228.62.5,50.116.35.5,50.116.41.5,23.239.18.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-east", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Bare Metal", "Block Storage Migrations", "Managed Databases"], "status": "ok", - "resolvers": {"ipv4": "66.228.42.5,96.126.106.5,50.116.53.5,50.116.58.5,50.116.61.5,50.116.62.5,66.175.211.5,97.107.133.4,207.192.69.4,207.192.69.5", + {"id": "us-east", "label": "Newark, NJ, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers", "Block Storage", "Object Storage", "GPU Linodes", + "Kubernetes", "Cloud Firewall", "Bare Metal", "Vlans", "VPCs", "Block Storage + Migrations", "Managed Databases", "Metadata"], "status": "ok", "resolvers": + {"ipv4": "66.228.42.5,96.126.106.5,50.116.53.5,50.116.58.5,50.116.61.5,50.116.62.5,66.175.211.5,97.107.133.4,207.192.69.4,207.192.69.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "eu-west", "country": "uk", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "178.79.182.5,176.58.107.5,176.58.116.5,176.58.121.5,151.236.220.5,212.71.252.5,212.71.253.5,109.74.192.20,109.74.193.20,109.74.194.20", + {"id": "eu-west", "label": "London, England, UK", "country": "uk", "capabilities": + ["Linodes", "NodeBalancers", "Cloud Firewall", "Vlans", "VPCs", "Metadata"], + "status": "ok", "resolvers": {"ipv4": "178.79.182.5,176.58.107.5,176.58.116.5,176.58.121.5,151.236.220.5,212.71.252.5,212.71.253.5,109.74.192.20,109.74.193.20,109.74.194.20", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ap-south", "country": "sg", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": + {"id": "ap-south", "label": "Singapore, SG", "country": "sg", "capabilities": + ["Linodes", "NodeBalancers", "Object Storage"], "status": "ok", "resolvers": {"ipv4": "139.162.11.5,139.162.13.5,139.162.14.5,139.162.15.5,139.162.16.5,139.162.21.5,139.162.27.5,103.3.60.18,103.3.60.19,103.3.60.20", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "eu-central", "country": "de", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Vlans", "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": + {"id": "eu-central", "label": "Frankfurt, DE", "country": "de", "capabilities": + ["Linodes", "NodeBalancers", "Object Storage"], "status": "ok", "resolvers": {"ipv4": "139.162.130.5,139.162.131.5,139.162.132.5,139.162.133.5,139.162.134.5,139.162.135.5,139.162.136.5,139.162.137.5,139.162.138.5,139.162.139.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ap-northeast", "country": "jp", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "139.162.66.5,139.162.67.5,139.162.68.5,139.162.69.5,139.162.70.5,139.162.71.5,139.162.72.5,139.162.73.5,139.162.74.5,139.162.75.5", + {"id": "ap-northeast", "label": "Tokyo 2, JP", "country": "jp", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "139.162.66.5,139.162.67.5,139.162.68.5,139.162.69.5,139.162.70.5,139.162.71.5,139.162.72.5,139.162.73.5,139.162.74.5,139.162.75.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}], "page": 1, "pages": 1, "results": 11}' headers: @@ -87,6 +140,7 @@ interactions: Strict-Transport-Security: - max-age=31536000 Vary: + - Accept-Encoding - Authorization, X-Filter - Authorization, X-Filter X-Accepted-Oauth-Scopes: @@ -99,14 +153,14 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK code: 200 duration: "" - request: - body: '{"label":"go-test-def","region":"ap-west","client_conn_throttle":20,"tags":null}' + body: '{"label":"go-test-def","region":"us-east","client_conn_throttle":20,"tags":null,"firewall_id":7593}' form: {} headers: Accept: @@ -118,8 +172,8 @@ interactions: url: https://api.linode.com/v4beta/nodebalancers method: POST response: - body: '{"id": 259560, "label": "go-test-def", "region": "ap-west", "hostname": - "172-105-44-99.ip.linodeusercontent.com", "ipv4": "172.105.44.99", "ipv6": "1234::5678", + body: '{"id": 178670, "label": "go-test-def", "region": "us-east", "hostname": + "143-42-177-98.ip.linodeusercontent.com", "ipv4": "143.42.177.98", "ipv6": null, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "client_conn_throttle": 20, "tags": [], "transfer": {"in": null, "out": null, "total": null}}' headers: @@ -135,8 +189,6 @@ interactions: - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status Cache-Control: - private, max-age=60, s-maxage=60 - Content-Length: - - "334" Content-Security-Policy: - default-src 'none' Content-Type: @@ -146,6 +198,7 @@ interactions: Strict-Transport-Security: - max-age=31536000 Vary: + - Accept-Encoding - Authorization, X-Filter X-Accepted-Oauth-Scopes: - nodebalancers:read_write @@ -157,7 +210,62 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/networking/firewalls/7593 + method: DELETE + response: + body: '{}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Length: + - "2" + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Server: + - nginx + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - firewall:read_write + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK @@ -173,11 +281,11 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/nodebalancers/259560 + url: https://api.linode.com/v4beta/nodebalancers/178670 method: PUT response: - body: '{"id": 259560, "label": "go-test-def_r", "region": "ap-west", "hostname": - "172-105-44-99.ip.linodeusercontent.com", "ipv4": "172.105.44.99", "ipv6": "1234::5678", + body: '{"id": 178670, "label": "go-test-def_r", "region": "us-east", "hostname": + "143-42-177-98.ip.linodeusercontent.com", "ipv4": "143.42.177.98", "ipv6": null, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "client_conn_throttle": 20, "tags": [], "transfer": {"in": null, "out": null, "total": null}}' headers: @@ -193,8 +301,6 @@ interactions: - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status Cache-Control: - private, max-age=60, s-maxage=60 - Content-Length: - - "336" Content-Security-Policy: - default-src 'none' Content-Type: @@ -204,6 +310,7 @@ interactions: Strict-Transport-Security: - max-age=31536000 Vary: + - Accept-Encoding - Authorization, X-Filter X-Accepted-Oauth-Scopes: - nodebalancers:read_write @@ -215,7 +322,7 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK @@ -231,7 +338,7 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/nodebalancers/259560 + url: https://api.linode.com/v4beta/nodebalancers/178670 method: DELETE response: body: '{}' @@ -270,7 +377,7 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK diff --git a/test/integration/fixtures/TestNodeBalancers_List.yaml b/test/integration/fixtures/TestNodeBalancers_List.yaml index ac5644e92..89b33c053 100644 --- a/test/integration/fixtures/TestNodeBalancers_List.yaml +++ b/test/integration/fixtures/TestNodeBalancers_List.yaml @@ -1,6 +1,66 @@ --- version: 1 interactions: +- request: + body: '{"label":"linodego-fw-test","rules":{"inbound":[{"action":"ACCEPT","label":"go-fwrule-test","ports":"22","protocol":"TCP","addresses":{"ipv4":["0.0.0.0/0"],"ipv6":["1234::5678/0"]}}],"inbound_policy":"ACCEPT","outbound":[{"action":"ACCEPT","label":"go-fwrule-test","ports":"22","protocol":"TCP","addresses":{"ipv4":["0.0.0.0/0"],"ipv6":["1234::5678/0"]}}],"outbound_policy":"ACCEPT"},"tags":["testing"],"devices":{}}' + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/networking/firewalls + method: POST + response: + body: '{"id": 7594, "label": "linodego-fw-test", "created": "2018-01-02T03:04:05", + "updated": "2018-01-02T03:04:05", "status": "enabled", "rules": {"inbound": + [{"action": "ACCEPT", "label": "go-fwrule-test", "ports": "22", "protocol": + "TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["1234::5678/0"]}}], "inbound_policy": + "ACCEPT", "outbound": [{"action": "ACCEPT", "label": "go-fwrule-test", "ports": + "22", "protocol": "TCP", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["1234::5678/0"]}}], + "outbound_policy": "ACCEPT"}, "tags": ["testing"]}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Server: + - nginx + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Accept-Encoding + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - firewall:read_write + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "1200" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" - request: body: "" form: {} @@ -14,54 +74,47 @@ interactions: url: https://api.linode.com/v4beta/regions method: GET response: - body: '{"data": [{"id": "ap-west", "country": "in", "capabilities": ["Linodes", - "NodeBalancers", "Block Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Vlans", "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": - {"ipv4": "172.105.34.5,172.105.35.5,172.105.36.5,172.105.37.5,172.105.38.5,172.105.39.5,172.105.40.5,172.105.41.5,172.105.42.5,172.105.43.5", + body: '{"data": [{"id": "ap-west", "label": "Mumbai, India", "country": "in", + "capabilities": ["Linodes", "NodeBalancers", "Vlans", "VPCs"], "status": "ok", + "resolvers": {"ipv4": "172.105.34.5,172.105.35.5,172.105.36.5,172.105.37.5,172.105.38.5,172.105.39.5,172.105.40.5,172.105.41.5,172.105.42.5,172.105.43.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ca-central", "country": "ca", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "172.105.0.5,172.105.3.5,172.105.4.5,172.105.5.5,172.105.6.5,172.105.7.5,172.105.8.5,172.105.9.5,172.105.10.5,172.105.11.5", + {"id": "ca-central", "label": "Toronto, Ontario, CAN", "country": "ca", "capabilities": + ["Linodes", "NodeBalancers", "Vlans", "VPCs"], "status": "ok", "resolvers": + {"ipv4": "172.105.0.5,172.105.3.5,172.105.4.5,172.105.5.5,172.105.6.5,172.105.7.5,172.105.8.5,172.105.9.5,172.105.10.5,172.105.11.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ap-southeast", "country": "au", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "172.105.166.5,172.105.169.5,172.105.168.5,172.105.172.5,172.105.162.5,172.105.170.5,172.105.167.5,172.105.171.5,172.105.181.5,172.105.161.5", + {"id": "ap-southeast", "label": "Sydney, NSW, Australia", "country": "au", "capabilities": + ["Linodes", "NodeBalancers", "Vlans", "VPCs"], "status": "ok", "resolvers": + {"ipv4": "172.105.166.5,172.105.169.5,172.105.168.5,172.105.172.5,172.105.162.5,172.105.170.5,172.105.167.5,172.105.171.5,172.105.181.5,172.105.161.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-central", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "72.14.179.5,72.14.188.5,173.255.199.5,66.228.53.5,96.126.122.5,96.126.124.5,96.126.127.5,198.58.107.5,198.58.111.5,23.239.24.5", + {"id": "us-central", "label": "Dallas, TX, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "72.14.179.5,72.14.188.5,173.255.199.5,66.228.53.5,96.126.122.5,96.126.124.5,96.126.127.5,198.58.107.5,198.58.111.5,23.239.24.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-west", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "173.230.145.5,173.230.147.5,173.230.155.5,173.255.212.5,173.255.219.5,173.255.241.5,173.255.243.5,173.255.244.5,74.207.241.5,74.207.242.5", + {"id": "us-west", "label": "Fremont, CA, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "173.230.145.5,173.230.147.5,173.230.155.5,173.255.212.5,173.255.219.5,173.255.241.5,173.255.243.5,173.255.244.5,74.207.241.5,74.207.242.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-southeast", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Vlans", "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": - {"ipv4": "74.207.231.5,173.230.128.5,173.230.129.5,173.230.136.5,173.230.140.5,66.228.59.5,66.228.62.5,50.116.35.5,50.116.41.5,23.239.18.5", + {"id": "us-southeast", "label": "Atlanta, GA, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "74.207.231.5,173.230.128.5,173.230.129.5,173.230.136.5,173.230.140.5,66.228.59.5,66.228.62.5,50.116.35.5,50.116.41.5,23.239.18.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "us-east", "country": "us", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Bare Metal", "Block Storage Migrations", "Managed Databases"], "status": "ok", - "resolvers": {"ipv4": "66.228.42.5,96.126.106.5,50.116.53.5,50.116.58.5,50.116.61.5,50.116.62.5,66.175.211.5,97.107.133.4,207.192.69.4,207.192.69.5", + {"id": "us-east", "label": "Newark, NJ, USA", "country": "us", "capabilities": + ["Linodes", "NodeBalancers", "Block Storage", "Object Storage", "GPU Linodes", + "Kubernetes", "Cloud Firewall", "Bare Metal", "Vlans", "VPCs", "Block Storage + Migrations", "Managed Databases", "Metadata"], "status": "ok", "resolvers": + {"ipv4": "66.228.42.5,96.126.106.5,50.116.53.5,50.116.58.5,50.116.61.5,50.116.62.5,66.175.211.5,97.107.133.4,207.192.69.4,207.192.69.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "eu-west", "country": "uk", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "178.79.182.5,176.58.107.5,176.58.116.5,176.58.121.5,151.236.220.5,212.71.252.5,212.71.253.5,109.74.192.20,109.74.193.20,109.74.194.20", + {"id": "eu-west", "label": "London, England, UK", "country": "uk", "capabilities": + ["Linodes", "NodeBalancers", "Cloud Firewall", "Vlans", "VPCs", "Metadata"], + "status": "ok", "resolvers": {"ipv4": "178.79.182.5,176.58.107.5,176.58.116.5,176.58.121.5,151.236.220.5,212.71.252.5,212.71.253.5,109.74.192.20,109.74.193.20,109.74.194.20", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ap-south", "country": "sg", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": + {"id": "ap-south", "label": "Singapore, SG", "country": "sg", "capabilities": + ["Linodes", "NodeBalancers", "Object Storage"], "status": "ok", "resolvers": {"ipv4": "139.162.11.5,139.162.13.5,139.162.14.5,139.162.15.5,139.162.16.5,139.162.21.5,139.162.27.5,103.3.60.18,103.3.60.19,103.3.60.20", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "eu-central", "country": "de", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", - "Vlans", "Block Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": + {"id": "eu-central", "label": "Frankfurt, DE", "country": "de", "capabilities": + ["Linodes", "NodeBalancers", "Object Storage"], "status": "ok", "resolvers": {"ipv4": "139.162.130.5,139.162.131.5,139.162.132.5,139.162.133.5,139.162.134.5,139.162.135.5,139.162.136.5,139.162.137.5,139.162.138.5,139.162.139.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}, - {"id": "ap-northeast", "country": "jp", "capabilities": ["Linodes", "NodeBalancers", - "Block Storage", "Kubernetes", "Cloud Firewall", "Block Storage Migrations", - "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "139.162.66.5,139.162.67.5,139.162.68.5,139.162.69.5,139.162.70.5,139.162.71.5,139.162.72.5,139.162.73.5,139.162.74.5,139.162.75.5", + {"id": "ap-northeast", "label": "Tokyo 2, JP", "country": "jp", "capabilities": + ["Linodes", "NodeBalancers"], "status": "ok", "resolvers": {"ipv4": "139.162.66.5,139.162.67.5,139.162.68.5,139.162.69.5,139.162.70.5,139.162.71.5,139.162.72.5,139.162.73.5,139.162.74.5,139.162.75.5", "ipv6": "1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678,1234::5678"}}], "page": 1, "pages": 1, "results": 11}' headers: @@ -87,6 +140,7 @@ interactions: Strict-Transport-Security: - max-age=31536000 Vary: + - Accept-Encoding - Authorization, X-Filter - Authorization, X-Filter X-Accepted-Oauth-Scopes: @@ -99,14 +153,14 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK code: 200 duration: "" - request: - body: '{"label":"go-test-def","region":"ap-west","client_conn_throttle":20,"tags":null}' + body: '{"label":"go-test-def","region":"us-east","client_conn_throttle":20,"tags":null,"firewall_id":7594}' form: {} headers: Accept: @@ -118,9 +172,9 @@ interactions: url: https://api.linode.com/v4beta/nodebalancers method: POST response: - body: '{"id": 259561, "label": "go-test-def", "region": "ap-west", "hostname": - "172-105-44-7.ip.linodeusercontent.com", "ipv4": "172.105.44.7", "ipv6": "1234::5678", - "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "client_conn_throttle": + body: '{"id": 178671, "label": "go-test-def", "region": "us-east", "hostname": + "207-192-68-164.ip.linodeusercontent.com", "ipv4": "207.192.68.164", "ipv6": + null, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "client_conn_throttle": 20, "tags": [], "transfer": {"in": null, "out": null, "total": null}}' headers: Access-Control-Allow-Credentials: @@ -135,8 +189,6 @@ interactions: - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status Cache-Control: - private, max-age=60, s-maxage=60 - Content-Length: - - "332" Content-Security-Policy: - default-src 'none' Content-Type: @@ -146,6 +198,7 @@ interactions: Strict-Transport-Security: - max-age=31536000 Vary: + - Accept-Encoding - Authorization, X-Filter X-Accepted-Oauth-Scopes: - nodebalancers:read_write @@ -157,7 +210,62 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/networking/firewalls/7594 + method: DELETE + response: + body: '{}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Length: + - "2" + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Server: + - nginx + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - firewall:read_write + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK @@ -176,11 +284,15 @@ interactions: url: https://api.linode.com/v4beta/nodebalancers method: GET response: - body: '{"data": [{"id": 259561, "label": "go-test-def", "region": "ap-west", "hostname": - "172-105-44-7.ip.linodeusercontent.com", "ipv4": "172.105.44.7", "ipv6": "1234::5678", + body: '{"data": [{"id": 177535, "label": "ania-node", "region": "us-east", "hostname": + "172-234-1-161.ip.linodeusercontent.com", "ipv4": "172.234.1.161", "ipv6": null, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "client_conn_throttle": - 20, "tags": [], "transfer": {"in": null, "out": null, "total": null}}], "page": - 1, "pages": 1, "results": 1}' + 0, "tags": [], "transfer": {"in": 12.814114570617676, "out": 5.911867141723633, + "total": 18.72598171234131}}, {"id": 178671, "label": "go-test-def", "region": + "us-east", "hostname": "207-192-68-164.ip.linodeusercontent.com", "ipv4": "207.192.68.164", + "ipv6": null, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", + "client_conn_throttle": 20, "tags": [], "transfer": {"in": null, "out": null, + "total": null}}], "page": 1, "pages": 1, "results": 2}' headers: Access-Control-Allow-Credentials: - "true" @@ -195,8 +307,6 @@ interactions: Cache-Control: - private, max-age=0, s-maxage=0, no-cache, no-store - private, max-age=60, s-maxage=60 - Content-Length: - - "381" Content-Security-Policy: - default-src 'none' Content-Type: @@ -206,6 +316,7 @@ interactions: Strict-Transport-Security: - max-age=31536000 Vary: + - Accept-Encoding - Authorization, X-Filter - Authorization, X-Filter X-Accepted-Oauth-Scopes: @@ -218,7 +329,7 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK @@ -234,7 +345,7 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/nodebalancers/259561 + url: https://api.linode.com/v4beta/nodebalancers/178671 method: DELETE response: body: '{}' @@ -273,7 +384,7 @@ interactions: X-Oauth-Scopes: - '*' X-Ratelimit-Limit: - - "800" + - "1200" X-Xss-Protection: - 1; mode=block status: 200 OK diff --git a/test/integration/nodebalancers_test.go b/test/integration/nodebalancers_test.go index 880a4f35b..b3b903aa1 100644 --- a/test/integration/nodebalancers_test.go +++ b/test/integration/nodebalancers_test.go @@ -85,11 +85,14 @@ func setupNodeBalancer(t *testing.T, fixturesYaml string) (*linodego.Client, *li t.Helper() var fixtureTeardown func() client, fixtureTeardown := createTestClient(t, fixturesYaml) + firewall, firewallTeardown, err := createFirewall(t, client) createOpts := linodego.NodeBalancerCreateOptions{ Label: &label, Region: getRegionsWithCaps(t, client, []string{"NodeBalancers"})[0], ClientConnThrottle: &clientConnThrottle, + FirewallID: firewall.ID, } + nodebalancer, err := client.CreateNodeBalancer(context.Background(), createOpts) if err != nil { t.Fatalf("Error listing nodebalancers, expected struct, got error %v", err) @@ -99,6 +102,7 @@ func setupNodeBalancer(t *testing.T, fixturesYaml string) (*linodego.Client, *li if err := client.DeleteNodeBalancer(context.Background(), nodebalancer.ID); err != nil { t.Errorf("Expected to delete a nodebalancer, but got %v", err) } + firewallTeardown() fixtureTeardown() } return client, nodebalancer, teardown, err