text
stringlengths
0
828
path += '/%s' % incident_id
return self.paginate_get(path, data=kwargs)"
76,"def create(self, name, message, status, visible, component_id=None,
component_status=None, notify=None, created_at=None,
template=None, tplvars=None):
""""""Create a new Incident
:param str name: Name of the incident
:param str message: Incident explanation message
:param int status: Status of the incident
:param int visible: Whether the incident is publicly visible
:param int component_id: Component to update
:param int component_status: The status to update the given component
:param bool notify: Whether to notify subscribers
:param str created_at: When the incident was created
:param str template: The template slug to use
:param list tplvars: The variables to pass to the template
:return: Created incident data (:class:`dict`)
.. seealso:: https://docs.cachethq.io/reference#incidents
""""""
data = ApiParams()
data['name'] = name
data['message'] = message
data['status'] = status
data['visible'] = visible
data['component_id'] = component_id
data['component_status'] = component_status
data['notify'] = notify
data['created_at'] = created_at
data['template'] = template
data['vars'] = tplvars
return self._post('incidents', data=data)['data']"
77,"def update(self, incident_id, name=None, message=None, status=None,
visible=None, component_id=None, component_status=None,
notify=None, created_at=None, template=None, tpl_vars=None):
""""""Update an Incident
:param int incident_id: Incident ID
:param str name: Name of the incident
:param str message: Incident explanation message
:param int status: Status of the incident
:param int visible: Whether the incident is publicly visible
:param int component_id: Component to update
:param int component_status: The status to update the given component
:param bool notify: Whether to notify subscribers
:param str created_at: When the incident was created
:param str template: The template slug to use
:param list tpl_vars: The variables to pass to the template
:return: Created incident data (:class:`dict`)
.. seealso:: https://docs.cachethq.io/reference#update-an-incident
""""""
data = ApiParams()
data['name'] = name
data['message'] = message
data['status'] = status
data['visible'] = visible
data['component_id'] = component_id
data['component_status'] = component_status
data['notify'] = notify
data['created_at'] = created_at
data['template'] = template
data['vars'] = tpl_vars
return self._put('incidents/%s' % incident_id, data=data)['data']"
78,"def points(self):
""""""Metric points
Special property which point to a :class:`~pylls.cachet.MetricPoints`
instance for convenience. This instance is initialized on first call.
""""""
if not self._points:
self._points = MetricPoints(self.api_client)
return self._points"
79,"def get(self, metric_id=None, **kwargs):
""""""Get metrics
:param int metric_id: Metric ID
:return: Metrics data (:class:`dict`)
Additional named arguments may be passed and are directly transmitted
to API. It is useful to use the API search features.
.. seealso:: https://docs.cachethq.io/reference#get-metrics
.. seealso:: https://docs.cachethq.io/docs/advanced-api-usage
""""""
path = 'metrics'
if metric_id is not None:
path += '/%s' % metric_id
return self.paginate_get(path, data=kwargs)"
80,"def create(self, name, suffix, description, default_value, display=None):
""""""Create a new Metric
:param str name: Name of metric
:param str suffix: Metric unit
:param str description: Description of what the metric is measuring
:param int default_value: Default value to use when a point is added
:param int display: Display the chart on the status page
:return: Created metric data (:class:`dict`)