Replace 'value' arguments in telemetry proxy
Replace 'value' arguments with more appropriate names. Change-Id: I4dd7827b6dfe5474b0e14b98184ec118b11c7d8f
This commit is contained in:
parent
f3f06b2067
commit
111e588228
@ -11,11 +11,11 @@
|
||||
# under the License.
|
||||
|
||||
from openstack import proxy
|
||||
from openstack.telemetry.v2 import alarm
|
||||
from openstack.telemetry.v2 import alarm_change
|
||||
from openstack.telemetry.v2 import alarm as _alarm
|
||||
from openstack.telemetry.v2 import alarm_change as _alarm_change
|
||||
from openstack.telemetry.v2 import capability
|
||||
from openstack.telemetry.v2 import meter
|
||||
from openstack.telemetry.v2 import resource
|
||||
from openstack.telemetry.v2 import meter as _meter
|
||||
from openstack.telemetry.v2 import resource as _resource
|
||||
from openstack.telemetry.v2 import sample
|
||||
from openstack.telemetry.v2 import statistics
|
||||
|
||||
@ -33,12 +33,12 @@ class Proxy(proxy.BaseProxy):
|
||||
:returns: The results of alarm creation
|
||||
:rtype: :class:`~openstack.telemetry.v2.alarm.Alarm`
|
||||
"""
|
||||
return self._create(alarm.Alarm, **attrs)
|
||||
return self._create(_alarm.Alarm, **attrs)
|
||||
|
||||
def delete_alarm(self, value, ignore_missing=True):
|
||||
def delete_alarm(self, alarm, ignore_missing=True):
|
||||
"""Delete an alarm
|
||||
|
||||
:param value: The value can be either the ID of an alarm or a
|
||||
:param alarm: The value can be either the ID of an alarm or a
|
||||
:class:`~openstack.telemetry.v2.alarm.Alarm` instance.
|
||||
:param bool ignore_missing: When set to ``False``
|
||||
:class:`~openstack.exceptions.ResourceNotFound` will be
|
||||
@ -48,7 +48,7 @@ class Proxy(proxy.BaseProxy):
|
||||
|
||||
:returns: ``None``
|
||||
"""
|
||||
self._delete(alarm.Alarm, value, ignore_missing=ignore_missing)
|
||||
self._delete(_alarm.Alarm, alarm, ignore_missing=ignore_missing)
|
||||
|
||||
def find_alarm(self, name_or_id, ignore_missing=True):
|
||||
"""Find a single alarm
|
||||
@ -61,20 +61,20 @@ class Proxy(proxy.BaseProxy):
|
||||
attempting to find a nonexistent resource.
|
||||
:returns: One :class:`~openstack.telemetry.v2.alarm.Alarm` or None
|
||||
"""
|
||||
return self._find(alarm.Alarm, name_or_id,
|
||||
return self._find(_alarm.Alarm, name_or_id,
|
||||
ignore_missing=ignore_missing)
|
||||
|
||||
def get_alarm(self, value):
|
||||
def get_alarm(self, alarm):
|
||||
"""Get a single alarm
|
||||
|
||||
:param value: The value can be the ID of an alarm or a
|
||||
:param alarm: The value can be the ID of an alarm or a
|
||||
:class:`~openstack.telemetry.v2.alarm.Alarm` instance.
|
||||
|
||||
:returns: One :class:`~openstack.telemetry.v2.alarm.Alarm`
|
||||
:raises: :class:`~openstack.exceptions.ResourceNotFound`
|
||||
when no resource can be found.
|
||||
"""
|
||||
return self._get(alarm.Alarm, value)
|
||||
return self._get(_alarm.Alarm, alarm)
|
||||
|
||||
def alarms(self, **query):
|
||||
"""Return a generator of alarms
|
||||
@ -85,12 +85,12 @@ class Proxy(proxy.BaseProxy):
|
||||
:returns: A generator of alarm objects
|
||||
:rtype: :class:`~openstack.telemetry.v2.alarm.Alarm`
|
||||
"""
|
||||
return self._list(alarm.Alarm, paginated=False, **query)
|
||||
return self._list(_alarm.Alarm, paginated=False, **query)
|
||||
|
||||
def update_alarm(self, value, **attrs):
|
||||
def update_alarm(self, alarm, **attrs):
|
||||
"""Update a alarm
|
||||
|
||||
:param value: Either the id of a alarm or a
|
||||
:param alarm: Either the id of a alarm or a
|
||||
:class:`~openstack.telemetry.v2.alarm.Alarm` instance.
|
||||
:attrs kwargs: The attributes to update on the alarm represented
|
||||
by ``value``.
|
||||
@ -98,7 +98,7 @@ class Proxy(proxy.BaseProxy):
|
||||
:returns: The updated alarm
|
||||
:rtype: :class:`~openstack.telemetry.v2.alarm.Alarm`
|
||||
"""
|
||||
return self._update(alarm.Alarm, value, **attrs)
|
||||
return self._update(_alarm.Alarm, alarm, **attrs)
|
||||
|
||||
def find_alarm_change(self, name_or_id, ignore_missing=True):
|
||||
"""Find a single alarm change
|
||||
@ -112,21 +112,21 @@ class Proxy(proxy.BaseProxy):
|
||||
:returns: One :class:`~openstack.telemetry.v2.alarm_change.AlarmChange`
|
||||
or None
|
||||
"""
|
||||
return self._find(alarm_change.AlarmChange, name_or_id,
|
||||
return self._find(_alarm_change.AlarmChange, name_or_id,
|
||||
ignore_missing=ignore_missing)
|
||||
|
||||
def alarm_changes(self, value, **query):
|
||||
def alarm_changes(self, alarm, **query):
|
||||
"""Return a generator of alarm changes
|
||||
|
||||
:param value: Alarm resource or id for alarm.
|
||||
:param alarm: Alarm resource or id for alarm.
|
||||
:param kwargs \*\*query: Optional query parameters to be sent to limit
|
||||
the resources being returned.
|
||||
|
||||
:returns: A generator of alarm change objects
|
||||
:rtype: :class:`~openstack.telemetry.v2.alarm_change.AlarmChange`
|
||||
"""
|
||||
alarm_id = alarm.Alarm.from_id(value).id
|
||||
return self._list(alarm_change.AlarmChange, paginated=False,
|
||||
alarm_id = _alarm.Alarm.from_id(alarm).id
|
||||
return self._list(_alarm_change.AlarmChange, paginated=False,
|
||||
path_args={'alarm_id': alarm_id}, **query)
|
||||
|
||||
def find_capability(self, name_or_id, ignore_missing=True):
|
||||
@ -166,7 +166,7 @@ class Proxy(proxy.BaseProxy):
|
||||
attempting to find a nonexistent resource.
|
||||
:returns: One :class:`~openstack.telemetry.v2.meter.Meter` or None
|
||||
"""
|
||||
return self._find(meter.Meter, name_or_id,
|
||||
return self._find(_meter.Meter, name_or_id,
|
||||
ignore_missing=ignore_missing)
|
||||
|
||||
def meters(self, **query):
|
||||
@ -178,7 +178,7 @@ class Proxy(proxy.BaseProxy):
|
||||
:returns: A generator of meter objects
|
||||
:rtype: :class:`~openstack.telemetry.v2.meter.Meter`
|
||||
"""
|
||||
return self._list(meter.Meter, paginated=False, **query)
|
||||
return self._list(_meter.Meter, paginated=False, **query)
|
||||
|
||||
def find_resource(self, name_or_id, ignore_missing=True):
|
||||
"""Find a single resource
|
||||
@ -192,21 +192,21 @@ class Proxy(proxy.BaseProxy):
|
||||
:returns: One :class:`~openstack.telemetry.v2.resource.Resource` or
|
||||
None
|
||||
"""
|
||||
return self._find(resource.Resource, name_or_id,
|
||||
return self._find(_resource.Resource, name_or_id,
|
||||
ignore_missing=ignore_missing)
|
||||
|
||||
def get_resource(self, value):
|
||||
def get_resource(self, resource):
|
||||
"""Get a single resource
|
||||
|
||||
:param value: The value can be the ID of a resource or a
|
||||
:class:`~openstack.telemetry.v2.resource.Resource`
|
||||
instance.
|
||||
:param resource: The value can be the ID of a resource or a
|
||||
:class:`~openstack.telemetry.v2.resource.Resource`
|
||||
instance.
|
||||
|
||||
:returns: One :class:`~openstack.telemetry.v2.resource.Resource`
|
||||
:raises: :class:`~openstack.exceptions.ResourceNotFound`
|
||||
when no resource can be found.
|
||||
"""
|
||||
return self._get(resource.Resource, value)
|
||||
return self._get(_resource.Resource, resource)
|
||||
|
||||
def resources(self, **query):
|
||||
"""Return a generator of resources
|
||||
@ -217,7 +217,7 @@ class Proxy(proxy.BaseProxy):
|
||||
:returns: A generator of resource objects
|
||||
:rtype: :class:`~openstack.telemetry.v2.resource.Resource`
|
||||
"""
|
||||
return self._list(resource.Resource, paginated=False, **query)
|
||||
return self._list(_resource.Resource, paginated=False, **query)
|
||||
|
||||
def create_sample(self, **attrs):
|
||||
"""Create a new sample from attributes
|
||||
@ -245,7 +245,7 @@ class Proxy(proxy.BaseProxy):
|
||||
return self._find(sample.Sample, name_or_id,
|
||||
ignore_missing=ignore_missing)
|
||||
|
||||
def samples(self, value, **query):
|
||||
def samples(self, meter, **query):
|
||||
"""Return a generator of samples
|
||||
|
||||
:param value: Meter resource or name for a meter.
|
||||
@ -255,7 +255,7 @@ class Proxy(proxy.BaseProxy):
|
||||
:returns: A generator of sample objects
|
||||
:rtype: :class:`~openstack.telemetry.v2.sample.Sample`
|
||||
"""
|
||||
meter_name = meter.Meter.from_name(value).name
|
||||
meter_name = _meter.Meter.from_name(meter).name
|
||||
return self._list(sample.Sample, paginated=False,
|
||||
path_args={'counter_name': meter_name}, **query)
|
||||
|
||||
@ -274,16 +274,16 @@ class Proxy(proxy.BaseProxy):
|
||||
return self._find(statistics.Statistics, name_or_id,
|
||||
ignore_missing=ignore_missing)
|
||||
|
||||
def statistics(self, value, **query):
|
||||
def statistics(self, meter, **query):
|
||||
"""Return a generator of statistics
|
||||
|
||||
:param value: Meter resource or name for a meter.
|
||||
:param meter: Meter resource or name for a meter.
|
||||
:param kwargs \*\*query: Optional query parameters to be sent to limit
|
||||
the resources being returned.
|
||||
|
||||
:returns: A generator of statistics objects
|
||||
:rtype: :class:`~openstack.telemetry.v2.statistics.Statistics`
|
||||
"""
|
||||
meter_name = meter.Meter.from_name(value).name
|
||||
meter_name = _meter.Meter.from_name(meter).name
|
||||
return self._list(statistics.Statistics, paginated=False,
|
||||
path_args={'meter_name': meter_name}, **query)
|
||||
|
Loading…
Reference in New Issue
Block a user