repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseUser.revoke_user_access
def revoke_user_access(self, db_names, strict=True): """ Revokes access to the databases listed in `db_names` for the user. """ return self.manager.revoke_user_access(self, db_names, strict=strict)
python
def revoke_user_access(self, db_names, strict=True): """ Revokes access to the databases listed in `db_names` for the user. """ return self.manager.revoke_user_access(self, db_names, strict=strict)
Revokes access to the databases listed in `db_names` for the user.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L649-L653
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseClient._configure_manager
def _configure_manager(self): """ Creates a manager to handle the instances, and another to handle flavors. """ self._manager = CloudDatabaseManager(self, resource_class=CloudDatabaseInstance, response_key="instance", uri_base="instances") ...
python
def _configure_manager(self): """ Creates a manager to handle the instances, and another to handle flavors. """ self._manager = CloudDatabaseManager(self, resource_class=CloudDatabaseInstance, response_key="instance", uri_base="instances") ...
Creates a manager to handle the instances, and another to handle flavors.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L683-L696
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseClient.list_databases
def list_databases(self, instance, limit=None, marker=None): """Returns all databases for the specified instance.""" return instance.list_databases(limit=limit, marker=marker)
python
def list_databases(self, instance, limit=None, marker=None): """Returns all databases for the specified instance.""" return instance.list_databases(limit=limit, marker=marker)
Returns all databases for the specified instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L700-L702
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseClient.create_database
def create_database(self, instance, name, character_set=None, collate=None): """Creates a database with the specified name on the given instance.""" return instance.create_database(name, character_set=character_set, collate=collate)
python
def create_database(self, instance, name, character_set=None, collate=None): """Creates a database with the specified name on the given instance.""" return instance.create_database(name, character_set=character_set, collate=collate)
Creates a database with the specified name on the given instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L706-L710
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseClient.list_users
def list_users(self, instance, limit=None, marker=None): """Returns all users for the specified instance.""" return instance.list_users(limit=limit, marker=marker)
python
def list_users(self, instance, limit=None, marker=None): """Returns all users for the specified instance.""" return instance.list_users(limit=limit, marker=marker)
Returns all users for the specified instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L730-L732
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseClient.create_user
def create_user(self, instance, name, password, database_names, host=None): """ Creates a user with the specified name and password, and gives that user access to the specified database(s). """ return instance.create_user(name=name, password=password, database_nam...
python
def create_user(self, instance, name, password, database_names, host=None): """ Creates a user with the specified name and password, and gives that user access to the specified database(s). """ return instance.create_user(name=name, password=password, database_nam...
Creates a user with the specified name and password, and gives that user access to the specified database(s).
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L736-L742
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseClient.update_user
def update_user(self, instance, user, name=None, password=None, host=None): """ Allows you to change one or more of the user's username, password, or host. """ return instance.update_user(user, name=name, password=password, host=host)
python
def update_user(self, instance, user, name=None, password=None, host=None): """ Allows you to change one or more of the user's username, password, or host. """ return instance.update_user(user, name=name, password=password, host=host)
Allows you to change one or more of the user's username, password, or host.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L774-L780
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseClient.grant_user_access
def grant_user_access(self, instance, user, db_names, strict=True): """ Gives access to the databases listed in `db_names` to the user on the specified instance. """ return instance.grant_user_access(user, db_names, strict=strict)
python
def grant_user_access(self, instance, user, db_names, strict=True): """ Gives access to the databases listed in `db_names` to the user on the specified instance. """ return instance.grant_user_access(user, db_names, strict=strict)
Gives access to the databases listed in `db_names` to the user on the specified instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L793-L798
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseClient.revoke_user_access
def revoke_user_access(self, instance, user, db_names, strict=True): """ Revokes access to the databases listed in `db_names` for the user on the specified instance. """ return instance.revoke_user_access(user, db_names, strict=strict)
python
def revoke_user_access(self, instance, user, db_names, strict=True): """ Revokes access to the databases listed in `db_names` for the user on the specified instance. """ return instance.revoke_user_access(user, db_names, strict=strict)
Revokes access to the databases listed in `db_names` for the user on the specified instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L802-L807
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseClient.list_flavors
def list_flavors(self, limit=None, marker=None): """Returns a list of all available Flavors.""" return self._flavor_manager.list(limit=limit, marker=marker)
python
def list_flavors(self, limit=None, marker=None): """Returns a list of all available Flavors.""" return self._flavor_manager.list(limit=limit, marker=marker)
Returns a list of all available Flavors.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L842-L844
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseClient._get_flavor_ref
def _get_flavor_ref(self, flavor): """ Flavors are odd in that the API expects an href link, not an ID, as with nearly every other resource. This method takes either a CloudDatabaseFlavor object, a flavor ID, a RAM size, or a flavor name, and uses that to determine the appropriat...
python
def _get_flavor_ref(self, flavor): """ Flavors are odd in that the API expects an href link, not an ID, as with nearly every other resource. This method takes either a CloudDatabaseFlavor object, a flavor ID, a RAM size, or a flavor name, and uses that to determine the appropriat...
Flavors are odd in that the API expects an href link, not an ID, as with nearly every other resource. This method takes either a CloudDatabaseFlavor object, a flavor ID, a RAM size, or a flavor name, and uses that to determine the appropriate href.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L852-L887
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseClient.create_backup
def create_backup(self, instance, name, description=None): """ Creates a backup of the specified instance, giving it the specified name along with an optional description. """ return instance.create_backup(name, description=description)
python
def create_backup(self, instance, name, description=None): """ Creates a backup of the specified instance, giving it the specified name along with an optional description. """ return instance.create_backup(name, description=description)
Creates a backup of the specified instance, giving it the specified name along with an optional description.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L914-L919
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseClient.restore_backup
def restore_backup(self, backup, name, flavor, volume): """ Restores a backup to a new database instance. You must supply a backup (either the ID or a CloudDatabaseBackup object), a name for the new instance, as well as a flavor and size (in GB) for the instance. """ retu...
python
def restore_backup(self, backup, name, flavor, volume): """ Restores a backup to a new database instance. You must supply a backup (either the ID or a CloudDatabaseBackup object), a name for the new instance, as well as a flavor and size (in GB) for the instance. """ retu...
Restores a backup to a new database instance. You must supply a backup (either the ID or a CloudDatabaseBackup object), a name for the new instance, as well as a flavor and size (in GB) for the instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L922-L928
pycontribs/pyrax
pyrax/utils.py
runproc
def runproc(cmd): """ Convenience method for executing operating system commands. Accepts a single string that would be the command as executed on the command line. Returns a 2-tuple consisting of the output of (STDOUT, STDERR). In your code you should check for an empty STDERR output to deter...
python
def runproc(cmd): """ Convenience method for executing operating system commands. Accepts a single string that would be the command as executed on the command line. Returns a 2-tuple consisting of the output of (STDOUT, STDERR). In your code you should check for an empty STDERR output to deter...
Convenience method for executing operating system commands. Accepts a single string that would be the command as executed on the command line. Returns a 2-tuple consisting of the output of (STDOUT, STDERR). In your code you should check for an empty STDERR output to determine if your command compl...
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L39-L53
pycontribs/pyrax
pyrax/utils.py
get_checksum
def get_checksum(content, encoding="utf8", block_size=8192): """ Returns the MD5 checksum in hex for the given content. If 'content' is a file-like object, the content will be obtained from its read() method. If 'content' is a file path, that file is read and its contents used. Otherwise, 'content' ...
python
def get_checksum(content, encoding="utf8", block_size=8192): """ Returns the MD5 checksum in hex for the given content. If 'content' is a file-like object, the content will be obtained from its read() method. If 'content' is a file path, that file is read and its contents used. Otherwise, 'content' ...
Returns the MD5 checksum in hex for the given content. If 'content' is a file-like object, the content will be obtained from its read() method. If 'content' is a file path, that file is read and its contents used. Otherwise, 'content' is assumed to be the string whose checksum is desired. If the content...
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L223-L265
pycontribs/pyrax
pyrax/utils.py
_join_chars
def _join_chars(chars, length): """ Used by the random character functions. """ mult = int(length / len(chars)) + 1 mult_chars = chars * mult return "".join(random.sample(mult_chars, length))
python
def _join_chars(chars, length): """ Used by the random character functions. """ mult = int(length / len(chars)) + 1 mult_chars = chars * mult return "".join(random.sample(mult_chars, length))
Used by the random character functions.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L268-L274
pycontribs/pyrax
pyrax/utils.py
random_unicode
def random_unicode(length=20): """ Generates a random name; useful for testing. Returns an encoded string of the specified length containing unicode values up to code point 1000. """ def get_char(): return six.unichr(random.randint(32, 1000)) chars = u"".join([get_char() for ii in s...
python
def random_unicode(length=20): """ Generates a random name; useful for testing. Returns an encoded string of the specified length containing unicode values up to code point 1000. """ def get_char(): return six.unichr(random.randint(32, 1000)) chars = u"".join([get_char() for ii in s...
Generates a random name; useful for testing. Returns an encoded string of the specified length containing unicode values up to code point 1000.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L277-L287
pycontribs/pyrax
pyrax/utils.py
coerce_to_list
def coerce_to_list(val): """ For parameters that can take either a single string or a list of strings, this function will ensure that the result is a list containing the passed values. """ if val: if not isinstance(val, (list, tuple)): val = [val] else: val = [] ...
python
def coerce_to_list(val): """ For parameters that can take either a single string or a list of strings, this function will ensure that the result is a list containing the passed values. """ if val: if not isinstance(val, (list, tuple)): val = [val] else: val = [] ...
For parameters that can take either a single string or a list of strings, this function will ensure that the result is a list containing the passed values.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L299-L310
pycontribs/pyrax
pyrax/utils.py
folder_size
def folder_size(pth, ignore=None): """ Returns the total bytes for the specified path, optionally ignoring any files which match the 'ignore' parameter. 'ignore' can either be a single string pattern, or a list of such patterns. """ if not os.path.isdir(pth): raise exc.FolderNotFound ...
python
def folder_size(pth, ignore=None): """ Returns the total bytes for the specified path, optionally ignoring any files which match the 'ignore' parameter. 'ignore' can either be a single string pattern, or a list of such patterns. """ if not os.path.isdir(pth): raise exc.FolderNotFound ...
Returns the total bytes for the specified path, optionally ignoring any files which match the 'ignore' parameter. 'ignore' can either be a single string pattern, or a list of such patterns.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L313-L334
pycontribs/pyrax
pyrax/utils.py
add_method
def add_method(obj, func, name=None): """Adds an instance method to an object.""" if name is None: name = func.__name__ if sys.version_info < (3,): method = types.MethodType(func, obj, obj.__class__) else: method = types.MethodType(func, obj) setattr(obj, name, method)
python
def add_method(obj, func, name=None): """Adds an instance method to an object.""" if name is None: name = func.__name__ if sys.version_info < (3,): method = types.MethodType(func, obj, obj.__class__) else: method = types.MethodType(func, obj) setattr(obj, name, method)
Adds an instance method to an object.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L337-L345
pycontribs/pyrax
pyrax/utils.py
wait_until
def wait_until(obj, att, desired, callback=None, interval=5, attempts=0, verbose=False, verbose_atts=None): """ When changing the state of an object, it will commonly be in a transitional state until the change is complete. This will reload the object every `interval` seconds, and check its `att...
python
def wait_until(obj, att, desired, callback=None, interval=5, attempts=0, verbose=False, verbose_atts=None): """ When changing the state of an object, it will commonly be in a transitional state until the change is complete. This will reload the object every `interval` seconds, and check its `att...
When changing the state of an object, it will commonly be in a transitional state until the change is complete. This will reload the object every `interval` seconds, and check its `att` attribute until the `desired` value is reached, or until the maximum number of attempts is reached. The updated object...
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L373-L423
pycontribs/pyrax
pyrax/utils.py
_wait_until
def _wait_until(obj, att, desired, callback, interval, attempts, verbose, verbose_atts): """ Loops until either the desired value of the attribute is reached, or the number of attempts is exceeded. """ if not isinstance(desired, (list, tuple)): desired = [desired] if verbose_atts...
python
def _wait_until(obj, att, desired, callback, interval, attempts, verbose, verbose_atts): """ Loops until either the desired value of the attribute is reached, or the number of attempts is exceeded. """ if not isinstance(desired, (list, tuple)): desired = [desired] if verbose_atts...
Loops until either the desired value of the attribute is reached, or the number of attempts is exceeded.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L426-L466
pycontribs/pyrax
pyrax/utils.py
wait_for_build
def wait_for_build(obj, att=None, desired=None, callback=None, interval=None, attempts=None, verbose=None, verbose_atts=None): """ Designed to handle the most common use case for wait_until: an object whose 'status' attribute will end up in either 'ACTIVE' or 'ERROR' state. Since builds don't ha...
python
def wait_for_build(obj, att=None, desired=None, callback=None, interval=None, attempts=None, verbose=None, verbose_atts=None): """ Designed to handle the most common use case for wait_until: an object whose 'status' attribute will end up in either 'ACTIVE' or 'ERROR' state. Since builds don't ha...
Designed to handle the most common use case for wait_until: an object whose 'status' attribute will end up in either 'ACTIVE' or 'ERROR' state. Since builds don't happen very quickly, the interval will default to 20 seconds to avoid excess polling.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L470-L484
pycontribs/pyrax
pyrax/utils.py
_parse_datetime_string
def _parse_datetime_string(val): """ Attempts to parse a string representation of a date or datetime value, and returns a datetime if successful. If not, a InvalidDateTimeString exception will be raised. """ dt = None lenval = len(val) fmt = {19: "%Y-%m-%d %H:%M:%S", 10: "%Y-%m-%d"}.get(...
python
def _parse_datetime_string(val): """ Attempts to parse a string representation of a date or datetime value, and returns a datetime if successful. If not, a InvalidDateTimeString exception will be raised. """ dt = None lenval = len(val) fmt = {19: "%Y-%m-%d %H:%M:%S", 10: "%Y-%m-%d"}.get(...
Attempts to parse a string representation of a date or datetime value, and returns a datetime if successful. If not, a InvalidDateTimeString exception will be raised.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L487-L501
pycontribs/pyrax
pyrax/utils.py
iso_time_string
def iso_time_string(val, show_tzinfo=False): """ Takes either a date, datetime or a string, and returns the standard ISO formatted string for that date/time, with any fractional second portion removed. """ if not val: return "" if isinstance(val, six.string_types): dt = _pars...
python
def iso_time_string(val, show_tzinfo=False): """ Takes either a date, datetime or a string, and returns the standard ISO formatted string for that date/time, with any fractional second portion removed. """ if not val: return "" if isinstance(val, six.string_types): dt = _pars...
Takes either a date, datetime or a string, and returns the standard ISO formatted string for that date/time, with any fractional second portion removed.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L504-L528
pycontribs/pyrax
pyrax/utils.py
rfc2822_format
def rfc2822_format(val): """ Takes either a date, a datetime, or a string, and returns a string that represents the value in RFC 2822 format. If a string is passed it is returned unchanged. """ if isinstance(val, six.string_types): return val elif isinstance(val, (datetime.datetime, ...
python
def rfc2822_format(val): """ Takes either a date, a datetime, or a string, and returns a string that represents the value in RFC 2822 format. If a string is passed it is returned unchanged. """ if isinstance(val, six.string_types): return val elif isinstance(val, (datetime.datetime, ...
Takes either a date, a datetime, or a string, and returns a string that represents the value in RFC 2822 format. If a string is passed it is returned unchanged.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L531-L546
pycontribs/pyrax
pyrax/utils.py
to_timestamp
def to_timestamp(val): """ Takes a value that is either a Python date, datetime, or a string representation of a date/datetime value. Returns a standard Unix timestamp corresponding to that value. """ # If we're given a number, give it right back - it's already a timestamp. if isinstance(val...
python
def to_timestamp(val): """ Takes a value that is either a Python date, datetime, or a string representation of a date/datetime value. Returns a standard Unix timestamp corresponding to that value. """ # If we're given a number, give it right back - it's already a timestamp. if isinstance(val...
Takes a value that is either a Python date, datetime, or a string representation of a date/datetime value. Returns a standard Unix timestamp corresponding to that value.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L549-L562
pycontribs/pyrax
pyrax/utils.py
get_id
def get_id(id_or_obj): """ Returns the 'id' attribute of 'id_or_obj' if present; if not, returns 'id_or_obj'. """ if isinstance(id_or_obj, six.string_types + (int,)): # It's an ID return id_or_obj try: return id_or_obj.id except AttributeError: return id_or_ob...
python
def get_id(id_or_obj): """ Returns the 'id' attribute of 'id_or_obj' if present; if not, returns 'id_or_obj'. """ if isinstance(id_or_obj, six.string_types + (int,)): # It's an ID return id_or_obj try: return id_or_obj.id except AttributeError: return id_or_ob...
Returns the 'id' attribute of 'id_or_obj' if present; if not, returns 'id_or_obj'.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L565-L576
pycontribs/pyrax
pyrax/utils.py
get_name
def get_name(name_or_obj): """ Returns the 'name' attribute of 'name_or_obj' if present; if not, returns 'name_or_obj'. """ if isinstance(name_or_obj, six.string_types): # It's a name return name_or_obj try: return name_or_obj.name except AttributeError: raise...
python
def get_name(name_or_obj): """ Returns the 'name' attribute of 'name_or_obj' if present; if not, returns 'name_or_obj'. """ if isinstance(name_or_obj, six.string_types): # It's a name return name_or_obj try: return name_or_obj.name except AttributeError: raise...
Returns the 'name' attribute of 'name_or_obj' if present; if not, returns 'name_or_obj'.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L579-L590
pycontribs/pyrax
pyrax/utils.py
params_to_dict
def params_to_dict(params, dct): """ Updates the 'dct' dictionary with the 'params' dictionary, filtering out all those whose param value is None. """ for param, val in params.items(): if val is None: continue dct[param] = val return dct
python
def params_to_dict(params, dct): """ Updates the 'dct' dictionary with the 'params' dictionary, filtering out all those whose param value is None. """ for param, val in params.items(): if val is None: continue dct[param] = val return dct
Updates the 'dct' dictionary with the 'params' dictionary, filtering out all those whose param value is None.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L593-L602
pycontribs/pyrax
pyrax/utils.py
dict_to_qs
def dict_to_qs(dct): """ Takes a dictionary and uses it to create a query string. """ itms = ["%s=%s" % (key, val) for key, val in list(dct.items()) if val is not None] return "&".join(itms)
python
def dict_to_qs(dct): """ Takes a dictionary and uses it to create a query string. """ itms = ["%s=%s" % (key, val) for key, val in list(dct.items()) if val is not None] return "&".join(itms)
Takes a dictionary and uses it to create a query string.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L605-L611
pycontribs/pyrax
pyrax/utils.py
match_pattern
def match_pattern(nm, patterns): """ Compares `nm` with the supplied patterns, and returns True if it matches at least one. Patterns are standard file-name wildcard strings, as defined in the `fnmatch` module. For example, the pattern "*.py" will match the names of all Python scripts. """ ...
python
def match_pattern(nm, patterns): """ Compares `nm` with the supplied patterns, and returns True if it matches at least one. Patterns are standard file-name wildcard strings, as defined in the `fnmatch` module. For example, the pattern "*.py" will match the names of all Python scripts. """ ...
Compares `nm` with the supplied patterns, and returns True if it matches at least one. Patterns are standard file-name wildcard strings, as defined in the `fnmatch` module. For example, the pattern "*.py" will match the names of all Python scripts.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L614-L627
pycontribs/pyrax
pyrax/utils.py
update_exc
def update_exc(exc, msg, before=True, separator="\n"): """ Adds additional text to an exception's error message. The new text will be added before the existing text by default; to append it after the original text, pass False to the `before` parameter. By default the old and new text will be separ...
python
def update_exc(exc, msg, before=True, separator="\n"): """ Adds additional text to an exception's error message. The new text will be added before the existing text by default; to append it after the original text, pass False to the `before` parameter. By default the old and new text will be separ...
Adds additional text to an exception's error message. The new text will be added before the existing text by default; to append it after the original text, pass False to the `before` parameter. By default the old and new text will be separated by a newline. If you wish to use a different separator, pa...
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L630-L649
pycontribs/pyrax
pyrax/utils.py
case_insensitive_update
def case_insensitive_update(dct1, dct2): """ Given two dicts, updates the first one with the second, but considers keys that are identical except for case to be the same. No return value; this function modified dct1 similar to the update() method. """ lowkeys = dict([(key.lower(), key) for key ...
python
def case_insensitive_update(dct1, dct2): """ Given two dicts, updates the first one with the second, but considers keys that are identical except for case to be the same. No return value; this function modified dct1 similar to the update() method. """ lowkeys = dict([(key.lower(), key) for key ...
Given two dicts, updates the first one with the second, but considers keys that are identical except for case to be the same. No return value; this function modified dct1 similar to the update() method.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L652-L662
pycontribs/pyrax
pyrax/utils.py
env
def env(*args, **kwargs): """ Returns the first environment variable set if none are non-empty, defaults to "" or keyword arg default """ for arg in args: value = os.environ.get(arg, None) if value: return value return kwargs.get("default", "")
python
def env(*args, **kwargs): """ Returns the first environment variable set if none are non-empty, defaults to "" or keyword arg default """ for arg in args: value = os.environ.get(arg, None) if value: return value return kwargs.get("default", "")
Returns the first environment variable set if none are non-empty, defaults to "" or keyword arg default
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L665-L674
pycontribs/pyrax
pyrax/utils.py
import_class
def import_class(import_str): """Returns a class from a string including module and class.""" mod_str, _sep, class_str = import_str.rpartition(".") __import__(mod_str) return getattr(sys.modules[mod_str], class_str)
python
def import_class(import_str): """Returns a class from a string including module and class.""" mod_str, _sep, class_str = import_str.rpartition(".") __import__(mod_str) return getattr(sys.modules[mod_str], class_str)
Returns a class from a string including module and class.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L708-L712
pycontribs/pyrax
pyrax/utils.py
safe_decode
def safe_decode(text, incoming=None, errors='strict'): """Decodes incoming text/bytes string using `incoming` if they're not already unicode. This function was copied from novaclient.openstack.strutils :param incoming: Text's current encoding :param errors: Errors handling policy. See here for ...
python
def safe_decode(text, incoming=None, errors='strict'): """Decodes incoming text/bytes string using `incoming` if they're not already unicode. This function was copied from novaclient.openstack.strutils :param incoming: Text's current encoding :param errors: Errors handling policy. See here for ...
Decodes incoming text/bytes string using `incoming` if they're not already unicode. This function was copied from novaclient.openstack.strutils :param incoming: Text's current encoding :param errors: Errors handling policy. See here for valid values http://docs.python.org/2/library/codecs.h...
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L715-L753
pycontribs/pyrax
pyrax/utils.py
to_slug
def to_slug(value, incoming=None, errors="strict"): """Normalize string. Convert to lowercase, remove non-word characters, and convert spaces to hyphens. This function was copied from novaclient.openstack.strutils Inspired by Django's `slugify` filter. :param value: Text to slugify :para...
python
def to_slug(value, incoming=None, errors="strict"): """Normalize string. Convert to lowercase, remove non-word characters, and convert spaces to hyphens. This function was copied from novaclient.openstack.strutils Inspired by Django's `slugify` filter. :param value: Text to slugify :para...
Normalize string. Convert to lowercase, remove non-word characters, and convert spaces to hyphens. This function was copied from novaclient.openstack.strutils Inspired by Django's `slugify` filter. :param value: Text to slugify :param incoming: Text's current encoding :param errors: Erro...
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L756-L780
pycontribs/pyrax
pyrax/utils.py
ResultsIterator.next
def next(self): """ Return the next available item. If there are no more items in the local 'results' list, check if there is a 'next_uri' value. If so, use that to get the next page of results from the API, and return the first item from that query. """ try: ...
python
def next(self): """ Return the next available item. If there are no more items in the local 'results' list, check if there is a 'next_uri' value. If so, use that to get the next page of results from the API, and return the first item from that query. """ try: ...
Return the next available item. If there are no more items in the local 'results' list, check if there is a 'next_uri' value. If so, use that to get the next page of results from the API, and return the first item from that query.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L194-L220
pycontribs/pyrax
pyrax/utils.py
_WaitThread.run
def run(self): """Starts the thread.""" resp = _wait_until(obj=self.obj, att=self.att, desired=self.desired, callback=None, interval=self.interval, attempts=self.attempts, verbose=False, verbose_atts=None) self.callback(resp)
python
def run(self): """Starts the thread.""" resp = _wait_until(obj=self.obj, att=self.att, desired=self.desired, callback=None, interval=self.interval, attempts=self.attempts, verbose=False, verbose_atts=None) self.callback(resp)
Starts the thread.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L364-L370
pycontribs/pyrax
pyrax/cloudblockstorage.py
assure_volume
def assure_volume(fnc): """ Converts a volumeID passed as the volume to a CloudBlockStorageVolume object. """ @wraps(fnc) def _wrapped(self, volume, *args, **kwargs): if not isinstance(volume, CloudBlockStorageVolume): # Must be the ID volume = self._manager.get(volum...
python
def assure_volume(fnc): """ Converts a volumeID passed as the volume to a CloudBlockStorageVolume object. """ @wraps(fnc) def _wrapped(self, volume, *args, **kwargs): if not isinstance(volume, CloudBlockStorageVolume): # Must be the ID volume = self._manager.get(volum...
Converts a volumeID passed as the volume to a CloudBlockStorageVolume object.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L46-L56
pycontribs/pyrax
pyrax/cloudblockstorage.py
assure_snapshot
def assure_snapshot(fnc): """ Converts a snapshot ID passed as the snapshot to a CloudBlockStorageSnapshot object. """ @wraps(fnc) def _wrapped(self, snapshot, *args, **kwargs): if not isinstance(snapshot, CloudBlockStorageSnapshot): # Must be the ID snapshot = se...
python
def assure_snapshot(fnc): """ Converts a snapshot ID passed as the snapshot to a CloudBlockStorageSnapshot object. """ @wraps(fnc) def _wrapped(self, snapshot, *args, **kwargs): if not isinstance(snapshot, CloudBlockStorageSnapshot): # Must be the ID snapshot = se...
Converts a snapshot ID passed as the snapshot to a CloudBlockStorageSnapshot object.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L59-L70
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageSnapshot.delete
def delete(self): """ Adds a check to make sure that the snapshot is able to be deleted. """ if self.status not in ("available", "error"): raise exc.SnapshotNotAvailable("Snapshot must be in 'available' " "or 'error' status before deleting. Current status:...
python
def delete(self): """ Adds a check to make sure that the snapshot is able to be deleted. """ if self.status not in ("available", "error"): raise exc.SnapshotNotAvailable("Snapshot must be in 'available' " "or 'error' status before deleting. Current status:...
Adds a check to make sure that the snapshot is able to be deleted.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L78-L95
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageSnapshot.update
def update(self, display_name=None, display_description=None): """ Update the specified values on this snapshot. You may specify one or more values to update. If no values are specified as non-None, the call is a no-op; no exception will be raised. """ return self.manager...
python
def update(self, display_name=None, display_description=None): """ Update the specified values on this snapshot. You may specify one or more values to update. If no values are specified as non-None, the call is a no-op; no exception will be raised. """ return self.manager...
Update the specified values on this snapshot. You may specify one or more values to update. If no values are specified as non-None, the call is a no-op; no exception will be raised.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L98-L105
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageVolume.attach_to_instance
def attach_to_instance(self, instance, mountpoint): """ Attaches this volume to the cloud server instance at the specified mountpoint. This requires a call to the cloud servers API; it cannot be done directly. """ instance_id = _resolve_id(instance) try: ...
python
def attach_to_instance(self, instance, mountpoint): """ Attaches this volume to the cloud server instance at the specified mountpoint. This requires a call to the cloud servers API; it cannot be done directly. """ instance_id = _resolve_id(instance) try: ...
Attaches this volume to the cloud server instance at the specified mountpoint. This requires a call to the cloud servers API; it cannot be done directly.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L153-L164
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageVolume.detach
def detach(self): """ Detaches this volume from any device it may be attached to. If it is not attached, nothing happens. """ attachments = self.attachments if not attachments: # Not attached; no error needed, just return return # A volume ...
python
def detach(self): """ Detaches this volume from any device it may be attached to. If it is not attached, nothing happens. """ attachments = self.attachments if not attachments: # Not attached; no error needed, just return return # A volume ...
Detaches this volume from any device it may be attached to. If it is not attached, nothing happens.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L167-L184
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageVolume.delete
def delete(self, force=False): """ Volumes cannot be deleted if either a) they are attached to a device, or b) they have any snapshots. This method overrides the base delete() method to both better handle these failures, and also to offer a 'force' option. When 'force' is True, t...
python
def delete(self, force=False): """ Volumes cannot be deleted if either a) they are attached to a device, or b) they have any snapshots. This method overrides the base delete() method to both better handle these failures, and also to offer a 'force' option. When 'force' is True, t...
Volumes cannot be deleted if either a) they are attached to a device, or b) they have any snapshots. This method overrides the base delete() method to both better handle these failures, and also to offer a 'force' option. When 'force' is True, the volume is detached, and any dependent sn...
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L187-L203
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageVolume.create_snapshot
def create_snapshot(self, name=None, description=None, force=False): """ Creates a snapshot of this volume, with an optional name and description. Normally snapshots will not happen if the volume is attached. To override this default behavior, pass force=True. """ ...
python
def create_snapshot(self, name=None, description=None, force=False): """ Creates a snapshot of this volume, with an optional name and description. Normally snapshots will not happen if the volume is attached. To override this default behavior, pass force=True. """ ...
Creates a snapshot of this volume, with an optional name and description. Normally snapshots will not happen if the volume is attached. To override this default behavior, pass force=True.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L223-L237
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageVolume.list_snapshots
def list_snapshots(self): """ Returns a list of all snapshots of this volume. """ return [snap for snap in self.manager.list_snapshots() if snap.volume_id == self.id]
python
def list_snapshots(self): """ Returns a list of all snapshots of this volume. """ return [snap for snap in self.manager.list_snapshots() if snap.volume_id == self.id]
Returns a list of all snapshots of this volume.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L240-L245
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageManager._create_body
def _create_body(self, name, size=None, volume_type=None, description=None, metadata=None, snapshot_id=None, clone_id=None, availability_zone=None, image=None): """ Used to create the dict required to create a new volume """ if not isinstance(size, six.integer_t...
python
def _create_body(self, name, size=None, volume_type=None, description=None, metadata=None, snapshot_id=None, clone_id=None, availability_zone=None, image=None): """ Used to create the dict required to create a new volume """ if not isinstance(size, six.integer_t...
Used to create the dict required to create a new volume
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L279-L307
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageManager.create
def create(self, *args, **kwargs): """ Catches errors that may be returned, and raises more informational exceptions. """ try: return super(CloudBlockStorageManager, self).create(*args, **kwargs) except exc.BadRequest as e: msg ...
python
def create(self, *args, **kwargs): """ Catches errors that may be returned, and raises more informational exceptions. """ try: return super(CloudBlockStorageManager, self).create(*args, **kwargs) except exc.BadRequest as e: msg ...
Catches errors that may be returned, and raises more informational exceptions.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L310-L323
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageManager.update
def update(self, volume, display_name=None, display_description=None): """ Update the specified values on the specified volume. You may specify one or more values to update. If no values are specified as non-None, the call is a no-op; no exception will be raised. """ uri ...
python
def update(self, volume, display_name=None, display_description=None): """ Update the specified values on the specified volume. You may specify one or more values to update. If no values are specified as non-None, the call is a no-op; no exception will be raised. """ uri ...
Update the specified values on the specified volume. You may specify one or more values to update. If no values are specified as non-None, the call is a no-op; no exception will be raised.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L326-L342
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageManager.create_snapshot
def create_snapshot(self, volume, name, description=None, force=False): """ Pass-through method to allow the create_snapshot() call to be made directly on a volume. """ return self.api.create_snapshot(volume, name, description=description, force=force)
python
def create_snapshot(self, volume, name, description=None, force=False): """ Pass-through method to allow the create_snapshot() call to be made directly on a volume. """ return self.api.create_snapshot(volume, name, description=description, force=force)
Pass-through method to allow the create_snapshot() call to be made directly on a volume.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L353-L359
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageSnapshotManager._create_body
def _create_body(self, name, description=None, volume=None, force=False): """ Used to create the dict required to create a new snapshot """ body = {"snapshot": { "display_name": name, "display_description": description, "volume_id": volume....
python
def _create_body(self, name, description=None, volume=None, force=False): """ Used to create the dict required to create a new snapshot """ body = {"snapshot": { "display_name": name, "display_description": description, "volume_id": volume....
Used to create the dict required to create a new snapshot
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L367-L377
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageSnapshotManager.create
def create(self, name, volume, description=None, force=False): """ Adds exception handling to the default create() call. """ try: snap = super(CloudBlockStorageSnapshotManager, self).create( name=name, volume=volume, description=description, ...
python
def create(self, name, volume, description=None, force=False): """ Adds exception handling to the default create() call. """ try: snap = super(CloudBlockStorageSnapshotManager, self).create( name=name, volume=volume, description=description, ...
Adds exception handling to the default create() call.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L380-L410
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageClient._configure_manager
def _configure_manager(self): """ Create the manager to handle the instances, and also another to handle flavors. """ self._manager = CloudBlockStorageManager(self, resource_class=CloudBlockStorageVolume, response_key="volume", uri_base="volumes") ...
python
def _configure_manager(self): """ Create the manager to handle the instances, and also another to handle flavors. """ self._manager = CloudBlockStorageManager(self, resource_class=CloudBlockStorageVolume, response_key="volume", uri_base="volumes") ...
Create the manager to handle the instances, and also another to handle flavors.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L438-L451
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageClient.update
def update(self, volume, display_name=None, display_description=None): """ Update the specified values on the specified volume. You may specify one or more values to update. If no values are specified as non-None, the call is a no-op; no exception will be raised. """ retu...
python
def update(self, volume, display_name=None, display_description=None): """ Update the specified values on the specified volume. You may specify one or more values to update. If no values are specified as non-None, the call is a no-op; no exception will be raised. """ retu...
Update the specified values on the specified volume. You may specify one or more values to update. If no values are specified as non-None, the call is a no-op; no exception will be raised.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L483-L490
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageClient.create_snapshot
def create_snapshot(self, volume, name=None, description=None, force=False): """ Creates a snapshot of the volume, with an optional name and description. Normally snapshots will not happen if the volume is attached. To override this default behavior, pass force=True. """ ...
python
def create_snapshot(self, volume, name=None, description=None, force=False): """ Creates a snapshot of the volume, with an optional name and description. Normally snapshots will not happen if the volume is attached. To override this default behavior, pass force=True. """ ...
Creates a snapshot of the volume, with an optional name and description. Normally snapshots will not happen if the volume is attached. To override this default behavior, pass force=True.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L501-L509
pycontribs/pyrax
pyrax/cloudblockstorage.py
CloudBlockStorageClient.update_snapshot
def update_snapshot(self, snapshot, display_name=None, display_description=None): """ Update the specified values on the specified snapshot. You may specify one or more values to update. """ return snapshot.update(display_name=display_name, display_des...
python
def update_snapshot(self, snapshot, display_name=None, display_description=None): """ Update the specified values on the specified snapshot. You may specify one or more values to update. """ return snapshot.update(display_name=display_name, display_des...
Update the specified values on the specified snapshot. You may specify one or more values to update.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudblockstorage.py#L526-L533
pycontribs/pyrax
pyrax/cloudmonitoring.py
assure_check
def assure_check(fnc): """ Converts an checkID passed as the check to a CloudMonitorCheck object. """ @wraps(fnc) def _wrapped(self, check, *args, **kwargs): if not isinstance(check, CloudMonitorCheck): # Must be the ID check = self._check_manager.get(check) r...
python
def assure_check(fnc): """ Converts an checkID passed as the check to a CloudMonitorCheck object. """ @wraps(fnc) def _wrapped(self, check, *args, **kwargs): if not isinstance(check, CloudMonitorCheck): # Must be the ID check = self._check_manager.get(check) r...
Converts an checkID passed as the check to a CloudMonitorCheck object.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L42-L52
pycontribs/pyrax
pyrax/cloudmonitoring.py
assure_entity
def assure_entity(fnc): """ Converts an entityID passed as the entity to a CloudMonitorEntity object. """ @wraps(fnc) def _wrapped(self, entity, *args, **kwargs): if not isinstance(entity, CloudMonitorEntity): # Must be the ID entity = self._entity_manager.get(entity)...
python
def assure_entity(fnc): """ Converts an entityID passed as the entity to a CloudMonitorEntity object. """ @wraps(fnc) def _wrapped(self, entity, *args, **kwargs): if not isinstance(entity, CloudMonitorEntity): # Must be the ID entity = self._entity_manager.get(entity)...
Converts an entityID passed as the entity to a CloudMonitorEntity object.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L55-L65
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorEntity.update
def update(self, agent=None, metadata=None): """ Only the agent_id and metadata are able to be updated via the API. """ self.manager.update_entity(self, agent=agent, metadata=metadata)
python
def update(self, agent=None, metadata=None): """ Only the agent_id and metadata are able to be updated via the API. """ self.manager.update_entity(self, agent=agent, metadata=metadata)
Only the agent_id and metadata are able to be updated via the API.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L82-L86
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorEntity.get_check
def get_check(self, check): """ Returns an instance of the specified check. """ chk = self._check_manager.get(check) chk.set_entity(self) return chk
python
def get_check(self, check): """ Returns an instance of the specified check. """ chk = self._check_manager.get(check) chk.set_entity(self) return chk
Returns an instance of the specified check.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L89-L95
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorEntity.list_checks
def list_checks(self, limit=None, marker=None, return_next=False): """ Returns a list of the checks defined for this account. By default the number returned is limited to 100; you can define the number to return by optionally passing a value for the 'limit' parameter. The value for ...
python
def list_checks(self, limit=None, marker=None, return_next=False): """ Returns a list of the checks defined for this account. By default the number returned is limited to 100; you can define the number to return by optionally passing a value for the 'limit' parameter. The value for ...
Returns a list of the checks defined for this account. By default the number returned is limited to 100; you can define the number to return by optionally passing a value for the 'limit' parameter. The value for limit must be at least 1, and can be up to 1000. For pagination, you must a...
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L98-L115
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorEntity.find_all_checks
def find_all_checks(self, **kwargs): """ Finds all checks for this entity with attributes matching ``**kwargs``. This isn't very efficient: it loads the entire list then filters on the Python side. """ checks = self._check_manager.find_all_checks(**kwargs) for ch...
python
def find_all_checks(self, **kwargs): """ Finds all checks for this entity with attributes matching ``**kwargs``. This isn't very efficient: it loads the entire list then filters on the Python side. """ checks = self._check_manager.find_all_checks(**kwargs) for ch...
Finds all checks for this entity with attributes matching ``**kwargs``. This isn't very efficient: it loads the entire list then filters on the Python side.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L118-L128
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorEntity.create_check
def create_check(self, label=None, name=None, check_type=None, disabled=False, metadata=None, details=None, monitoring_zones_poll=None, timeout=None, period=None, target_alias=None, target_hostname=None, target_receiver=None, test_only=False, include_debug=False): ...
python
def create_check(self, label=None, name=None, check_type=None, disabled=False, metadata=None, details=None, monitoring_zones_poll=None, timeout=None, period=None, target_alias=None, target_hostname=None, target_receiver=None, test_only=False, include_debug=False): ...
Creates a check on this entity with the specified attributes. The 'details' parameter should be a dict with the keys as the option name, and the value as the desired setting.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L131-L147
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorEntity.create_alarm
def create_alarm(self, check, notification_plan, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Creates an alarm that binds the check on this entity with a notification plan. """ return self._alarm_manager.create(check, notification_plan, ...
python
def create_alarm(self, check, notification_plan, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Creates an alarm that binds the check on this entity with a notification plan. """ return self._alarm_manager.create(check, notification_plan, ...
Creates an alarm that binds the check on this entity with a notification plan.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L213-L221
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorEntity.update_alarm
def update_alarm(self, alarm, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Updates an existing alarm on this entity. """ return self._alarm_manager.update(alarm, criteria=criteria, disabled=disabled, label=label, name=name, metadat...
python
def update_alarm(self, alarm, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Updates an existing alarm on this entity. """ return self._alarm_manager.update(alarm, criteria=criteria, disabled=disabled, label=label, name=name, metadat...
Updates an existing alarm on this entity.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L224-L230
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorEntity.list_alarms
def list_alarms(self, limit=None, marker=None, return_next=False): """ Returns a list of all the alarms created on this entity. """ return self._alarm_manager.list(limit=limit, marker=marker, return_next=return_next)
python
def list_alarms(self, limit=None, marker=None, return_next=False): """ Returns a list of all the alarms created on this entity. """ return self._alarm_manager.list(limit=limit, marker=marker, return_next=return_next)
Returns a list of all the alarms created on this entity.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L233-L238
pycontribs/pyrax
pyrax/cloudmonitoring.py
_PaginationManager.list
def list(self, limit=None, marker=None, return_next=False): """ This is necessary to handle pagination correctly, as the Monitoring service defines 'marker' differently than most other services. For monitoring, 'marker' represents the first item in the next page, whereas other se...
python
def list(self, limit=None, marker=None, return_next=False): """ This is necessary to handle pagination correctly, as the Monitoring service defines 'marker' differently than most other services. For monitoring, 'marker' represents the first item in the next page, whereas other se...
This is necessary to handle pagination correctly, as the Monitoring service defines 'marker' differently than most other services. For monitoring, 'marker' represents the first item in the next page, whereas other services define it as the ID of the last item in the current page.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L264-L281
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorNotificationManager.create
def create(self, notification_type, label=None, name=None, details=None): """ Defines a notification for handling an alarm. """ uri = "/%s" % self.uri_base body = {"label": label or name, "type": utils.get_id(notification_type), "details": details,...
python
def create(self, notification_type, label=None, name=None, details=None): """ Defines a notification for handling an alarm. """ uri = "/%s" % self.uri_base body = {"label": label or name, "type": utils.get_id(notification_type), "details": details,...
Defines a notification for handling an alarm.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L289-L299
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorNotificationManager.update_notification
def update_notification(self, notification, details): """ Updates the specified notification with the supplied details. """ if isinstance(notification, CloudMonitorNotification): nid = notification.id ntyp = notification.type else: # Supplied a...
python
def update_notification(self, notification, details): """ Updates the specified notification with the supplied details. """ if isinstance(notification, CloudMonitorNotification): nid = notification.id ntyp = notification.type else: # Supplied a...
Updates the specified notification with the supplied details.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L327-L342
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorNotificationManager.list_types
def list_types(self): """ Returns a list of all available notification types. """ uri = "/notification_types" resp, resp_body = self.api.method_get(uri) return [CloudMonitorNotificationType(self, info) for info in resp_body["values"]]
python
def list_types(self): """ Returns a list of all available notification types. """ uri = "/notification_types" resp, resp_body = self.api.method_get(uri) return [CloudMonitorNotificationType(self, info) for info in resp_body["values"]]
Returns a list of all available notification types.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L345-L352
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorNotificationManager.get_type
def get_type(self, notification_type_id): """ Returns a CloudMonitorNotificationType object for the given ID. """ uri = "/notification_types/%s" % utils.get_id(notification_type_id) resp, resp_body = self.api.method_get(uri) return CloudMonitorNotificationType(self, resp_...
python
def get_type(self, notification_type_id): """ Returns a CloudMonitorNotificationType object for the given ID. """ uri = "/notification_types/%s" % utils.get_id(notification_type_id) resp, resp_body = self.api.method_get(uri) return CloudMonitorNotificationType(self, resp_...
Returns a CloudMonitorNotificationType object for the given ID.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L355-L361
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorNotificationPlanManager.create
def create(self, label=None, name=None, critical_state=None, ok_state=None, warning_state=None): """ Creates a notification plan to be executed when a monitoring check triggers an alarm. You can optionally label (or name) the plan. A plan consists of one or more notification...
python
def create(self, label=None, name=None, critical_state=None, ok_state=None, warning_state=None): """ Creates a notification plan to be executed when a monitoring check triggers an alarm. You can optionally label (or name) the plan. A plan consists of one or more notification...
Creates a notification plan to be executed when a monitoring check triggers an alarm. You can optionally label (or name) the plan. A plan consists of one or more notifications to be executed when an associated alarm is triggered. You can have different lists of actions for CRITICAL, WAR...
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L369-L396
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorMetricsManager.get_metric_data_points
def get_metric_data_points(self, metric, start, end, points=None, resolution=None, stats=None): """ Returns the data points for a given metric for the given period. The 'start' and 'end' times must be specified; they can be be either Python date/datetime values, or a Unix tim...
python
def get_metric_data_points(self, metric, start, end, points=None, resolution=None, stats=None): """ Returns the data points for a given metric for the given period. The 'start' and 'end' times must be specified; they can be be either Python date/datetime values, or a Unix tim...
Returns the data points for a given metric for the given period. The 'start' and 'end' times must be specified; they can be be either Python date/datetime values, or a Unix timestamp. The 'points' parameter represents the number of points to return. The 'resolution' parameter represents...
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L401-L472
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorAlarmManager.create
def create(self, check, notification_plan, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Creates an alarm that binds the check on the given entity with a notification plan. Note that the 'criteria' parameter, if supplied, should be a string ...
python
def create(self, check, notification_plan, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Creates an alarm that binds the check on the given entity with a notification plan. Note that the 'criteria' parameter, if supplied, should be a string ...
Creates an alarm that binds the check on the given entity with a notification plan. Note that the 'criteria' parameter, if supplied, should be a string representing the DSL for describing alerting conditions and their output states. Pyrax does not do any validation of these criteria ...
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L489-L518
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorAlarmManager.update
def update(self, alarm, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Updates an existing alarm. See the comments on the 'create()' method regarding the criteria parameter. """ uri = "/%s/%s" % (self.uri_base, utils.get_id(alarm)) b...
python
def update(self, alarm, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Updates an existing alarm. See the comments on the 'create()' method regarding the criteria parameter. """ uri = "/%s/%s" % (self.uri_base, utils.get_id(alarm)) b...
Updates an existing alarm. See the comments on the 'create()' method regarding the criteria parameter.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L521-L538
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorCheckManager.create_check
def create_check(self, label=None, name=None, check_type=None, details=None, disabled=False, metadata=None, monitoring_zones_poll=None, timeout=None, period=None, target_alias=None, target_hostname=None, target_receiver=None, test_only=False, include_debug=False): ...
python
def create_check(self, label=None, name=None, check_type=None, details=None, disabled=False, metadata=None, monitoring_zones_poll=None, timeout=None, period=None, target_alias=None, target_hostname=None, target_receiver=None, test_only=False, include_debug=False): ...
Creates a check on the entity with the specified attributes. The 'details' parameter should be a dict with the keys as the option name, and the value as the desired setting. If the 'test_only' parameter is True, then the check is not created; instead, the check is run and the results of...
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L546-L626
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorCheckManager.find_all_checks
def find_all_checks(self, **kwargs): """ Finds all checks for a given entity with attributes matching ``**kwargs``. This isn't very efficient: it loads the entire list then filters on the Python side. """ found = [] searches = kwargs.items() for o...
python
def find_all_checks(self, **kwargs): """ Finds all checks for a given entity with attributes matching ``**kwargs``. This isn't very efficient: it loads the entire list then filters on the Python side. """ found = [] searches = kwargs.items() for o...
Finds all checks for a given entity with attributes matching ``**kwargs``. This isn't very efficient: it loads the entire list then filters on the Python side.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L660-L677
pycontribs/pyrax
pyrax/cloudmonitoring.py
_EntityFilteringManger.list
def list(self, entity=None): """ Returns a dictionary of data, optionally filtered for a given entity. """ uri = "/%s" % self.uri_base if entity: uri = "%s?entityId=%s" % (uri, utils.get_id(entity)) resp, resp_body = self._list(uri, return_raw=True) re...
python
def list(self, entity=None): """ Returns a dictionary of data, optionally filtered for a given entity. """ uri = "/%s" % self.uri_base if entity: uri = "%s?entityId=%s" % (uri, utils.get_id(entity)) resp, resp_body = self._list(uri, return_raw=True) re...
Returns a dictionary of data, optionally filtered for a given entity.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L685-L693
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorEntityManager._create_body
def _create_body(self, name, label=None, agent=None, ip_addresses=None, metadata=None): """ Used to create the dict required to create various resources. Accepts either 'label' or 'name' as the keyword parameter for the label attribute for entities. """ label ...
python
def _create_body(self, name, label=None, agent=None, ip_addresses=None, metadata=None): """ Used to create the dict required to create various resources. Accepts either 'label' or 'name' as the keyword parameter for the label attribute for entities. """ label ...
Used to create the dict required to create various resources. Accepts either 'label' or 'name' as the keyword parameter for the label attribute for entities.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L701-L717
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorEntityManager.update_entity
def update_entity(self, entity, agent=None, metadata=None): """ Updates the specified entity's values with the supplied parameters. """ body = {} if agent: body["agent_id"] = utils.get_id(agent) if metadata: body["metadata"] = metadata if b...
python
def update_entity(self, entity, agent=None, metadata=None): """ Updates the specified entity's values with the supplied parameters. """ body = {} if agent: body["agent_id"] = utils.get_id(agent) if metadata: body["metadata"] = metadata if b...
Updates the specified entity's values with the supplied parameters.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L720-L731
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorCheck.get
def get(self): """Reloads the check with its current values.""" new = self.manager.get(self) if new: self._add_details(new._info)
python
def get(self): """Reloads the check with its current values.""" new = self.manager.get(self) if new: self._add_details(new._info)
Reloads the check with its current values.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L789-L793
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorCheck.update
def update(self, label=None, name=None, disabled=None, metadata=None, monitoring_zones_poll=None, timeout=None, period=None, target_alias=None, target_hostname=None, target_receiver=None): """ Updates an existing check with any of the parameters. """ self.manager....
python
def update(self, label=None, name=None, disabled=None, metadata=None, monitoring_zones_poll=None, timeout=None, period=None, target_alias=None, target_hostname=None, target_receiver=None): """ Updates an existing check with any of the parameters. """ self.manager....
Updates an existing check with any of the parameters.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L798-L809
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorCheck.list_metrics
def list_metrics(self, limit=None, marker=None, return_next=False): """ Returns a list of all the metrics associated with this check. """ return self._metrics_manager.list(limit=limit, marker=marker, return_next=return_next)
python
def list_metrics(self, limit=None, marker=None, return_next=False): """ Returns a list of all the metrics associated with this check. """ return self._metrics_manager.list(limit=limit, marker=marker, return_next=return_next)
Returns a list of all the metrics associated with this check.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L817-L822
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorCheck.get_metric_data_points
def get_metric_data_points(self, metric, start, end, points=None, resolution=None, stats=None): """ Returns the data points for a given metric for the given period. The 'start' and 'end' times must be specified; they can be be either Python date/datetime values, or a Unix tim...
python
def get_metric_data_points(self, metric, start, end, points=None, resolution=None, stats=None): """ Returns the data points for a given metric for the given period. The 'start' and 'end' times must be specified; they can be be either Python date/datetime values, or a Unix tim...
Returns the data points for a given metric for the given period. The 'start' and 'end' times must be specified; they can be be either Python date/datetime values, or a Unix timestamp. The 'points' parameter represents the number of points to return. The 'resolution' parameter represents...
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L825-L853
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorCheck.create_alarm
def create_alarm(self, notification_plan, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Creates an alarm that binds this check with a notification plan. """ return self.manager.create_alarm(self.entity, self, notification_plan, crit...
python
def create_alarm(self, notification_plan, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Creates an alarm that binds this check with a notification plan. """ return self.manager.create_alarm(self.entity, self, notification_plan, crit...
Creates an alarm that binds this check with a notification plan.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L856-L863
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorAlarm.get
def get(self): """ Fetches the current state of the alarm from the API and updates the object. """ new_alarm = self.entity.get_alarm(self) if new_alarm: self._add_details(new_alarm._info)
python
def get(self): """ Fetches the current state of the alarm from the API and updates the object. """ new_alarm = self.entity.get_alarm(self) if new_alarm: self._add_details(new_alarm._info)
Fetches the current state of the alarm from the API and updates the object.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L978-L985
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorClient._configure_manager
def _configure_manager(self): """ Creates the Manager instances to handle monitoring. """ self._entity_manager = CloudMonitorEntityManager(self, uri_base="entities", resource_class=CloudMonitorEntity, response_key=None, plural_response_key=None) se...
python
def _configure_manager(self): """ Creates the Manager instances to handle monitoring. """ self._entity_manager = CloudMonitorEntityManager(self, uri_base="entities", resource_class=CloudMonitorEntity, response_key=None, plural_response_key=None) se...
Creates the Manager instances to handle monitoring.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L1017-L1044
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorClient.update_entity
def update_entity(self, entity, agent=None, metadata=None): """ Only the agent_id and metadata are able to be updated via the API. """ self._entity_manager.update_entity(entity, agent=agent, metadata=metadata)
python
def update_entity(self, entity, agent=None, metadata=None): """ Only the agent_id and metadata are able to be updated via the API. """ self._entity_manager.update_entity(entity, agent=agent, metadata=metadata)
Only the agent_id and metadata are able to be updated via the API.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L1093-L1098
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorClient.update_check
def update_check(self, entity, check, label=None, name=None, disabled=None, metadata=None, monitoring_zones_poll=None, timeout=None, period=None, target_alias=None, target_hostname=None, target_receiver=None): """ Updates an existing check with any of the parameters. ...
python
def update_check(self, entity, check, label=None, name=None, disabled=None, metadata=None, monitoring_zones_poll=None, timeout=None, period=None, target_alias=None, target_hostname=None, target_receiver=None): """ Updates an existing check with any of the parameters. ...
Updates an existing check with any of the parameters.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L1160-L1171
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorClient.list_metrics
def list_metrics(self, entity, check, limit=None, marker=None, return_next=False): """ Returns a list of all the metrics associated with the specified check. """ return entity.list_metrics(check, limit=limit, marker=marker, return_next=return_next)
python
def list_metrics(self, entity, check, limit=None, marker=None, return_next=False): """ Returns a list of all the metrics associated with the specified check. """ return entity.list_metrics(check, limit=limit, marker=marker, return_next=return_next)
Returns a list of all the metrics associated with the specified check.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L1183-L1189
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorClient.create_notification
def create_notification(self, notification_type, label=None, name=None, details=None): """ Defines a notification for handling an alarm. """ return self._notification_manager.create(notification_type, label=label, name=name, details=details)
python
def create_notification(self, notification_type, label=None, name=None, details=None): """ Defines a notification for handling an alarm. """ return self._notification_manager.create(notification_type, label=label, name=name, details=details)
Defines a notification for handling an alarm.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L1255-L1261
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorClient.create_notification_plan
def create_notification_plan(self, label=None, name=None, critical_state=None, ok_state=None, warning_state=None): """ Creates a notification plan to be executed when a monitoring check triggers an alarm. """ return self._notification_plan_manager.create(label=label, ...
python
def create_notification_plan(self, label=None, name=None, critical_state=None, ok_state=None, warning_state=None): """ Creates a notification plan to be executed when a monitoring check triggers an alarm. """ return self._notification_plan_manager.create(label=label, ...
Creates a notification plan to be executed when a monitoring check triggers an alarm.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L1279-L1287
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorClient.update_alarm
def update_alarm(self, entity, alarm, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Updates an existing alarm on the given entity. """ return entity.update_alarm(alarm, criteria=criteria, disabled=disabled, label=label, name=name, metad...
python
def update_alarm(self, entity, alarm, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Updates an existing alarm on the given entity. """ return entity.update_alarm(alarm, criteria=criteria, disabled=disabled, label=label, name=name, metad...
Updates an existing alarm on the given entity.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L1321-L1327
pycontribs/pyrax
pyrax/cloudmonitoring.py
CloudMonitorClient.list_alarms
def list_alarms(self, entity, limit=None, marker=None, return_next=False): """ Returns a list of all the alarms created on the specified entity. """ return entity.list_alarms(limit=limit, marker=marker, return_next=return_next)
python
def list_alarms(self, entity, limit=None, marker=None, return_next=False): """ Returns a list of all the alarms created on the specified entity. """ return entity.list_alarms(limit=limit, marker=marker, return_next=return_next)
Returns a list of all the alarms created on the specified entity.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L1331-L1336
pycontribs/pyrax
pyrax/http.py
request
def request(method, uri, *args, **kwargs): """ Handles all the common functionality required for API calls. Returns the resulting response object. Formats the request into a dict representing the headers and body that will be used to make the API call. """ req_method = req_methods[method.up...
python
def request(method, uri, *args, **kwargs): """ Handles all the common functionality required for API calls. Returns the resulting response object. Formats the request into a dict representing the headers and body that will be used to make the API call. """ req_method = req_methods[method.up...
Handles all the common functionality required for API calls. Returns the resulting response object. Formats the request into a dict representing the headers and body that will be used to make the API call.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/http.py#L42-L78
pycontribs/pyrax
pyrax/http.py
http_log_req
def http_log_req(method, uri, args, kwargs): """ When pyrax.get_http_debug() is True, outputs the equivalent `curl` command for the API request being made. """ if not pyrax.get_http_debug(): return string_parts = ["curl -i -X %s" % method] for element in args: string_parts.ap...
python
def http_log_req(method, uri, args, kwargs): """ When pyrax.get_http_debug() is True, outputs the equivalent `curl` command for the API request being made. """ if not pyrax.get_http_debug(): return string_parts = ["curl -i -X %s" % method] for element in args: string_parts.ap...
When pyrax.get_http_debug() is True, outputs the equivalent `curl` command for the API request being made.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/http.py#L81-L100
pycontribs/pyrax
pyrax/http.py
http_log_resp
def http_log_resp(resp, body): """ When pyrax.get_http_debug() is True, outputs the response received from the API request. """ if not pyrax.get_http_debug(): return log = logging.getLogger("pyrax") log.debug("RESP: %s\n%s", resp, resp.headers) if body: log.debug("RESP BO...
python
def http_log_resp(resp, body): """ When pyrax.get_http_debug() is True, outputs the response received from the API request. """ if not pyrax.get_http_debug(): return log = logging.getLogger("pyrax") log.debug("RESP: %s\n%s", resp, resp.headers) if body: log.debug("RESP BO...
When pyrax.get_http_debug() is True, outputs the response received from the API request.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/http.py#L103-L113