Commit e07ba497 authored by Bill Wang's avatar Bill Wang
Browse files

Add basic schema retrieval api

parent 8eb69808
......@@ -63,7 +63,7 @@ class BaseClient:
self.entitlements_url = config_parser.get('environment', 'entitlements_url')
self.dataset_url = config_parser.get('environment', 'dataset_url')
self.use_service_principal = config_parser.get('environment', 'use_service_principal')
self.schema_url = config_parser.get('environment', 'schema_url')
self.provider = config_parser.get('provider', 'name')
self.service_principal_module_name = config_parser.get('provider', 'service_principal_module_name')
......@@ -112,4 +112,4 @@ class BaseClient:
self.unauth_retries = 0
return response
\ No newline at end of file
return response
# Copyright © 2020 Amazon Web Services
#
# Licensed 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.
# Copyright © 2020 Amazon Web Services
#
# Licensed 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.
import json
from typing import List
from osdu_api.clients.base_client import BaseClient
from osdu_api.model.http_method import HttpMethod
#from osdu_api.model.storage.schema.schema import Schema
#from osdu_api.model.storage.schema.schema_attribute import SchemaAttribute
class SchemaClient(BaseClient):
"""
Holds the logic for interfacing with Schema API
"""
def get_schema_by_id(self, schema_id: str, bearer_token=None):
return self.make_request(method=HttpMethod.GET, url = '{}/{}/{}'.format(self.schema_url, 'schema', schema_id),
data={}, bearer_token=bearer_token)
# Copyright © 2020 Amazon Web Services
#
# Licensed 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.
[environment]
data_partition_id=opendes
storage_url=%(BASE_URL)s/api/storage/v2
search_url=%(BASE_URL)s/api/search/v2
legal_url=%(BASE_URL)s/api/legal/v1
data_workflow_url=%(BASE_URL)s/api/data-workflow/v1
file_dms_url=%(BASE_URL)s/api/filedms/v2
dataset_url=%(BASE_URL)s/api/dataset-registry/v1
entitlements_url=%(BASE_URL)s/api/entitlements/v1
use_service_principal=False
[provider]
name=aws
service_principal_module_name=service_principal_util
token_url_ssm_path=/osdu/%(ENVIRONMENT)s/oauth-token-uri
aws_oauth_custom_scope_ssm_path=/osdu/%(ENVIRONMENT)s/oauth-custom-scope
client_id_ssm_path=/osdu/%(ENVIRONMENT)s/client-credentials-client-id
client_secret_name=/osdu/%(ENVIRONMENT)s/client_credentials_secret
client_secret_dict_key=client_credentials_client_secret
region_name=%(AWS_REGION)s
# Copyright © 2020 Amazon Web Services
#
# Licensed 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.
[environment]
data_partition_id=opendes
storage_url=%(BASE_URL)s/api/storage/v2
search_url=%(BASE_URL)s/api/search/v2
legal_url=%(BASE_URL)s/api/legal/v1
data_workflow_url=%(BASE_URL)s/api/data-workflow/v1
file_dms_url=%(BASE_URL)s/api/filedms/v2
dataset_url=%(BASE_URL)s/api/dataset-registry/v1
entitlements_url=%(BASE_URL)s/api/entitlements/v1
schema_url=%(BASE_URL)s/api/schema-service/v1
use_service_principal=False
[provider]
name=aws
service_principal_module_name=service_principal_util
token_url_ssm_path=/osdu/%(ENVIRONMENT)s/oauth-token-uri
aws_oauth_custom_scope_ssm_path=/osdu/%(ENVIRONMENT)s/oauth-custom-scope
client_id_ssm_path=/osdu/%(ENVIRONMENT)s/client-credentials-client-id
client_secret_name=/osdu/%(ENVIRONMENT)s/client_credentials_secret
client_secret_dict_key=client_credentials_client_secret
region_name=%(AWS_REGION)s
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