Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
smon committed Apr 10, 2018
1 parent aa3bb6c commit 5d231b6
Show file tree
Hide file tree
Showing 39 changed files with 7,065 additions and 4,549 deletions.
246 changes: 98 additions & 148 deletions library/fastly_service.py

Large diffs are not rendered by default.

49 changes: 25 additions & 24 deletions tests/fixtures/cassettes/TestFastlyCacheSettings_tearDown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,81 +6,82 @@ interactions:
method: GET
uri: https://api.fastly.com/service/search?name=Fastly%20Ansible%20Module%20Test
response:
body: {string: !!python/unicode '{"name":"Fastly Ansible Module Test","deleted_at":null,"versions":[{"testing":false,"locked":false,"number":1,"active":false,"service_id":"6PD20Uj8RWetLDUZ17jgXd","staging":false,"created_at":"2018-04-06T12:12:48Z","deleted_at":null,"comment":"","updated_at":"2018-04-06T12:12:48Z","deployed":false},{"testing":false,"number":2,"service_id":"6PD20Uj8RWetLDUZ17jgXd","staging":false,"updated_at":"2018-04-06T12:12:53Z","deployed":false,"locked":true,"active":true,"deleted_at":null,"created_at":"2018-04-06T12:12:50Z","comment":""}],"created_at":"2018-04-06T12:12:48Z","customer_id":"31RPDMBpiruA1yfGA2djLm","comment":"","updated_at":"2018-04-06T12:12:48Z","id":"6PD20Uj8RWetLDUZ17jgXd"}'}
body: {string: !!python/unicode '{"name":"Fastly Ansible Module Test","deleted_at":null,"versions":[{"testing":false,"locked":false,"number":1,"active":false,"service_id":"2T6RaPUWpO8jsWHVVNXvc","staging":false,"created_at":"2018-04-10T14:39:42Z","deleted_at":null,"comment":"","updated_at":"2018-04-10T14:39:42Z","deployed":false},{"testing":false,"number":2,"service_id":"2T6RaPUWpO8jsWHVVNXvc","staging":false,"updated_at":"2018-04-10T14:39:51Z","deployed":false,"locked":true,"active":true,"deleted_at":null,"created_at":"2018-04-10T14:39:43Z","comment":""}],"created_at":"2018-04-10T14:39:42Z","customer_id":"31RPDMBpiruA1yfGA2djLm","comment":"","updated_at":"2018-04-10T14:39:42Z","id":"2T6RaPUWpO8jsWHVVNXvc"}'}
headers:
accept-ranges: [bytes]
age: ['0']
cache-control: [no-cache]
connection: [keep-alive]
content-length: ['686']
content-length: ['683']
content-type: [application/json]
date: ['Fri, 06 Apr 2018 12:12:55 GMT']
date: ['Tue, 10 Apr 2018 14:39:53 GMT']
status: [200 OK]
vary: [Accept-Encoding]
via: [1.1 varnish, 1.1 varnish]
x-cache: ['MISS, MISS']
x-cache-hits: ['0, 0']
x-served-by: ['app-slwdc9051-SL, cache-fra19146-FRA']
x-timer: ['S1523016775.941774,VS0,VE139']
x-served-by: ['app-slwdc9051-SL, cache-fra19136-FRA']
x-timer: ['S1523371193.167579,VS0,VE143']
status: {code: 200, message: OK}
- request:
body: null
headers:
Content-Type: [application/json]
method: GET
uri: https://api.fastly.com/service/6PD20Uj8RWetLDUZ17jgXd/details
uri: https://api.fastly.com/service/2T6RaPUWpO8jsWHVVNXvc/details
response:
body: {string: !!python/unicode '{"name":"Fastly Ansible Module Test","deleted_at":null,"versions":[{"testing":false,"locked":false,"number":1,"active":false,"service_id":"6PD20Uj8RWetLDUZ17jgXd","staging":false,"created_at":"2018-04-06T12:12:48Z","deleted_at":null,"comment":"","updated_at":"2018-04-06T12:12:48Z","deployed":false},{"testing":false,"locked":true,"number":2,"active":true,"service_id":"6PD20Uj8RWetLDUZ17jgXd","staging":false,"created_at":"2018-04-06T12:12:50Z","deleted_at":null,"comment":"","updated_at":"2018-04-06T12:12:53Z","deployed":false}],"created_at":"2018-04-06T12:12:48Z","customer_id":"31RPDMBpiruA1yfGA2djLm","comment":"","updated_at":"2018-04-06T12:12:48Z","id":"6PD20Uj8RWetLDUZ17jgXd","version":{"testing":false,"number":2,"service_id":"6PD20Uj8RWetLDUZ17jgXd","staging":false,"updated_at":"2018-04-06T12:12:53Z","deployed":false,"locked":true,"active":true,"deleted_at":null,"created_at":"2018-04-06T12:12:50Z","comment":"","acls":[],"backends":[{"max_tls_version":null,"ssl_ca_cert":null,"auto_loadbalance":false,"ssl_check_cert":true,"shield":null,"hostname":null,"ssl_client_cert":null,"error_threshold":0,"request_condition":"","first_byte_timeout":15000,"ssl_cert_hostname":null,"weight":100,"client_cert":null,"address":"127.0.0.1","ssl_hostname":null,"ssl_sni_hostname":null,"min_tls_version":null,"ipv6":null,"ipv4":"127.0.0.1","connect_timeout":1000,"ssl_ciphers":null,"name":"localhost","healthcheck":null,"port":80,"max_conn":200,"use_ssl":false,"comment":"","between_bytes_timeout":10000,"ssl_client_key":null}],"cache_settings":[{"stale_ttl":"10","ttl":null,"name":"cache-settings-config-name","action":null,"cache_condition":""}],"conditions":[],"dictionaries":[],"directors":[],"domains":[{"comment":"","name":"example8000.com"}],"gzips":[],"headers":[{"priority":"100","src":"\"https://u.jimcdn.com\"
body: {string: !!python/unicode '{"name":"Fastly Ansible Module Test","deleted_at":null,"versions":[{"testing":false,"locked":false,"number":1,"active":false,"service_id":"2T6RaPUWpO8jsWHVVNXvc","staging":false,"created_at":"2018-04-10T14:39:42Z","deleted_at":null,"comment":"","updated_at":"2018-04-10T14:39:42Z","deployed":false},{"testing":false,"locked":true,"number":2,"active":true,"service_id":"2T6RaPUWpO8jsWHVVNXvc","staging":false,"created_at":"2018-04-10T14:39:43Z","deleted_at":null,"comment":"","updated_at":"2018-04-10T14:39:51Z","deployed":false}],"created_at":"2018-04-10T14:39:42Z","customer_id":"31RPDMBpiruA1yfGA2djLm","comment":"","updated_at":"2018-04-10T14:39:42Z","id":"2T6RaPUWpO8jsWHVVNXvc","version":{"testing":false,"number":2,"service_id":"2T6RaPUWpO8jsWHVVNXvc","staging":false,"updated_at":"2018-04-10T14:39:51Z","deployed":false,"locked":true,"active":true,"deleted_at":null,"created_at":"2018-04-10T14:39:43Z","comment":"","acls":[],"backends":[{"max_tls_version":null,"ssl_ca_cert":null,"auto_loadbalance":false,"ssl_check_cert":true,"shield":null,"hostname":null,"ssl_client_cert":null,"error_threshold":0,"request_condition":"","first_byte_timeout":15000,"ssl_cert_hostname":null,"weight":100,"client_cert":null,"address":"127.0.0.1","ssl_hostname":null,"ssl_sni_hostname":null,"min_tls_version":null,"ipv6":null,"ipv4":"127.0.0.1","connect_timeout":1000,"ssl_ciphers":null,"name":"localhost","healthcheck":null,"port":80,"max_conn":200,"use_ssl":false,"comment":"","between_bytes_timeout":10000,"ssl_client_key":null}],"cache_settings":[{"stale_ttl":"10","ttl":null,"name":"cache-settings-config-name","action":null,"cache_condition":""}],"conditions":[],"dictionaries":[],"directors":[],"domains":[{"comment":"","name":"example8000.com"}],"gzips":[],"headers":[{"priority":"100","src":"\"https://u.jimcdn.com\"
req.url.path","name":"Set Location header","substitution":"","ignore_if_set":"0","cache_condition":null,"request_condition":null,"regex":"","response_condition":null,"action":"set","type":"response","dst":"http.Location"}],"healthchecks":[],"request_settings":[],"response_objects":[{"request_condition":"","content_type":"","status":"200","response":"Ok","name":"Set
200 status code","content":"","cache_condition":""}],"snippets":[],"vcls":[],"wordpress":[],"settings":{"general.default_ttl":3600,"general.default_host":"","general.default_pci":0}},"active_version":{"testing":false,"number":2,"service_id":"6PD20Uj8RWetLDUZ17jgXd","staging":false,"updated_at":"2018-04-06T12:12:53Z","deployed":false,"locked":true,"active":true,"deleted_at":null,"created_at":"2018-04-06T12:12:50Z","comment":"","acls":[],"backends":[{"max_tls_version":null,"ssl_ca_cert":null,"auto_loadbalance":false,"ssl_check_cert":true,"shield":null,"hostname":null,"ssl_client_cert":null,"error_threshold":0,"request_condition":"","first_byte_timeout":15000,"ssl_cert_hostname":null,"weight":100,"client_cert":null,"address":"127.0.0.1","ssl_hostname":null,"ssl_sni_hostname":null,"min_tls_version":null,"ipv6":null,"ipv4":"127.0.0.1","connect_timeout":1000,"ssl_ciphers":null,"name":"localhost","healthcheck":null,"port":80,"max_conn":200,"use_ssl":false,"comment":"","between_bytes_timeout":10000,"ssl_client_key":null}],"cache_settings":[{"stale_ttl":"10","ttl":null,"name":"cache-settings-config-name","action":null,"cache_condition":""}],"conditions":[],"dictionaries":[],"directors":[],"domains":[{"comment":"","name":"example8000.com"}],"gzips":[],"headers":[{"priority":"100","src":"\"https://u.jimcdn.com\"
200 status code","content":"","cache_condition":""}],"snippets":[],"vcls":[],"wordpress":[],"settings":{"general.default_ttl":3600,"general.default_host":"","general.default_pci":0}},"active_version":{"testing":false,"number":2,"service_id":"2T6RaPUWpO8jsWHVVNXvc","staging":false,"updated_at":"2018-04-10T14:39:51Z","deployed":false,"locked":true,"active":true,"deleted_at":null,"created_at":"2018-04-10T14:39:43Z","comment":"","acls":[],"backends":[{"max_tls_version":null,"ssl_ca_cert":null,"auto_loadbalance":false,"ssl_check_cert":true,"shield":null,"hostname":null,"ssl_client_cert":null,"error_threshold":0,"request_condition":"","first_byte_timeout":15000,"ssl_cert_hostname":null,"weight":100,"client_cert":null,"address":"127.0.0.1","ssl_hostname":null,"ssl_sni_hostname":null,"min_tls_version":null,"ipv6":null,"ipv4":"127.0.0.1","connect_timeout":1000,"ssl_ciphers":null,"name":"localhost","healthcheck":null,"port":80,"max_conn":200,"use_ssl":false,"comment":"","between_bytes_timeout":10000,"ssl_client_key":null}],"cache_settings":[{"stale_ttl":"10","ttl":null,"name":"cache-settings-config-name","action":null,"cache_condition":""}],"conditions":[],"dictionaries":[],"directors":[],"domains":[{"comment":"","name":"example8000.com"}],"gzips":[],"headers":[{"priority":"100","src":"\"https://u.jimcdn.com\"
req.url.path","name":"Set Location header","substitution":"","ignore_if_set":"0","cache_condition":null,"request_condition":null,"regex":"","response_condition":null,"action":"set","type":"response","dst":"http.Location"}],"healthchecks":[],"request_settings":[],"response_objects":[{"request_condition":"","content_type":"","status":"200","response":"Ok","name":"Set
200 status code","content":"","cache_condition":""}],"snippets":[],"vcls":[],"wordpress":[],"settings":{"general.default_ttl":3600,"general.default_host":"","general.default_pci":0}}}'}
headers:
accept-ranges: [bytes]
age: ['0']
cache-control: [no-cache]
connection: [keep-alive]
content-length: ['4061']
content-length: ['4056']
content-type: [application/json]
date: ['Fri, 06 Apr 2018 12:12:55 GMT']
date: ['Tue, 10 Apr 2018 14:39:53 GMT']
status: [200 OK]
vary: [Accept-Encoding]
via: [1.1 varnish, 1.1 varnish]
x-cache: ['MISS, MISS']
x-cache-hits: ['0, 0']
x-served-by: ['app-slwdc9051-SL, cache-fra19144-FRA']
x-timer: ['S1523016775.144295,VS0,VE404']
x-served-by: ['app-slwdc9051-SL, cache-fra19142-FRA']
x-timer: ['S1523371193.375692,VS0,VE109']
status: {code: 200, message: OK}
- request:
body: null
headers:
Content-Type: [application/json]
method: PUT
uri: https://api.fastly.com/service/6PD20Uj8RWetLDUZ17jgXd/version/2/deactivate
uri: https://api.fastly.com/service/2T6RaPUWpO8jsWHVVNXvc/version/2/deactivate
response:
body: {string: !!python/unicode '{"testing":false,"locked":true,"number":2,"active":false,"service_id":"6PD20Uj8RWetLDUZ17jgXd","staging":false,"created_at":"2018-04-06T12:12:50Z","deleted_at":null,"comment":"","updated_at":"2018-04-06T12:12:53Z","deployed":false}'}
body: {string: !!python/unicode '{"testing":false,"locked":true,"number":2,"active":false,"service_id":"2T6RaPUWpO8jsWHVVNXvc","staging":false,"created_at":"2018-04-10T14:39:43Z","deleted_at":null,"comment":"","updated_at":"2018-04-10T14:39:51Z","deployed":false}'}
headers:
accept-ranges: [bytes]
cache-control: [no-cache]
connection: [keep-alive]
content-length: ['231']
content-length: ['230']
content-type: [application/json]
date: ['Fri, 06 Apr 2018 12:12:56 GMT']
date: ['Tue, 10 Apr 2018 14:39:54 GMT']
fastly-ratelimit-remaining: ['990']
fastly-ratelimit-reset: ['1523019600']
fastly-ratelimit-reset: ['1523372400']
status: [200 OK]
vary: [Accept-Encoding]
via: [1.1 varnish, 1.1 varnish]
x-cache: ['MISS, MISS']
x-cache-hits: ['0, 0']
x-served-by: ['app-slwdc9051-SL, cache-fra19136-FRA']
x-timer: ['S1523016776.808666,VS0,VE424']
x-served-by: ['app-slwdc9051-SL, cache-fra19137-FRA']
x-timer: ['S1523371194.550275,VS0,VE507']
status: {code: 200, message: OK}
- request:
body: null
headers:
Content-Type: [application/json]
method: DELETE
uri: https://api.fastly.com/service/6PD20Uj8RWetLDUZ17jgXd
uri: https://api.fastly.com/service/2T6RaPUWpO8jsWHVVNXvc
response:
body: {string: !!python/unicode '{"status":"ok"}'}
headers:
Expand All @@ -89,15 +90,15 @@ interactions:
connection: [keep-alive]
content-length: ['15']
content-type: [application/json]
date: ['Fri, 06 Apr 2018 12:12:56 GMT']
date: ['Tue, 10 Apr 2018 14:39:54 GMT']
fastly-ratelimit-remaining: ['989']
fastly-ratelimit-reset: ['1523019600']
fastly-ratelimit-reset: ['1523372400']
status: [200 OK]
vary: [Accept-Encoding]
via: [1.1 varnish, 1.1 varnish]
x-cache: ['MISS, MISS']
x-cache-hits: ['0, 0']
x-served-by: ['app-slwdc9051-SL, cache-fra19133-FRA']
x-timer: ['S1523016776.327893,VS0,VE459']
x-served-by: ['app-slwdc9051-SL, cache-fra19139-FRA']
x-timer: ['S1523371194.307502,VS0,VE140']
status: {code: 200, message: OK}
version: 1
Loading

0 comments on commit 5d231b6

Please sign in to comment.