diff --git a/intg/src/main/python/README.md b/intg/src/main/python/README.md index 9d80a68..a973717 100644 --- a/intg/src/main/python/README.md +++ b/intg/src/main/python/README.md @@ -16,7 +16,7 @@ Verify if apache-atlas client is installed: Package Version ------------ --------- -apache-atlas 0.0.2 +apache-atlas 0.0.3 ``` ## Usage diff --git a/intg/src/main/python/apache_atlas/model/metrics.py b/intg/src/main/python/apache_atlas/client/admin.py similarity index 75% rename from intg/src/main/python/apache_atlas/model/metrics.py rename to intg/src/main/python/apache_atlas/client/admin.py index 636a3ea..171bcf8 100644 --- a/intg/src/main/python/apache_atlas/model/metrics.py +++ b/intg/src/main/python/apache_atlas/client/admin.py @@ -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) diff --git a/intg/src/main/python/apache_atlas/client/base_client.py b/intg/src/main/python/apache_atlas/client/base_client.py index 3e6002d..fe0ddf4 100644 --- a/intg/src/main/python/apache_atlas/client/base_client.py +++ b/intg/src/main/python/apache_atlas/client/base_client.py @@ -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) diff --git a/intg/src/main/python/apache_atlas/model/admin.py b/intg/src/main/python/apache_atlas/model/admin.py new file mode 100644 index 0000000..3be8a94 --- /dev/null +++ b/intg/src/main/python/apache_atlas/model/admin.py @@ -0,0 +1,33 @@ +#!/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', {}) diff --git a/intg/src/main/python/setup.py b/intg/src/main/python/setup.py index ed33ebe..f11fa55 100644 --- a/intg/src/main/python/setup.py +++ b/intg/src/main/python/setup.py @@ -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",