Skip to content

Commit

Permalink
fix: Threshold domain models mapping, response types for `Dashboard…
Browse files Browse the repository at this point in the history
…Service` (#290)
  • Loading branch information
bednar authored Jul 26, 2021
1 parent 025e97e commit a26fc4c
Show file tree
Hide file tree
Showing 17 changed files with 170 additions and 44 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

### Bug Fixes
1. [#283](https://github.com/influxdata/influxdb-client-python/pull/283): Set proxy server in config file
1. [#290](https://github.com/influxdata/influxdb-client-python/pull/290): `Threshold` domain models mapping
1. [#290](https://github.com/influxdata/influxdb-client-python/pull/290): `DashboardService` responses types

## 1.19.0 [2021-07-09]

Expand Down
4 changes: 2 additions & 2 deletions influxdb_client/domain/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class Check(object):
and the value is json key in definition.
"""
openapi_types = {
'type': 'str',
'type': 'str'
}

attribute_map = {
'type': 'type',
'type': 'type'
}

discriminator_value_class_map = {
Expand Down
6 changes: 3 additions & 3 deletions influxdb_client/domain/greater_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
import re # noqa: F401

import six
from influxdb_client.domain.threshold import Threshold
from influxdb_client.domain.threshold_base import ThresholdBase


class GreaterThreshold(Threshold):
class GreaterThreshold(ThresholdBase):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand Down Expand Up @@ -48,7 +48,7 @@ class GreaterThreshold(Threshold):

def __init__(self, type="greater", value=None, level=None, all_values=None): # noqa: E501,D401,D403
"""GreaterThreshold - a model defined in OpenAPI.""" # noqa: E501
Threshold.__init__(self, level=level, all_values=all_values) # noqa: E501
ThresholdBase.__init__(self, level=level, all_values=all_values) # noqa: E501

self._type = None
self._value = None
Expand Down
6 changes: 3 additions & 3 deletions influxdb_client/domain/lesser_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
import re # noqa: F401

import six
from influxdb_client.domain.threshold import Threshold
from influxdb_client.domain.threshold_base import ThresholdBase


class LesserThreshold(Threshold):
class LesserThreshold(ThresholdBase):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand Down Expand Up @@ -48,7 +48,7 @@ class LesserThreshold(Threshold):

def __init__(self, type="lesser", value=None, level=None, all_values=None): # noqa: E501,D401,D403
"""LesserThreshold - a model defined in OpenAPI.""" # noqa: E501
Threshold.__init__(self, level=level, all_values=all_values) # noqa: E501
ThresholdBase.__init__(self, level=level, all_values=all_values) # noqa: E501

self._type = None
self._value = None
Expand Down
4 changes: 2 additions & 2 deletions influxdb_client/domain/notification_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class NotificationEndpoint(object):
and the value is json key in definition.
"""
openapi_types = {
'type': 'NotificationEndpointType',
'type': 'NotificationEndpointType'
}

attribute_map = {
'type': 'type',
'type': 'type'
}

discriminator_value_class_map = {
Expand Down
4 changes: 2 additions & 2 deletions influxdb_client/domain/notification_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class NotificationRule(object):
and the value is json key in definition.
"""
openapi_types = {
'type': 'str',
'type': 'str'
}

attribute_map = {
'type': 'type',
'type': 'type'
}

discriminator_value_class_map = {
Expand Down
4 changes: 2 additions & 2 deletions influxdb_client/domain/post_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class PostCheck(object):
and the value is json key in definition.
"""
openapi_types = {
'type': 'str',
'type': 'str'
}

attribute_map = {
'type': 'type',
'type': 'type'
}

discriminator_value_class_map = {
Expand Down
4 changes: 2 additions & 2 deletions influxdb_client/domain/post_notification_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class PostNotificationEndpoint(object):
and the value is json key in definition.
"""
openapi_types = {
'type': 'NotificationEndpointType',
'type': 'NotificationEndpointType'
}

attribute_map = {
'type': 'type',
'type': 'type'
}

discriminator_value_class_map = {
Expand Down
4 changes: 2 additions & 2 deletions influxdb_client/domain/post_notification_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class PostNotificationRule(object):
and the value is json key in definition.
"""
openapi_types = {
'type': 'str',
'type': 'str'
}

attribute_map = {
'type': 'type',
'type': 'type'
}

discriminator_value_class_map = {
Expand Down
7 changes: 5 additions & 2 deletions influxdb_client/domain/property_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import re # noqa: F401

import six
from influxdb_client.domain.expression import Expression


class PropertyKey(object):
class PropertyKey(Expression):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand All @@ -38,7 +39,9 @@ class PropertyKey(object):
}

def __init__(self): # noqa: E501,D401,D403
"""PropertyKey - a model defined in OpenAPI.""" # noqa: E501 self.discriminator = None
"""PropertyKey - a model defined in OpenAPI.""" # noqa: E501
Expression.__init__(self) # noqa: E501
self.discriminator = None

def to_dict(self):
"""Return the model properties as a dict."""
Expand Down
6 changes: 3 additions & 3 deletions influxdb_client/domain/range_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
import re # noqa: F401

import six
from influxdb_client.domain.threshold import Threshold
from influxdb_client.domain.threshold_base import ThresholdBase


class RangeThreshold(Threshold):
class RangeThreshold(ThresholdBase):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand Down Expand Up @@ -52,7 +52,7 @@ class RangeThreshold(Threshold):

def __init__(self, type="range", min=None, max=None, within=None, level=None, all_values=None): # noqa: E501,D401,D403
"""RangeThreshold - a model defined in OpenAPI.""" # noqa: E501
Threshold.__init__(self, level=level, all_values=all_values) # noqa: E501
ThresholdBase.__init__(self, level=level, all_values=all_values) # noqa: E501

self._type = None
self._min = None
Expand Down
49 changes: 40 additions & 9 deletions influxdb_client/domain/threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
import re # noqa: F401

import six
from influxdb_client.domain.threshold_base import ThresholdBase


class Threshold(ThresholdBase):
class Threshold(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand All @@ -33,19 +32,51 @@ class Threshold(ThresholdBase):
and the value is json key in definition.
"""
openapi_types = {
'level': 'CheckStatusLevel',
'all_values': 'bool'
'type': 'str',
}

attribute_map = {
'level': 'level',
'all_values': 'allValues'
'type': 'type',
}

def __init__(self, level=None, all_values=None): # noqa: E501,D401,D403
discriminator_value_class_map = {
'greater': 'GreaterThreshold',
'lesser': 'LesserThreshold',
'range': 'RangeThreshold'
}

def __init__(self, type=None): # noqa: E501,D401,D403
"""Threshold - a model defined in OpenAPI.""" # noqa: E501
ThresholdBase.__init__(self, level=level, all_values=all_values) # noqa: E501
self.discriminator = None
self._type = None
self.discriminator = 'type'

self.type = type

@property
def type(self):
"""Get the type of this Threshold.
:return: The type of this Threshold.
:rtype: str
""" # noqa: E501
return self._type

@type.setter
def type(self, type):
"""Set the type of this Threshold.
:param type: The type of this Threshold.
:type: str
""" # noqa: E501
if type is None:
raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501
self._type = type

def get_real_child_model(self, data):
"""Return the real base class specified by the discriminator."""
discriminator_key = self.attribute_map[self.discriminator]
discriminator_value = data[discriminator_key]
return self.discriminator_value_class_map.get(discriminator_value)

def to_dict(self):
"""Return the model properties as a dict."""
Expand Down
12 changes: 6 additions & 6 deletions influxdb_client/service/dashboards_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ def get_dashboards_id(self, dashboard_id, **kwargs): # noqa: E501,D401,D403
:param str dashboard_id: The ID of the dashboard to update. (required)
:param str zap_trace_span: OpenTracing span context
:param str include: Includes the cell view properties in the response if set to `properties`
:return: object
:return: Dashboard
If the method is called asynchronously,
returns the request thread.
""" # noqa: E501
Expand All @@ -756,7 +756,7 @@ def get_dashboards_id_with_http_info(self, dashboard_id, **kwargs): # noqa: E50
:param str dashboard_id: The ID of the dashboard to update. (required)
:param str zap_trace_span: OpenTracing span context
:param str include: Includes the cell view properties in the response if set to `properties`
:return: object
:return: Dashboard
If the method is called asynchronously,
returns the request thread.
""" # noqa: E501
Expand Down Expand Up @@ -820,7 +820,7 @@ def get_dashboards_id_with_http_info(self, dashboard_id, **kwargs): # noqa: E50
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='object', # noqa: E501
response_type='Dashboard', # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
Expand Down Expand Up @@ -1626,7 +1626,7 @@ def post_dashboards(self, create_dashboard_request, **kwargs): # noqa: E501,D40
:param async_req bool
:param CreateDashboardRequest create_dashboard_request: Dashboard to create (required)
:param str zap_trace_span: OpenTracing span context
:return: object
:return: Dashboard
If the method is called asynchronously,
returns the request thread.
""" # noqa: E501
Expand All @@ -1648,7 +1648,7 @@ def post_dashboards_with_http_info(self, create_dashboard_request, **kwargs): #
:param async_req bool
:param CreateDashboardRequest create_dashboard_request: Dashboard to create (required)
:param str zap_trace_span: OpenTracing span context
:return: object
:return: Dashboard
If the method is called asynchronously,
returns the request thread.
""" # noqa: E501
Expand Down Expand Up @@ -1714,7 +1714,7 @@ def post_dashboards_with_http_info(self, create_dashboard_request, **kwargs): #
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='object', # noqa: E501
response_type='Dashboard', # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
Expand Down
6 changes: 5 additions & 1 deletion influxdb_client/service/default_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ def post_signin(self, **kwargs): # noqa: E501,D401,D403
:param async_req bool
:param str zap_trace_span: OpenTracing span context
:param str authorization: An auth credential for the Basic scheme
:return: None
If the method is called asynchronously,
returns the request thread.
Expand All @@ -261,13 +262,14 @@ def post_signin_with_http_info(self, **kwargs): # noqa: E501,D401,D403
:param async_req bool
:param str zap_trace_span: OpenTracing span context
:param str authorization: An auth credential for the Basic scheme
:return: None
If the method is called asynchronously,
returns the request thread.
""" # noqa: E501
local_var_params = locals()

all_params = ['zap_trace_span'] # noqa: E501
all_params = ['zap_trace_span', 'authorization'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
Expand All @@ -292,6 +294,8 @@ def post_signin_with_http_info(self, **kwargs): # noqa: E501,D401,D403
header_params = {}
if 'zap_trace_span' in local_var_params:
header_params['Zap-Trace-Span'] = local_var_params['zap_trace_span'] # noqa: E501
if 'authorization' in local_var_params:
header_params['Authorization'] = local_var_params['authorization'] # noqa: E501

form_params = []
local_var_files = {}
Expand Down
Loading

0 comments on commit a26fc4c

Please sign in to comment.