sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
def saveDirectory(alias):
"""save a directory to a certain alias/nickname"""
if not settings.platformCompatible():
return False
dataFile = open(settings.getDataFile(), "wb")
currentDirectory = os.path.abspath(".")
directory = {alias : currentDirectory}
pickle.dump(directory, dataFile)
speech.success(alias + " ... | save a directory to a certain alias/nickname | entailment |
def goToDirectory(alias):
"""go to a saved directory"""
if not settings.platformCompatible():
return False
data = pickle.load(open(settings.getDataFile(), "rb"))
try:
data[alias]
except KeyError:
speech.fail("Sorry, it doesn't look like you have saved " + alias + " yet.")
speech.fail("Go to the directory y... | go to a saved directory | entailment |
def list(self, filters=None):
"""List model instances.
Currently this gets *everything* and iterates through all
possible pages in the API. This may be unsuitable for production
environments with huge databases, so finer grained page support
should likely be added at some point.... | List model instances.
Currently this gets *everything* and iterates through all
possible pages in the API. This may be unsuitable for production
environments with huge databases, so finer grained page support
should likely be added at some point.
Args:
filters (dict... | entailment |
def get(self, id):
"""Get the model instance with a given id.
Args:
id (int or str): The primary identifier (e.g., pk or UUID)
for the task instance to get.
Returns:
:class:`saltant.models.resource.Model`:
A :class:`saltant.models.resourc... | Get the model instance with a given id.
Args:
id (int or str): The primary identifier (e.g., pk or UUID)
for the task instance to get.
Returns:
:class:`saltant.models.resource.Model`:
A :class:`saltant.models.resource.Model` subclass
... | entailment |
def validate_request_success(
response_text, request_url, status_code, expected_status_code
):
"""Validates that a request was successful.
Args:
response_text (str): The response body of the request.
request_url (str): The URL the request was made at.
sta... | Validates that a request was successful.
Args:
response_text (str): The response body of the request.
request_url (str): The URL the request was made at.
status_code (int): The status code of the response.
expected_status_code (int): The expected status code of t... | entailment |
def sync(self):
"""Sync this model with latest data on the saltant server.
Note that in addition to returning the updated object, it also
updates the existing object.
Returns:
:class:`saltant.models.base_task_instance.BaseTaskInstance`:
This task instance ..... | Sync this model with latest data on the saltant server.
Note that in addition to returning the updated object, it also
updates the existing object.
Returns:
:class:`saltant.models.base_task_instance.BaseTaskInstance`:
This task instance ... instance after syncing. | entailment |
def wait_until_finished(
self, refresh_period=DEFAULT_TASK_INSTANCE_WAIT_REFRESH_PERIOD
):
"""Wait until a task instance with the given UUID is finished.
Args:
refresh_period (int, optional): How many seconds to wait
before checking the task's status. Defaults to... | Wait until a task instance with the given UUID is finished.
Args:
refresh_period (int, optional): How many seconds to wait
before checking the task's status. Defaults to 5
seconds.
Returns:
:class:`saltant.models.base_task_instance.BaseTaskInstan... | entailment |
def create(self, task_type_id, task_queue_id, arguments=None, name=""):
"""Create a task instance.
Args:
task_type_id (int): The ID of the task type to base the task
instance on.
task_queue_id (int): The ID of the task queue to run the job
on.
... | Create a task instance.
Args:
task_type_id (int): The ID of the task type to base the task
instance on.
task_queue_id (int): The ID of the task queue to run the job
on.
arguments (dict, optional): The arguments to give the task
... | entailment |
def clone(self, uuid):
"""Clone the task instance with given UUID.
Args:
uuid (str): The UUID of the task instance to clone.
Returns:
:class:`saltant.models.base_task_instance.BaseTaskInstance`:
A task instance model instance representing the task
... | Clone the task instance with given UUID.
Args:
uuid (str): The UUID of the task instance to clone.
Returns:
:class:`saltant.models.base_task_instance.BaseTaskInstance`:
A task instance model instance representing the task
instance created due to ... | entailment |
def terminate(self, uuid):
"""Terminate the task instance with given UUID.
Args:
uuid (str): The UUID of the task instance to terminate.
Returns:
:class:`saltant.models.base_task_instance.BaseTaskInstance`:
A task instance model instance representing the... | Terminate the task instance with given UUID.
Args:
uuid (str): The UUID of the task instance to terminate.
Returns:
:class:`saltant.models.base_task_instance.BaseTaskInstance`:
A task instance model instance representing the task
instance that wa... | entailment |
def wait_until_finished(
self, uuid, refresh_period=DEFAULT_TASK_INSTANCE_WAIT_REFRESH_PERIOD
):
"""Wait until a task instance with the given UUID is finished.
Args:
uuid (str): The UUID of the task instance to wait for.
refresh_period (float, optional): How many sec... | Wait until a task instance with the given UUID is finished.
Args:
uuid (str): The UUID of the task instance to wait for.
refresh_period (float, optional): How many seconds to wait
in between checking the task's status. Defaults to 5
seconds.
Retu... | entailment |
def response_data_to_model_instance(self, response_data):
"""Convert response data to a task instance model.
Args:
response_data (dict): The data from the request's response.
Returns:
:class:`saltant.models.base_task_instance.BaseTaskInstance`:
A task in... | Convert response data to a task instance model.
Args:
response_data (dict): The data from the request's response.
Returns:
:class:`saltant.models.base_task_instance.BaseTaskInstance`:
A task instance model instance representing the task
instance ... | entailment |
def kma(inputfile_1, out_path, databases, db_path_kma, min_cov=0.6,
threshold=0.9, kma_path="cge/kma/kma", sample_name="",
inputfile_2=None, kma_mrs=None, kma_gapopen=None,
kma_gapextend=None, kma_penalty=None, kma_reward=None, kma_pm=None,
kma_fpm=None, kma_memmode=False... | I expect that there will only be one hit pr gene, but if there are
more, I assume that the sequence of the hits are the same in the res
file and the aln file. | entailment |
def _ids_and_column_names(names, force_lower_case=False):
"""Ensure all column names are unique identifiers."""
fixed = OrderedDict()
for name in names:
identifier = RowWrapper._make_identifier(name)
if force_lower_case:
identifier = identifier.lower()
... | Ensure all column names are unique identifiers. | entailment |
def _make_identifier(string):
"""Attempt to convert string into a valid identifier by replacing invalid characters with "_"s,
and prefixing with "a_" if necessary."""
string = re.sub(r"[ \-+/\\*%&$£#@.,;:'" "?<>]", "_", string)
if re.match(r"^\d", string):
string = "a_{0}".fo... | Attempt to convert string into a valid identifier by replacing invalid characters with "_"s,
and prefixing with "a_" if necessary. | entailment |
def _increment_numeric_suffix(s):
"""Increment (or add) numeric suffix to identifier."""
if re.match(r".*\d+$", s):
return re.sub(r"\d+$", lambda n: str(int(n.group(0)) + 1), s)
return s + "_2" | Increment (or add) numeric suffix to identifier. | entailment |
def wrap(self, row: Union[Mapping[str, Any], Sequence[Any]]):
"""Return row tuple for row."""
return (
self.dataclass(
**{
ident: row[column_name]
for ident, column_name in self.ids_and_column_names.items()
}
... | Return row tuple for row. | entailment |
def wrap_all(self, rows: Iterable[Union[Mapping[str, Any], Sequence[Any]]]):
"""Return row tuple for each row in rows."""
return (self.wrap(r) for r in rows) | Return row tuple for each row in rows. | entailment |
def add_error_handlers(app):
"""Add custom error handlers for PyMacaronCoreExceptions to the app"""
def handle_validation_error(error):
response = jsonify({'message': str(error)})
response.status_code = error.status_code
return response
app.errorhandler(ValidationError)(handle_vali... | Add custom error handlers for PyMacaronCoreExceptions to the app | entailment |
def list_backends(self, service_id, version_number):
"""List all backends for a particular service and version."""
content = self._fetch("/service/%s/version/%d/backend" % (service_id, version_number))
return map(lambda x: FastlyBackend(self, x), content) | List all backends for a particular service and version. | entailment |
def create_backend(self,
service_id,
version_number,
name,
address,
use_ssl=False,
port=80,
connect_timeout=1000,
first_byte_timeout=15000,
between_bytes_timeout=10000,
error_threshold=0,
max_conn=20,
weight=100,
auto_loadbalance=False,
shield=None,
request_condition=None,
healthcheck... | Create a backend for a particular service and version. | entailment |
def get_backend(self, service_id, version_number, name):
"""Get the backend for a particular service and version."""
content = self._fetch("/service/%s/version/%d/backend/%s" % (service_id, version_number, name))
return FastlyBackend(self, content) | Get the backend for a particular service and version. | entailment |
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" % (service_id, version_number, name_key), method="PUT", body=body)
... | Update the backend for a particular service and version. | entailment |
def check_backends(self, service_id, version_number):
"""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... | 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... | entailment |
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(lambda x: FastlyCacheSettings(self, x), content) | Get a list of all cache settings for a particular service and version. | entailment |
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": stale_ttl,
"cache_condition": cache_co... | Create a new cache settings object. | entailment |
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) | Get a specific cache settings object. | entailment |
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, version_number, name_key), method="PUT", body=bo... | Update a specific cache settings object. | entailment |
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) | Delete a specific cache settings object. | entailment |
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), content) | Gets all conditions for a particular service and version. | entailment |
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,
}, FastlyCondition.FIEL... | Creates a new condition. | entailment |
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) | Gets a specified condition. | entailment |
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="PUT", body=body)
return FastlyCon... | Updates the specified condition. | entailment |
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(prefix):
url = url[len(prefix):]
break
content = self._fetch("/content/edge_check/%s" %... | Retrieve headers and MD5 hash of the content for a particular url from each Fastly edge server. | entailment |
def get_customer(self, customer_id):
"""Get a specific customer."""
content = self._fetch("/customer/%s" % customer_id)
return FastlyCustomer(self, content) | Get a specific customer. | entailment |
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) | List all users from a specified customer id. | entailment |
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) | Update a customer. | entailment |
def delete_customer(self, customer_id):
"""Delete a customer."""
content = self._fetch("/customer/%s" % customer_id, method="DELETE")
return self._status(content) | Delete a customer. | entailment |
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), content) | List the directors for a particular service and version. | entailment |
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": quorum,
"type": _type,
"retries": retries,
"shield... | Create a director for a particular service and version. | entailment |
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) | Get the director for a particular service and version. | entailment |
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" % (service_id, version_number, name_key), method="PUT", body=bo... | Update the director for a particular service and version. | entailment |
def get_director_backend(self, service_id, version_number, director_name, backend_name):
"""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."""
content = self._fetch("/service/%s/ver... | 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. | entailment |
def delete_director_backend(self, service_id, version_number, director_name, backend_name):
"""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."""
content = self._fetch("/servic... | 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. | entailment |
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) | List the domains for a particular service and version. | entailment |
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("/service/%s/version/%d/domain" % (service_id, version_nu... | Create a domain for a particular service and version. | entailment |
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) | Get the domain for a particular service and version. | entailment |
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, version_number, name_key), method="PUT", body=body)
re... | Update the domain for a particular service and version. | entailment |
def check_domain(self, service_id, version_number, name):
"""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."""
... | 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. | entailment |
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 domain /check."""
content = self._fetch("/service/%s/version/%d/domain/check_all" % (service_id, version_number))
return map(lambda x: ... | 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. | entailment |
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) | Get the specified event log. | entailment |
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(self, x), content) | Retrieves all Header objects for a particular Version of a Service. | entailment |
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 = self._formdata({
"name": name... | Creates a new Header object. | entailment |
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) | Retrieves a Header object by name. | entailment |
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_key), method="PUT", body=body)
return FastlyH... | Modifies an existing Header object by name. | entailment |
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: FastlyHealthCheck(self, x), content) | List all of the healthchecks for a particular service and version. | entailment |
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 for a particular service and version."""
body = self._form... | Create a healthcheck for a particular service and version. | entailment |
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, content) | Get the healthcheck for a particular service and version. | entailment |
def purge_url(self, host, path):
"""Purge an individual URL."""
content = self._fetch(path, method="PURGE", headers={ "Host": host })
return FastlyPurge(self, content) | Purge an individual URL. | entailment |
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) | Get the status and times of a recently completed purge. | entailment |
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, version_number))
return map(lambda x: FastlyRequestSetting(self, x), content) | Returns a list of all Request Settings objects for the given service and version. | entailment |
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_condition=None):
"""Creates a new Request S... | Creates a new Request Settings object. | entailment |
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) | Gets the specified Request Settings object. | entailment |
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" % (service_id, version_number, name_key), method="PUT", ... | Updates the specified Request Settings object. | entailment |
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(lambda x: FastlyResponseObject(self, x), content) | Returns all Response Objects for the specified service and version. | entailment |
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,
"content": content,
"request_co... | Creates a new Response Object. | entailment |
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) | Gets the specified Response Object. | entailment |
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_number, name_key), method="PUT", body=b... | Updates the specified Response Object. | entailment |
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="POST", body=body)
... | Create a service. | entailment |
def list_services(self):
"""List Services."""
content = self._fetch("/service")
return map(lambda x: FastlyService(self, x), content) | List Services. | entailment |
def get_service(self, service_id):
"""Get a specific service by id."""
content = self._fetch("/service/%s" % service_id)
return FastlyService(self, content) | Get a specific service by id. | entailment |
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) | List detailed information on a specified service. | entailment |
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) | Get a specific service by name. | entailment |
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) | Update a service. | entailment |
def delete_service(self, service_id):
"""Delete a service."""
content = self._fetch("/service/%s" % service_id, method="DELETE")
return self._status(content) | Delete a service. | entailment |
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) | List the domains within a service. | entailment |
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 everything from a service. | entailment |
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) | Purge a particular service by a key. | entailment |
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) | Get the settings for a particular service and version. | entailment |
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), method="PUT", body=body)
return FastlySettings(self, conte... | Update the settings for a particular service and version. | entailment |
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 | Get the stats from a service. | entailment |
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), content) | List all of the Syslogs for a particular service and version. | entailment |
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({
"name": name,
"address": address,
"port": p... | Create a Syslog for a particular service and version. | entailment |
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) | Get the Syslog for a particular service and version. | entailment |
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, version_number, name_key), method="PUT", body=body)
re... | Update the Syslog for a particular service and version. | entailment |
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", method="POST", body=body)
return FastlyUs... | Update the user's password to a new one. | entailment |
def get_user(self, user_id):
"""Get a specific user."""
content = self._fetch("/user/%s" % user_id)
return FastlyUser(self, content) | Get a specific user. | entailment |
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_new_password,
},... | Create a user. | entailment |
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) | Update a user. | entailment |
def delete_user(self, user_id):
"""Delete a user."""
content = self._fetch("/user/%s" % user_id, method="DELETE")
return self._status(content) | Delete a user. | entailment |
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) | Requests a password reset for the specified user. | entailment |
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) | List the uploaded VCLs for a particular service and version. | entailment |
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,
}, FastlyVCL.FIELDS)
content = self._fetch("/service/%s/versi... | Upload a VCL for a particular service and version. | entailment |
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(include_content)))
return FastlyVCL(self, content) | Get the uploaded VCL for a particular service and version. | entailment |
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_id, version_number, name))
return content.get("content", None) | Get the uploaded VCL for a particular service and version with HTML syntax highlighting. | entailment |
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, content) | Display the generated VCL for a particular service and version. | entailment |
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 content.get("content", None) | Display the content of generated VCL with HTML syntax highlighting. | entailment |
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) | Set the specified VCL as the main. | entailment |
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_id, version_number, name_key), method="PUT", body=body)
retur... | Update the uploaded VCL for a particular service and version. | entailment |
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)
content = self._fetch("/service/%s/versi... | Create a version for a particular service. | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.