Commit af55c7f8 by Verdan Mahmood Committed by Madhan Neethiraj

ATLAS-4080: updated Python client with addition of API to retrieve metrics

parent 4fb6c7b4
......@@ -16,7 +16,7 @@ Verify if apache-atlas client is installed:
Package Version
------------ ---------
apache-atlas 0.0.2
apache-atlas 0.0.3
```
## Usage
......
......@@ -17,11 +17,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from apache_atlas.model.admin import *
from apache_atlas.utils import *
class AtlasMetrics(AtlasBase):
def __init__(self, attrs={}):
AtlasBase.__init__(self, attrs)
class AdminClient:
BASE_ADMIN_URL = BASE_URI + "admin/"
self.data = attrs.get('data')
GET_METRICS_API = API(BASE_ADMIN_URL + "metrics", HttpMethod.GET, HTTPStatus.OK)
def __init__(self, client):
self.client = client
def get_metrics(self):
return self.client.call_api(AdminClient.GET_METRICS_API, AtlasAdminMetrics)
......@@ -28,11 +28,11 @@ from apache_atlas.client.entity import EntityClient
from apache_atlas.client.glossary import GlossaryClient
from apache_atlas.client.lineage import LineageClient
from apache_atlas.client.relationship import RelationshipClient
from apache_atlas.client.admin import AdminClient
from apache_atlas.client.typedef import TypeDefClient
from apache_atlas.exceptions import AtlasServiceException
from apache_atlas.utils import HttpMethod, HTTPStatus, type_coerce
LOG = logging.getLogger('apache_atlas')
......@@ -50,10 +50,10 @@ class AtlasClient:
self.discovery = DiscoveryClient(self)
self.glossary = GlossaryClient(self)
self.relationship = RelationshipClient(self)
self.admin = AdminClient(self)
logging.getLogger("requests").setLevel(logging.WARNING)
def call_api(self, api, response_type=None, query_params=None, request_obj=None):
params = copy.deepcopy(self.request_params)
path = os.path.join(self.host, api.path)
......
#!/usr/bin/env/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from apache_atlas.model.instance import AtlasBase
class AtlasAdminMetrics(AtlasBase):
def __init__(self, attrs=None):
AtlasBase.__init__(self, attrs)
attrs = attrs or {}
_data = attrs.get('data', {})
self.general = _data.get('general', {})
self.tag = _data.get('tag', {})
self.entity = _data.get('entity', {})
self.system = _data.get('system', {})
......@@ -28,7 +28,7 @@ with open("README.md", "r") as fh:
setup(
name='apache-atlas',
version='0.0.2',
version='0.0.3',
author="Apache Atlas",
author_email='dev@atlas.apache.org',
description="Apache Atlas Python Client",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment