Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added health ready endpoints, fix API base url #13

Merged
merged 1 commit into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ commands:
--volume ${PWD}/.cache:/root/.cache/pip/ \
--workdir /usr/src/project \
--network influx_network \
--env INFLUXDB_V2_URL="http://192.168.0.2:9999/api/v2" \
--env INFLUXDB_V2_URL="http://192.168.0.2:9999" \
python:<< parameters.python-version >> /bin/bash -c "./scripts/ci-test.sh"
- save_cache:
name: Saving Pip Cache
Expand Down
17 changes: 11 additions & 6 deletions influxdb2/client/influxdb_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,23 @@ def health(self) -> HealthCheck:
:return:
"""
health_service = HealthService(self.api_client)
return health_service.get_health()

try:
health = health_service.get_health()
return health
except Exception as e:
print(e)
return HealthCheck(name="influxdb", message=str(e), status="fail")

def ready(self) -> Ready:
"""
Gets The readiness of the InfluxDB 2.0.
:return:
"""
ready_service = ReadyService(api_client=self)
ready_service = ReadyService(self.api_client)
return ready_service.get_ready()



class _Configuration(Configuration):
def __init__(self):
Configuration.__init__(self)
Expand All @@ -137,12 +142,12 @@ def update_request_header_params(self, path: str, params: dict):
super().update_request_header_params(path, params)
if self.enable_gzip:
# GZIP Request
if path == '/write':
if path == '/api/v2/write':
params["Content-Encoding"] = "gzip"
params["Accept-Encoding"] = "identity"
pass
# GZIP Response
if path == '/query':
if path == '/api/v2/query':
# params["Content-Encoding"] = "gzip"
params["Accept-Encoding"] = "gzip"
pass
Expand All @@ -153,7 +158,7 @@ def update_request_body(self, path: str, body):
_body = super().update_request_body(path, body)
if self.enable_gzip:
# GZIP Request
if path == '/write':
if path == '/api/v2/write':
import gzip
if isinstance(_body, bytes):
return gzip.compress(data=_body)
Expand Down
12 changes: 5 additions & 7 deletions influxdb2/service/authorizations_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

from __future__ import absolute_import

import re # noqa: F401

# python 2 and python 3 compatibility library
import six

Expand Down Expand Up @@ -115,7 +113,7 @@ def delete_authorizations_id_with_http_info(self, auth_id, **kwargs): # noqa: E
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/authorizations/{authID}', 'DELETE',
'/api/v2/authorizations/{authID}', 'DELETE',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -221,7 +219,7 @@ def get_authorizations_with_http_info(self, **kwargs): # noqa: E501
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/authorizations', 'GET',
'/api/v2/authorizations', 'GET',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -319,7 +317,7 @@ def get_authorizations_id_with_http_info(self, auth_id, **kwargs): # noqa: E501
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/authorizations/{authID}', 'GET',
'/api/v2/authorizations/{authID}', 'GET',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -429,7 +427,7 @@ def patch_authorizations_id_with_http_info(self, auth_id, authorization_update_r
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/authorizations/{authID}', 'PATCH',
'/api/v2/authorizations/{authID}', 'PATCH',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -531,7 +529,7 @@ def post_authorizations_with_http_info(self, authorization, **kwargs): # noqa:
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/authorizations', 'POST',
'/api/v2/authorizations', 'POST',
path_params,
query_params,
header_params,
Expand Down
34 changes: 16 additions & 18 deletions influxdb2/service/buckets_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

from __future__ import absolute_import

import re # noqa: F401

# python 2 and python 3 compatibility library
import six

Expand Down Expand Up @@ -115,7 +113,7 @@ def delete_buckets_id_with_http_info(self, bucket_id, **kwargs): # noqa: E501
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets/{bucketID}', 'DELETE',
'/api/v2/buckets/{bucketID}', 'DELETE',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -221,7 +219,7 @@ def delete_buckets_id_labels_id_with_http_info(self, bucket_id, label_id, **kwar
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets/{bucketID}/labels/{labelID}', 'DELETE',
'/api/v2/buckets/{bucketID}/labels/{labelID}', 'DELETE',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -327,7 +325,7 @@ def delete_buckets_id_members_id_with_http_info(self, user_id, bucket_id, **kwar
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets/{bucketID}/members/{userID}', 'DELETE',
'/api/v2/buckets/{bucketID}/members/{userID}', 'DELETE',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -433,7 +431,7 @@ def delete_buckets_id_owners_id_with_http_info(self, user_id, bucket_id, **kwarg
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets/{bucketID}/owners/{userID}', 'DELETE',
'/api/v2/buckets/{bucketID}/owners/{userID}', 'DELETE',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -549,7 +547,7 @@ def get_buckets_with_http_info(self, **kwargs): # noqa: E501
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets', 'GET',
'/api/v2/buckets', 'GET',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -647,7 +645,7 @@ def get_buckets_id_with_http_info(self, bucket_id, **kwargs): # noqa: E501
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets/{bucketID}', 'GET',
'/api/v2/buckets/{bucketID}', 'GET',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -745,7 +743,7 @@ def get_buckets_id_labels_with_http_info(self, bucket_id, **kwargs): # noqa: E5
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets/{bucketID}/labels', 'GET',
'/api/v2/buckets/{bucketID}/labels', 'GET',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -857,7 +855,7 @@ def get_buckets_id_logs_with_http_info(self, bucket_id, **kwargs): # noqa: E501
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets/{bucketID}/logs', 'GET',
'/api/v2/buckets/{bucketID}/logs', 'GET',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -955,7 +953,7 @@ def get_buckets_id_members_with_http_info(self, bucket_id, **kwargs): # noqa: E
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets/{bucketID}/members', 'GET',
'/api/v2/buckets/{bucketID}/members', 'GET',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -1053,7 +1051,7 @@ def get_buckets_id_owners_with_http_info(self, bucket_id, **kwargs): # noqa: E5
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets/{bucketID}/owners', 'GET',
'/api/v2/buckets/{bucketID}/owners', 'GET',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -1155,7 +1153,7 @@ def get_sources_id_buckets_with_http_info(self, source_id, **kwargs): # noqa: E
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/sources/{sourceID}/buckets', 'GET',
'/api/v2/sources/{sourceID}/buckets', 'GET',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -1265,7 +1263,7 @@ def patch_buckets_id_with_http_info(self, bucket_id, bucket, **kwargs): # noqa:
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets/{bucketID}', 'PATCH',
'/api/v2/buckets/{bucketID}', 'PATCH',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -1367,7 +1365,7 @@ def post_buckets_with_http_info(self, bucket, **kwargs): # noqa: E501
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets', 'POST',
'/api/v2/buckets', 'POST',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -1477,7 +1475,7 @@ def post_buckets_id_labels_with_http_info(self, bucket_id, label_mapping, **kwar
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets/{bucketID}/labels', 'POST',
'/api/v2/buckets/{bucketID}/labels', 'POST',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -1587,7 +1585,7 @@ def post_buckets_id_members_with_http_info(self, bucket_id, add_resource_member_
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets/{bucketID}/members', 'POST',
'/api/v2/buckets/{bucketID}/members', 'POST',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -1697,7 +1695,7 @@ def post_buckets_id_owners_with_http_info(self, bucket_id, add_resource_member_r
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/buckets/{bucketID}/owners', 'POST',
'/api/v2/buckets/{bucketID}/owners', 'POST',
path_params,
query_params,
header_params,
Expand Down
14 changes: 6 additions & 8 deletions influxdb2/service/cells_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

from __future__ import absolute_import

import re # noqa: F401

# python 2 and python 3 compatibility library
import six

Expand Down Expand Up @@ -123,7 +121,7 @@ def delete_dashboards_id_cells_id_with_http_info(self, dashboard_id, cell_id, **
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/dashboards/{dashboardID}/cells/{cellID}', 'DELETE',
'/api/v2/dashboards/{dashboardID}/cells/{cellID}', 'DELETE',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -229,7 +227,7 @@ def get_dashboards_id_cells_id_view_with_http_info(self, dashboard_id, cell_id,
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/dashboards/{dashboardID}/cells/{cellID}/view', 'GET',
'/api/v2/dashboards/{dashboardID}/cells/{cellID}/view', 'GET',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -347,7 +345,7 @@ def patch_dashboards_id_cells_id_with_http_info(self, dashboard_id, cell_id, cel
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/dashboards/{dashboardID}/cells/{cellID}', 'PATCH',
'/api/v2/dashboards/{dashboardID}/cells/{cellID}', 'PATCH',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -465,7 +463,7 @@ def patch_dashboards_id_cells_id_view_with_http_info(self, dashboard_id, cell_id
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/dashboards/{dashboardID}/cells/{cellID}/view', 'PATCH',
'/api/v2/dashboards/{dashboardID}/cells/{cellID}/view', 'PATCH',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -575,7 +573,7 @@ def post_dashboards_id_cells_with_http_info(self, dashboard_id, create_cell, **k
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/dashboards/{dashboardID}/cells', 'POST',
'/api/v2/dashboards/{dashboardID}/cells', 'POST',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -685,7 +683,7 @@ def put_dashboards_id_cells_with_http_info(self, dashboard_id, cell, **kwargs):
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/dashboards/{dashboardID}/cells', 'PUT',
'/api/v2/dashboards/{dashboardID}/cells', 'PUT',
path_params,
query_params,
header_params,
Expand Down
Loading