text
stringlengths
81
112k
Update the backend for a particular service and version. def update_backend(self, service_id, version_number, name_key, **kwargs): """Update the backend for a particular service and version.""" body = self._formdata(kwargs, FastlyBackend.FIELDS) content = self._fetch("/service/%s/version/%d/backend/%s" % (servic...
Performs a health check against each backend in version. If the backend has a specific type of healthcheck, that one is performed, otherwise a HEAD request to / is performed. The first item is the details on the Backend itself. The second item is details of the specific HTTP request performed as a health check. The thi...
Get a list of all cache settings for a particular service and version. def list_cache_settings(self, service_id, version_number): """Get a list of all cache settings for a particular service and version.""" content = self._fetch("/service/%s/version/%d/cache_settings" % (service_id, version_number)) return map(l...
Create a new cache settings object. def create_cache_settings(self, service_id, version_number, name, action, ttl=None, stale_ttl=None, cache_condition=None): """Create a new cache settings object.""" body = self._formdata({ "name": name, "action": action, "ttl": ttl, "stale_ttl": stal...
Get a specific cache settings object. def get_cache_settings(self, service_id, version_number, name): """Get a specific cache settings object.""" content = self._fetch("/service/%s/version/%d/cache_settings/%s" % (service_id, version_number, name)) return FastlyCacheSettings(self, content)
Update a specific cache settings object. def update_cache_settings(self, service_id, version_number, name_key, **kwargs): """Update a specific cache settings object.""" body = self._formdata(kwargs, FastlyCacheSettings.FIELDS) content = self._fetch("/service/%s/version/%d/cache_settings/%s" % (service_id, versio...
Delete a specific cache settings object. def delete_cache_settings(self, service_id, version_number, name): """Delete a specific cache settings object.""" content = self._fetch("/service/%s/version/%d/cache_settings/%s" % (service_id, version_number, name), method="DELETE") return self._status(content)
Gets all conditions for a particular service and version. def list_conditions(self, service_id, version_number): """Gets all conditions for a particular service and version.""" content = self._fetch("/service/%s/version/%d/condition" % (service_id, version_number)) return map(lambda x: FastlyCondition(self, x), ...
Creates a new condition. def create_condition(self, service_id, version_number, name, _type, statement, priority="10", comment=None): """Creates a new condition.""" body = self._formdata({ "name": name, "type": _type, "statement": statement, "priority": priority, "comment": comment,...
Gets a specified condition. def get_condition(self, service_id, version_number, name): """Gets a specified condition.""" content = self._fetch("/service/%s/version/%d/condition/%s" % (service_id, version_number, name)) return FastlyCondition(self, content)
Updates the specified condition. def update_condition(self, service_id, version_number, name_key, **kwargs): """Updates the specified condition.""" body = self._formdata(kwargs, FastlyCondition.FIELDS) content = self._fetch("/service/%s/version/%d/condition/%s" % (service_id, version_number, name_key), method="P...
Retrieve headers and MD5 hash of the content for a particular url from each Fastly edge server. def content_edge_check(self, url): """Retrieve headers and MD5 hash of the content for a particular url from each Fastly edge server.""" prefixes = ["http://", "https://"] for prefix in prefixes: if url.startswith(...
Get a specific customer. def get_customer(self, customer_id): """Get a specific customer.""" content = self._fetch("/customer/%s" % customer_id) return FastlyCustomer(self, content)
List all users from a specified customer id. def list_customer_users(self, customer_id): """List all users from a specified customer id.""" content = self._fetch("/customer/users/%s" % customer_id) return map(lambda x: FastlyUser(self, x), content)
Update a customer. def update_customer(self, customer_id, **kwargs): """Update a customer.""" body = self._formdata(kwargs, FastlyCustomer.FIELDS) content = self._fetch("/customer/%s" % customer_id, method="PUT", body=body) return FastlyCustomer(self, content)
Delete a customer. def delete_customer(self, customer_id): """Delete a customer.""" content = self._fetch("/customer/%s" % customer_id, method="DELETE") return self._status(content)
List the directors for a particular service and version. def list_directors(self, service_id, version_number): """List the directors for a particular service and version.""" content = self._fetch("/service/%s/version/%d/director" % (service_id, version_number)) return map(lambda x: FastlyDirector(self, x), conte...
Create a director for a particular service and version. def create_director(self, service_id, version_number, name, quorum=75, _type=FastlyDirectorType.RANDOM, retries=5, shield=None): """Create a director for a particular service and version.""" body = self._formdata({ "name": name, "quorum": qu...
Get the director for a particular service and version. def get_director(self, service_id, version_number, name): """Get the director for a particular service and version.""" content = self._fetch("/service/%s/version/%d/director/%s" % (service_id, version_number, name)) return FastlyDirector(self, content)
Update the director for a particular service and version. def update_director(self, service_id, version_number, name_key, **kwargs): """Update the director for a particular service and version.""" body = self._formdata(kwargs, FastlyDirector.FIELDS) content = self._fetch("/service/%s/version/%d/director/%s" % (s...
Returns the relationship between a Backend and a Director. If the Backend has been associated with the Director, it returns a simple record indicating this. Otherwise, returns a 404. def get_director_backend(self, service_id, version_number, director_name, backend_name): """Returns the relationship between a Backend...
Deletes the relationship between a Backend and a Director. The Backend is no longer considered a member of the Director and thus will not have traffic balanced onto it from this Director. def delete_director_backend(self, service_id, version_number, director_name, backend_name): """Deletes the relationship between a...
List the domains for a particular service and version. def list_domains(self, service_id, version_number): """List the domains for a particular service and version.""" content = self._fetch("/service/%s/version/%d/domain" % (service_id, version_number)) return map(lambda x: FastlyDomain(self, x), content)
Create a domain for a particular service and version. def create_domain(self, service_id, version_number, name, comment=None): """Create a domain for a particular service and version.""" body = self._formdata({ "name": name, "comment": comment, }, FastlyDomain.FIELDS) content = self._fetch("/...
Get the domain for a particular service and version. def get_domain(self, service_id, version_number, name): """Get the domain for a particular service and version.""" content = self._fetch("/service/%s/version/%d/domain/%s" % (service_id, version_number, name)) return FastlyDomain(self, content)
Update the domain for a particular service and version. def update_domain(self, service_id, version_number, name_key, **kwargs): """Update the domain for a particular service and version.""" body = self._formdata(kwargs, FastlyDomain.FIELDS) content = self._fetch("/service/%s/version/%d/domain/%s" % (service_id,...
Checks the status of a domain's DNS record. Returns an array of 3 items. The first is the details for the domain. The second is the current CNAME of the domain. The third is a boolean indicating whether or not it has been properly setup to use Fastly. def check_domain(self, service_id, version_number, name): """Chec...
Checks the status of all domain DNS records for a Service Version. Returns an array items in the same format as the single domain /check. def check_domains(self, service_id, version_number): """Checks the status of all domain DNS records for a Service Version. Returns an array items in the same format as the single ...
Get the specified event log. def get_event_log(self, object_id): """Get the specified event log.""" content = self._fetch("/event_log/%s" % object_id, method="GET") return FastlyEventLog(self, content)
Retrieves all Header objects for a particular Version of a Service. def list_headers(self, service_id, version_number): """Retrieves all Header objects for a particular Version of a Service.""" content = self._fetch("/service/%s/version/%d/header" % (service_id, version_number)) return map(lambda x: FastlyHeader...
Creates a new Header object. def create_header(self, service_id, version_number, name, destination, source, _type=FastlyHeaderType.RESPONSE, action=FastlyHeaderAction.SET, regex=None, substitution=None, ignore_if_set=None, priority=10, response_condition=None, cache_condition=None, request_condition=None): body = se...
Retrieves a Header object by name. def get_header(self, service_id, version_number, name): """Retrieves a Header object by name.""" content = self._fetch("/service/%s/version/%d/header/%s" % (service_id, version_number, name)) return FastlyHeader(self, content)
Modifies an existing Header object by name. def update_header(self, service_id, version_number, name_key, **kwargs): """Modifies an existing Header object by name.""" body = self._formdata(kwargs, FastlyHeader.FIELDS) content = self._fetch("/service/%s/version/%d/header/%s" % (service_id, version_number, name_ke...
List all of the healthchecks for a particular service and version. def list_healthchecks(self, service_id, version_number): """List all of the healthchecks for a particular service and version.""" content = self._fetch("/service/%s/version/%d/healthcheck" % (service_id, version_number)) return map(lambda x: Fast...
Create a healthcheck for a particular service and version. def create_healthcheck(self, service_id, version_number, name, host, method="HEAD", path="/", http_version="1.1", timeout=1000, check_interval=5000, expected_response=200, window=5, threshold=3, initial=1): """Create a healthcheck ...
Get the healthcheck for a particular service and version. def get_healthcheck(self, service_id, version_number, name): """Get the healthcheck for a particular service and version.""" content = self._fetch("/service/%s/version/%d/healthcheck/%s" % (service_id, version_number, name)) return FastlyHealthCheck(self,...
Purge an individual URL. def purge_url(self, host, path): """Purge an individual URL.""" content = self._fetch(path, method="PURGE", headers={ "Host": host }) return FastlyPurge(self, content)
Get the status and times of a recently completed purge. def check_purge_status(self, purge_id): """Get the status and times of a recently completed purge.""" content = self._fetch("/purge?id=%s" % purge_id) return map(lambda x: FastlyPurgeStatus(self, x), content)
Returns a list of all Request Settings objects for the given service and version. def list_request_settings(self, service_id, version_number): """Returns a list of all Request Settings objects for the given service and version.""" content = self._fetch("/service/%s/version/%d/request_settings" % (service_id, versi...
Creates a new Request Settings object. def create_request_setting(self, service_id, version_number, name, default_host=None, force_miss=None, force_ssl=None, action=None, bypass_busy_wait=None, max_stale_age=None, hash_keys=None, xff=None, timer_support=None, geo_headers=None, request_condi...
Gets the specified Request Settings object. def get_request_setting(self, service_id, version_number, name): """Gets the specified Request Settings object.""" content = self._fetch("/service/%s/version/%d/request_settings/%s" % (service_id, version_number, name)) return FastlyRequestSetting(self, content)
Updates the specified Request Settings object. def update_request_setting(self, service_id, version_number, name_key, **kwargs): """Updates the specified Request Settings object.""" body = self._formdata(kwargs, FastlyHealthCheck.FIELDS) content = self._fetch("/service/%s/version/%d/request_settings/%s" % (servi...
Returns all Response Objects for the specified service and version. def list_response_objects(self, service_id, version_number): """Returns all Response Objects for the specified service and version.""" content = self._fetch("/service/%s/version/%d/response_object" % (service_id, version_number)) return map(lamb...
Creates a new Response Object. def create_response_object(self, service_id, version_number, name, status="200", response="OK", content="", request_condition=None, cache_condition=None): """Creates a new Response Object.""" body = self._formdata({ "name": name, "status": status, "response": response, "c...
Gets the specified Response Object. def get_response_object(self, service_id, version_number, name): """Gets the specified Response Object.""" content = self._fetch("/service/%s/version/%d/response_object/%s" % (service_id, version_number, name)) return FastlyResponseObject(self, content)
Updates the specified Response Object. def update_response_object(self, service_id, version_number, name_key, **kwargs): """Updates the specified Response Object.""" body = self._formdata(kwargs, FastlyResponseObject.FIELDS) content = self._fetch("/service/%s/version/%d/response_object/%s" % (service_id, version...
Create a service. def create_service(self, customer_id, name, publish_key=None, comment=None): """Create a service.""" body = self._formdata({ "customer_id": customer_id, "name": name, "publish_key": publish_key, "comment": comment, }, FastlyService.FIELDS) content = self._fetch("/service", method=...
List Services. def list_services(self): """List Services.""" content = self._fetch("/service") return map(lambda x: FastlyService(self, x), content)
Get a specific service by id. def get_service(self, service_id): """Get a specific service by id.""" content = self._fetch("/service/%s" % service_id) return FastlyService(self, content)
List detailed information on a specified service. def get_service_details(self, service_id): """List detailed information on a specified service.""" content = self._fetch("/service/%s/details" % service_id) return FastlyService(self, content)
Get a specific service by name. def get_service_by_name(self, service_name): """Get a specific service by name.""" content = self._fetch("/service/search?name=%s" % service_name) return FastlyService(self, content)
Update a service. def update_service(self, service_id, **kwargs): """Update a service.""" body = self._formdata(kwargs, FastlyService.FIELDS) content = self._fetch("/service/%s" % service_id, method="PUT", body=body) return FastlyService(self, content)
Delete a service. def delete_service(self, service_id): """Delete a service.""" content = self._fetch("/service/%s" % service_id, method="DELETE") return self._status(content)
List the domains within a service. def list_domains_by_service(self, service_id): """List the domains within a service.""" content = self._fetch("/service/%s/domain" % service_id, method="GET") return map(lambda x: FastlyDomain(self, x), content)
Purge everything from a service. def purge_service(self, service_id): """Purge everything from a service.""" content = self._fetch("/service/%s/purge_all" % service_id, method="POST") return self._status(content)
Purge a particular service by a key. def purge_service_by_key(self, service_id, key): """Purge a particular service by a key.""" content = self._fetch("/service/%s/purge/%s" % (service_id, key), method="POST") return self._status(content)
Get the settings for a particular service and version. def get_settings(self, service_id, version_number): """Get the settings for a particular service and version.""" content = self._fetch("/service/%s/version/%d/settings" % (service_id, version_number)) return FastlySettings(self, content)
Update the settings for a particular service and version. def update_settings(self, service_id, version_number, settings={}): """Update the settings for a particular service and version.""" body = urllib.urlencode(settings) content = self._fetch("/service/%s/version/%d/settings" % (service_id, version_number), m...
Get the stats from a service. def get_stats(self, service_id, stat_type=FastlyStatsType.ALL): """Get the stats from a service.""" content = self._fetch("/service/%s/stats/%s" % (service_id, stat_type)) return content
List all of the Syslogs for a particular service and version. def list_syslogs(self, service_id, version_number): """List all of the Syslogs for a particular service and version.""" content = self._fetch("/service/%s/version/%d/syslog" % (service_id, version_number)) return map(lambda x: FastlySyslog(self, x), c...
Create a Syslog for a particular service and version. def create_syslog(self, service_id, version_number, name, address, port=514, use_tls="0", tls_ca_cert=None, token=None, _format=None, response_condition=None): """Create a Syslog for a particular service and version.""" body = self._formdata...
Get the Syslog for a particular service and version. def get_syslog(self, service_id, version_number, name): """Get the Syslog for a particular service and version.""" content = self._fetch("/service/%s/version/%d/syslog/%s" % (service_id, version_number, name)) return FastlySyslog(self, content)
Update the Syslog for a particular service and version. def update_syslog(self, service_id, version_number, name_key, **kwargs): """Update the Syslog for a particular service and version.""" body = self._formdata(kwargs, FastlySyslog.FIELDS) content = self._fetch("/service/%s/version/%d/syslog/%s" % (service_id,...
Update the user's password to a new one. def change_password(self, old_password, new_password): """Update the user's password to a new one.""" body = self._formdata({ "old_password": old_password, "password": new_password, }, ["old_password", "password"]) content = self._fetch("/current_user/password", m...
Get a specific user. def get_user(self, user_id): """Get a specific user.""" content = self._fetch("/user/%s" % user_id) return FastlyUser(self, content)
Create a user. def create_user(self, customer_id, name, login, password, role=FastlyRoles.USER, require_new_password=True): """Create a user.""" body = self._formdata({ "customer_id": customer_id, "name": name, "login": login, "password": password, "role": role, "require_new_password": require_ne...
Update a user. def update_user(self, user_id, **kwargs): """Update a user.""" body = self._formdata(kwargs, FastlyUser.FIELDS) content = self._fetch("/user/%s" % user_id, method="PUT", body=body) return FastlyUser(self, content)
Delete a user. def delete_user(self, user_id): """Delete a user.""" content = self._fetch("/user/%s" % user_id, method="DELETE") return self._status(content)
Requests a password reset for the specified user. def request_password_reset(self, user_id): """Requests a password reset for the specified user.""" content = self._fetch("/user/%s/password/request_reset" % (user_id), method="POST") return FastlyUser(self, content)
List the uploaded VCLs for a particular service and version. def list_vcls(self, service_id, version_number): """List the uploaded VCLs for a particular service and version.""" content = self._fetch("/service/%s/version/%d/vcl" % (service_id, version_number)) return map(lambda x: FastlyVCL(self, x), content)
Upload a VCL for a particular service and version. def upload_vcl(self, service_id, version_number, name, content, main=None, comment=None): """Upload a VCL for a particular service and version.""" body = self._formdata({ "name": name, "content": content, "comment": comment, "main": main, }, FastlyVC...
Get the uploaded VCL for a particular service and version. def get_vcl(self, service_id, version_number, name, include_content=True): """Get the uploaded VCL for a particular service and version.""" content = self._fetch("/service/%s/version/%d/vcl/%s?include_content=%d" % (service_id, version_number, name, int(in...
Get the uploaded VCL for a particular service and version with HTML syntax highlighting. def get_vcl_html(self, service_id, version_number, name): """Get the uploaded VCL for a particular service and version with HTML syntax highlighting.""" content = self._fetch("/service/%s/version/%d/vcl/%s/content" % (service_...
Display the generated VCL for a particular service and version. def get_generated_vcl(self, service_id, version_number): """Display the generated VCL for a particular service and version.""" content = self._fetch("/service/%s/version/%d/generated_vcl" % (service_id, version_number)) return FastlyVCL(self, conten...
Display the content of generated VCL with HTML syntax highlighting. def get_generated_vcl_html(self, service_id, version_number): """Display the content of generated VCL with HTML syntax highlighting.""" content = self._fetch("/service/%s/version/%d/generated_vcl/content" % (service_id, version_number)) return c...
Set the specified VCL as the main. def set_main_vcl(self, service_id, version_number, name): """Set the specified VCL as the main.""" content = self._fetch("/service/%s/version/%d/vcl/%s/main" % (service_id, version_number, name), method="PUT") return FastlyVCL(self, content)
Update the uploaded VCL for a particular service and version. def update_vcl(self, service_id, version_number, name_key, **kwargs): """Update the uploaded VCL for a particular service and version.""" body = self._formdata(kwargs, FastlyVCL.FIELDS) content = self._fetch("/service/%s/version/%d/vcl/%s" % (service_...
Create a version for a particular service. def create_version(self, service_id, inherit_service_id=None, comment=None): """Create a version for a particular service.""" body = self._formdata({ "service_id": service_id, "inherit_service_id": inherit_service_id, "comment": comment, }, FastlyVersion.FIELDS...
Get the version for a particular service. def get_version(self, service_id, version_number): """Get the version for a particular service.""" content = self._fetch("/service/%s/version/%d" % (service_id, version_number)) return FastlyVersion(self, content)
Update a particular version for a particular service. def update_version(self, service_id, version_number, **kwargs): """Update a particular version for a particular service.""" body = self._formdata(kwargs, FastlyVersion.FIELDS) content = self._fetch("/service/%s/version/%d/" % (service_id, version_number), met...
Clone the current configuration into a new version. def clone_version(self, service_id, version_number): """Clone the current configuration into a new version.""" content = self._fetch("/service/%s/version/%d/clone" % (service_id, version_number), method="PUT") return FastlyVersion(self, content)
Activate the current version. def activate_version(self, service_id, version_number): """Activate the current version.""" content = self._fetch("/service/%s/version/%d/activate" % (service_id, version_number), method="PUT") return FastlyVersion(self, content)
Deactivate the current version. def deactivate_version(self, service_id, version_number): """Deactivate the current version.""" content = self._fetch("/service/%s/version/%d/deactivate" % (service_id, version_number), method="PUT") return FastlyVersion(self, content)
Validate the version for a particular service and version. def validate_version(self, service_id, version_number): """Validate the version for a particular service and version.""" content = self._fetch("/service/%s/version/%d/validate" % (service_id, version_number)) return self._status(content)
Locks the specified version. def lock_version(self, service_id, version_number): """Locks the specified version.""" content = self._fetch("/service/%s/version/%d/lock" % (service_id, version_number)) return self._status(content)
Get all of the wordpresses for a specified service and version. def list_wordpressess(self, service_id, version_number): """Get all of the wordpresses for a specified service and version.""" content = self._fetch("/service/%s/version/%d/wordpress" % (service_id, version_number)) return map(lambda x: FastlyWordpr...
Create a wordpress for the specified service and version. def create_wordpress(self, service_id, version_number, name, path, comment=None): """Create a wordpress for the specified service and version.""" body = self._formdata({ "name": name, "path": path, "comment": comment, }, FastlyWordpress...
Get information on a specific wordpress. def get_wordpress(self, service_id, version_number, name): """Get information on a specific wordpress.""" content = self._fetch("/service/%s/version/%d/wordpress/%s" % (service_id, version_number, name)) return FastlyWordpress(self, content)
Update a specified wordpress. def update_wordpress(self, service_id, version_number, name_key, **kwargs): """Update a specified wordpress.""" body = self._formdata(kwargs, FastlyWordpress.FIELDS) content = self._fetch("/service/%s/version/%d/wordpress/%s" % (service_id, version_number, name_key), method="PUT", b...
Annotate 'word' for syllabification, stress, weights, and vowels. def annotate(self, word): '''Annotate 'word' for syllabification, stress, weights, and vowels.''' info = [] # e.g., [ ('\'nak.su.`tus.ta', 'PUSU', 'HLHL', 'AUUA'), ] for syllabification, _ in syllabify(self.normalize(word), str...
Run the necessary methods in the correct order def runner(self): """ Run the necessary methods in the correct order """ logging.info('Starting {} analysis pipeline'.format(self.analysistype)) # Run the analyses Sippr(self, self.cutoff) self.serotype_escherichia()...
Creates a report of the results def reporter(self): """ Creates a report of the results """ logging.info('Creating {} report'.format(self.analysistype)) # Create the path in which the reports are stored make_path(self.reportpath) header = 'Strain,Serotype\n' ...
Create attributes storing the best results for the O and H types def serotype_escherichia(self): """ Create attributes storing the best results for the O and H types """ for sample in self.runmetadata.samples: # Initialise negative results to be overwritten when necessary ...
Syllabify the given word. def _syllabify(word): '''Syllabify the given word.''' word = replace_umlauts(word) word, CONTINUE_VV, CONTINUE_VVV, applied_rules = apply_T1(word) if CONTINUE_VV: word, T2 = apply_T2(word) word, T4 = apply_T4(word) applied_rules += T2 + T4 if CONT...
There is a syllable boundary in front of every CV-sequence. def apply_T1(word): '''There is a syllable boundary in front of every CV-sequence.''' T1 = ' T1' WORD = _split_consonants_and_vowels(word) CONTINUE_VV = 0 CONTINUE_VVV = 0 for i, v in enumerate(WORD): if i == 0 and is_consona...
There is a syllable boundary within a sequence VV of two nonidentical vowels that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa]. def apply_T2(word): '''There is a syllable boundary within a sequence VV of two nonidentical vowels that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa].''' T...
An agglutination diphthong that ends in /u, y/ usually contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa]. def apply_T4(word): '''An agglutination diphthong that ends in /u, y/ usually contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va....
If a (V)VVV-sequence contains a VV-sequence that could be an /i/-final diphthong, there is a syllable boundary between it and the third vowel, e.g., [raa.ois.sa], [huo.uim.me], [la.eis.sa], [sel.vi.äi.si], [tai.an], [säi.e], [oi.om.me]. def apply_T5(word): # BROKEN '''If a (V)VVV-sequence contains a V...
If a VVV-sequence contains a long vowel, there is a syllable boundary between it and the third vowel, e.g. [kor.ke.aa], [yh.ti.öön], [ruu.an], [mää.yt.te]. def apply_T6(word): '''If a VVV-sequence contains a long vowel, there is a syllable boundary between it and the third vowel, e.g. [kor.ke.aa], [yh....
If a VVV-sequence does not contain a potential /i/-final diphthong, there is a syllable boundary between the second and third vowels, e.g. [kau.an], [leu.an], [kiu.as]. def apply_T7(word): '''If a VVV-sequence does not contain a potential /i/-final diphthong, there is a syllable boundary between the se...